Release 940524
Mon May 23 15:07:36 1994 Bob Amstadt (bob@pooh)
* [loader/selector.c]
Allocate heap and stack segments as 64k.
Sat May 21 01:15:49 1994 Rick Sladkey (jrs@world.std.com)
* [loader/selector.c]
Correct typos where memcpy is used instead of memset.
* [loader/resource.c]
Allow for legitimate cases where biSizeImage is 0 in LoadIcon
by calculating the value when the bitmap is not compressed.
* [miscemu/int21.c]
Fix NULL dereference caused by superfluous DOS_closedir in FindNext.
* [loader/resource.c]
New function type_match to handle string resource types as
well as IDs. In addition, compare only low 4 bits of type_id
when both numbers are IDs so that 0x0002 matches 0x8002.
In FindResourceByNumber and FindResourceByName use type_match
instead of comparing numbers. In FindResource handle the
"#number" syntax and empty strings in both the resource and
type names.
Mon May 23 00:48:25 1994 Rick Sladkey (jrs@world.std.com)
* [windows/dialog.c]
Fix inadvertent printing of string IDs as strings.
May 23, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [controls/menu.c]
New functions GetMenuItemCount(), GetMenuItemID().
GetMenuString() & HiliteMenuItem().
Bug fix in CheckMenuItem().
Function SetMenu() now make client area recalc if menu removed.
* [windows/winpos.c]
Bug fix in SetWindowPos(), no more XMapping or XConfiguring of
windows with initial width or height equal zero.
* [objects/gdiobj.c]
New function EnumObjects(), using new lpPenBrushList buildup
from calls to new function GDI_AppendToPenBrushList().
('pbrush.exe' don't show its face yet ! ... :-( )
New EMPTY STUB for function SetObjectOwner(),
('mplayer.exe' call it via GetProcAddress() ...)
* [objects/font.c]
New internal functions ParseFontParms() & InitFontsList().
EnumFonts() & EnumFontFamilies() enumerates fonts (no more dummies).
FONT_MatchFont now make retries to find closest-smallest font.
('charmap.exe' can now show the differents fonts available)
* [windows/nonclient.c]
Use small dos OBM_OLD_CLOSE button for MDI windows.
* [windows/graphics.c] [objects/bitmap.c]
Start to remove obsolete globals such XT_screen ...
* [loader/library.c]
Make function GetProcAddress() working also with builtin DLLs.
Tue May 24 20:18:02 1994 Erik Bos (erik@hacktic.nl)
* [if1632/system.spec] [if1632/toolhelp.spec]
system.dll & toolhelp.dll added.
* [loader/library.c]
Modified GetModuleFileName() to return the full
filename.
Added a check to LoadLibrary() to prevent loading
built in dlls. (eg. user.exe)
Added a check to FreeLibrary() to prevent built-in
dlls from being freed.
Modified GetProcAddress() to support builtin dlls.
* [loader/signal.c] [miscemu/int2f.c]
Added => pifedit runs.
* [misc/dos_fs.c]
Added a NULL-ptr check to DOS_closedir().
diff --git a/ChangeLog b/ChangeLog
index ed36b23..1d12476 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,90 @@
----------------------------------------------------------------------
+Mon May 23 15:07:36 1994 Bob Amstadt (bob@pooh)
+
+ * [loader/selector.c]
+ Allocate heap and stack segments as 64k.
+
+Sat May 21 01:15:49 1994 Rick Sladkey (jrs@world.std.com)
+
+ * [loader/selector.c]
+ Correct typos where memcpy is used instead of memset.
+
+ * [loader/resource.c]
+ Allow for legitimate cases where biSizeImage is 0 in LoadIcon
+ by calculating the value when the bitmap is not compressed.
+
+ * [miscemu/int21.c]
+ Fix NULL dereference caused by superfluous DOS_closedir in FindNext.
+
+ * [loader/resource.c]
+ New function type_match to handle string resource types as
+ well as IDs. In addition, compare only low 4 bits of type_id
+ when both numbers are IDs so that 0x0002 matches 0x8002.
+ In FindResourceByNumber and FindResourceByName use type_match
+ instead of comparing numbers. In FindResource handle the
+ "#number" syntax and empty strings in both the resource and
+ type names.
+
+Mon May 23 00:48:25 1994 Rick Sladkey (jrs@world.std.com)
+
+ * [windows/dialog.c]
+ Fix inadvertent printing of string IDs as strings.
+
+May 16, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
+
+ * [controls/menu.c]
+ New functions GetMenuItemCount(), GetMenuItemID().
+ GetMenuString() & HiliteMenuItem().
+ Bug fix in CheckMenuItem().
+ Function SetMenu() now make client area recalc if menu removed.
+
+ * [windows/winpos.c]
+ Bug fix in SetWindowPos(), no more XMapping or XConfiguring of
+ windows with initial width or height equal zero.
+
+ * [objects/gdiobj.c]
+ New function EnumObjects(), using new lpPenBrushList buildup
+ from calls to new function GDI_AppendToPenBrushList().
+ ('pbrush.exe' don't show its face yet ! ... :-( )
+ New EMPTY STUB for function SetObjectOwner(),
+ ('mplayer.exe' call it via GetProcAddress() ...)
+
+ * [objects/font.c]
+ New internal functions ParseFontParms() & InitFontsList().
+ EnumFonts() & EnumFontFamilies() enumerates fonts (no more dummies).
+ FONT_MatchFont now make retries to find closest-smallest font.
+ ('charmap.exe' can now show the differents fonts available)
+
+ * [windows/nonclient.c]
+ Use small dos OBM_OLD_CLOSE button for MDI windows.
+
+ * [windows/graphics.c] [objects/bitmap.c]
+ Start to remove obsolete globals such XT_screen ...
+
+ * [loader/library.c]
+ Make function GetProcAddress() working also with builtin DLLs.
+
+Tue May 24 20:18:02 1994 Erik Bos (erik@hacktic.nl)
+
+ * [if1632/system.spec] [if1632/toolhelp.spec]
+ system.dll & toolhelp.dll added.
+
+ * [loader/library.c]
+ Modified GetModuleFileName() to return the full
+ filename.
+ Added a check to LoadLibrary() to prevent loading
+ built in dlls. (eg. user.exe)
+ Added a check to FreeLibrary() to prevent built-in
+ dlls from being freed.
+ Modified GetProcAddress() to support builtin dlls.
+
+ * [loader/signal.c] [miscemu/int2f.c]
+ Added => pifedit runs.
+
+ * [misc/dos_fs.c]
+ Added a NULL-ptr check to DOS_closedir().
+
+----------------------------------------------------------------------
Tue May 17 23:03:16 1994 Bob Amstadt (bob@pooh)
* [windows/dce.c]
diff --git a/LICENSE b/LICENSE
index 3854e93..88add0b 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1 +1,30 @@
-All code unless stated otherwise is covered by the GNU Pubic License.
+You may without charge, royalty or other payment, copy and
+distribute copies of this work and derivative works of this work
+in source or binary form provided that: (1)
+you appropriately publish on each copy an appropriate copyright
+notice; (2) faithfully reproduce all prior copyright notices
+included in the original work (you may also add your own
+copyright notice); and (3) agree to indemnify and hold all prior
+authors, copyright holders and licensors of the work harmless
+from and against all damages arising from use of the work.
+
+You may distribute sources of derivative works of the work
+provided that (1) (a) all source files of the original work that
+have been modified, (b) all source files of the derivative work
+that contain any party of the original work, and (c) all source
+files of the derivative work that are necessary to compile, link
+and run the derivative work without unresolved external calls and
+with the same functionality of the original work ("Necessary
+Sources") carry a prominent notice explaining the nature and date
+of the modification and/or creation. You are encouraged to make
+the Necessary Sources available under this license in order to
+further the development and acceptance of the work.
+
+EXCEPT AS OTHERWISE RESTRICTED BY LAW, THIS WORK IS PROVIDED
+WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES OF ANY KIND, INCLUDING
+BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF FITNESS FOR A
+PARTICULAR PURPOSE, MERCHANTABILITY OR TITLE. EXCEPT AS
+OTHERWISE PROVIDED BY LAW, NO AUTHOR, COPYRIGHT HOLDER OR
+LICENSOR SHALL BE LIABLE TO YOU FOR DAMAGES OF ANY KIND, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
diff --git a/README b/README
index 1d735be..4df0e04 100644
--- a/README
+++ b/README
@@ -1,8 +1,34 @@
-Copyright Robert J. Amstadt, 1993. All code is provided without
-warranty. All code is covered by the license contained in the file
-LICENSE unless explicitly stated in the individual source file.
+0. LICENSE
+You may without charge, royalty or other payment, copy and
+distribute copies of this work and derivative works of this work
+in source or binary form provided that: (1)
+you appropriately publish on each copy an appropriate copyright
+notice; (2) faithfully reproduce all prior copyright notices
+included in the original work (you may also add your own
+copyright notice); and (3) agree to indemnify and hold all prior
+authors, copyright holders and licensors of the work harmless
+from and against all damages arising from use of the work.
+You may distribute sources of derivative works of the work
+provided that (1) (a) all source files of the original work that
+have been modified, (b) all source files of the derivative work
+that contain any party of the original work, and (c) all source
+files of the derivative work that are necessary to compile, link
+and run the derivative work without unresolved external calls and
+with the same functionality of the original work ("Necessary
+Sources") carry a prominent notice explaining the nature and date
+of the modification and/or creation. You are encouraged to make
+the Necessary Sources available under this license in order to
+further the development and acceptance of the work.
+
+EXCEPT AS OTHERWISE RESTRICTED BY LAW, THIS WORK IS PROVIDED
+WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES OF ANY KIND, INCLUDING
+BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF FITNESS FOR A
+PARTICULAR PURPOSE, MERCHANTABILITY OR TITLE. EXCEPT AS
+OTHERWISE PROVIDED BY LAW, NO AUTHOR, COPYRIGHT HOLDER OR
+LICENSOR SHALL BE LIABLE TO YOU FOR DAMAGES OF ANY KIND, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
1. COMPILATION:
@@ -171,6 +197,11 @@
7. WHAT'S NEW
+WHAT'S NEW with Wine-940524: (see ChangeLog for details)
+ - New menu functions
+ - EnumObjects()
+ - and many many bug fixes!
+
WHAT'S NEW with Wine-940518: (see ChangeLog for details)
- debugger improvements
- bug fixes to get some dialog boxes working.
diff --git a/controls/Imakefile b/controls/Imakefile
index 2615294..4556b4c 100644
--- a/controls/Imakefile
+++ b/controls/Imakefile
@@ -9,7 +9,7 @@
menu.c \
scroll.c \
static.c \
- edit.o \
+ edit.c \
desktop.c \
widgets.c
diff --git a/controls/combo.c b/controls/combo.c
index 48d0519..22a1b08 100644
--- a/controls/combo.c
+++ b/controls/combo.c
@@ -263,7 +263,9 @@
if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_ADDSTRING, wParam, lParam));
case CB_GETLBTEXT:
+#ifdef DEBUG_COMBO
printf("CB_GETLBTEXT #%u !\n", wParam);
+#endif
lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_GETTEXT, wParam, lParam));
diff --git a/controls/edit.c b/controls/edit.c
index 5528247..5e43c3b 100644
--- a/controls/edit.c
+++ b/controls/edit.c
@@ -309,7 +309,6 @@
break;
case WM_KEYDOWN:
- printf("EDIT WM_KEYDOWN w=%04X !\n", wParam);
EDIT_KeyDownMsg(hwnd, wParam);
break;
diff --git a/controls/menu.c b/controls/menu.c
index e41c968..dd9c880 100644
--- a/controls/menu.c
+++ b/controls/menu.c
@@ -14,6 +14,7 @@
#include "sysmetrics.h"
#include "prototypes.h"
#include "menu.h"
+#include "user.h"
#include "heap.h"
#include "win.h"
@@ -50,6 +51,7 @@
LPSTR GetShortCutString(LPSTR str);
WORD GetShortCutPos(LPSTR str);
BOOL HideAllSubPopupMenu(LPPOPUPMENU menu);
+void InitStdBitmaps();
HMENU CopySysMenu();
WORD * ParseMenuResource(WORD *first_item, int level, HMENU hMenu);
void SetMenuLogicalParent(HMENU hMenu, HWND hWnd);
@@ -84,10 +86,7 @@
#ifdef DEBUG_MENU
printf("PopupMenu WM_CREATE lppop=%08X !\n", lppop);
#endif
- if (hStdCheck == (HBITMAP)NULL)
- hStdCheck = LoadBitmap((HANDLE)NULL, (LPSTR)OBM_CHECK);
- if (hStdMnArrow == (HBITMAP)NULL)
- hStdMnArrow = LoadBitmap((HANDLE)NULL, (LPSTR)OBM_MNARROW);
+ InitStdBitmaps();
#ifdef DEBUG_MENU
printf("PopupMenu End of WM_CREATE !\n");
#endif
@@ -215,6 +214,7 @@
ShowWindow(hwnd, SW_HIDE);
hwnd = lppop->hWndParent;
lppop = PopupMenuGetWindowAndStorage(hwnd, &wndPtr);
+ printf("VK_LEFT // try to put focus on MenuBar %08X !\n", lppop);
if (lppop == NULL) break;
MenuItemSelect(hwnd, lppop, lppop->nItems - 1);
break;
@@ -241,6 +241,7 @@
ShowWindow(hwnd, SW_HIDE);
hwnd = lppop->hWndParent;
lppop = PopupMenuGetWindowAndStorage(hwnd, &wndPtr);
+ printf("VK_RIGHT // try to put focus on MenuBar %08X !\n", lppop);
if (lppop == NULL) break;
MenuItemSelect(hwnd, lppop, 0);
break;
@@ -262,11 +263,6 @@
}
MenuItemSelect(hwnd, lppop, lppop->FocusedItem + 1);
break;
- case VK_RETURN:
- case VK_SPACE:
-ProceedSPACE: lppop = PopupMenuGetWindowAndStorage(hwnd, &wndPtr);
- ExecFocusedMenuItem(hwnd, lppop);
- break;
default:
break;
}
@@ -280,6 +276,11 @@
lppop = PopupMenuGetWindowAndStorage(hwnd, &wndPtr);
if (lppop == NULL) break;
switch(wParam) {
+ case VK_RETURN:
+ case VK_SPACE:
+ProceedSPACE: lppop = PopupMenuGetWindowAndStorage(hwnd, &wndPtr);
+ ExecFocusedMenuItem(hwnd, lppop);
+ break;
case VK_ESCAPE:
if (lppop->BarFlag) {
#ifdef DEBUG_MENU
@@ -686,6 +687,7 @@
EndPaint(hwnd, &ps);
return;
}
+ InitStdBitmaps();
lppop = PopupMenuGetWindowAndStorage(hwnd, &wndPtr);
if (lppop == NULL) goto EndOfPaint;
hBrush = GetStockObject(WHITE_BRUSH);
@@ -734,8 +736,13 @@
hMemDC = CreateCompatibleDC(hDC);
SelectObject(hMemDC, hBitMap);
GetObject(hBitMap, sizeof(BITMAP), (LPSTR)&bm);
+#ifdef DEBUG_MENU
+ printf("StdDrawPopupMenu // MF_BITMAP hBit=%04X w=%d h=%d\n",
+ hBitMap, bm.bmWidth, bm.bmHeight);
+#endif
BitBlt(hDC, rect2.left, rect2.top,
- bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
+ bm.bmWidth, bm.bmHeight,
+ hMemDC, 0, 0, SRCCOPY);
DeleteDC(hMemDC);
if ((lpitem->item_flags & MF_HILITE) == MF_HILITE)
InvertRect(hDC, &lpitem->rect);
@@ -812,9 +819,7 @@
printf("StdDrawMenuBar(%04X, %08X, %08X); !\n", hDC, lprect, lppop);
#endif
MenuBarCalcSize(hDC, lprect, lppop);
- if (suppress_draw)
- return;
-
+ if (suppress_draw) return;
hOldFont = SelectObject(hDC, GetStockObject(SYSTEM_FONT));
hOldPen = SelectObject(hDC, GetStockObject(BLACK_PEN));
hBrush = GetStockObject(WHITE_BRUSH);
@@ -855,8 +860,13 @@
hMemDC = CreateCompatibleDC(hDC);
SelectObject(hMemDC, hBitMap);
GetObject(hBitMap, sizeof(BITMAP), (LPSTR)&bm);
+#ifdef DEBUG_MENU
+ printf("StdDrawMenuBar // MF_BITMAP hBit=%04X w=%d h=%d\n",
+ hBitMap, bm.bmWidth, bm.bmHeight);
+#endif
BitBlt(hDC, rect2.left, rect2.top,
- bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
+ bm.bmWidth, bm.bmHeight,
+ hMemDC, 0, 0, SRCCOPY);
DeleteDC(hMemDC);
}
if (((lpitem->item_flags & MF_BITMAP) != MF_BITMAP) &&
@@ -955,6 +965,7 @@
#ifdef DEBUG_MENUCALC
printf("PopupMenuCalcSize hWnd=%04X !\n", hWnd);
#endif
+ InitStdBitmaps();
lppop = PopupMenuGetWindowAndStorage(hwnd, &wndPtr);
if (lppop == NULL) return;
if (lppop->nItems == 0) return;
@@ -1039,6 +1050,7 @@
DWORD dwRet;
if (lppop == NULL) return;
if (lppop->nItems == 0) return;
+ InitStdBitmaps();
#ifdef DEBUG_MENUCALC
printf("MenuBarCalcSize left=%d top=%d right=%d bottom=%d !\n",
lprect->left, lprect->top, lprect->right, lprect->bottom);
@@ -1245,29 +1257,21 @@
*/
BOOL CheckMenuItem(HMENU hMenu, WORD wItemID, WORD wFlags)
{
- WND *wndPtr;
- LPPOPUPMENU menu;
LPMENUITEM lpitem;
- int i;
#ifdef DEBUG_MENU
printf("CheckMenuItem (%04X, %04X, %04X) !\n", hMenu, wItemID, wFlags);
#endif
- menu = (LPPOPUPMENU) GlobalLock(hMenu);
- if (menu == NULL) return FALSE;
- lpitem = menu->firstItem;
- for (i = 0; i < menu->nItems; i++) {
- if (lpitem == NULL) break;
- if (i == wItemID) {
- if (wFlags && MF_CHECKED)
- lpitem->item_flags |= MF_CHECKED;
- else
- lpitem->item_flags &= ((WORD)-1 ^ MF_CHECKED);
- GlobalUnlock(hMenu);
- return(TRUE);
- }
- lpitem = (LPMENUITEM)lpitem->next;
+ lpitem = FindMenuItem(hMenu, wItemID, wFlags);
+ if (lpitem != NULL) {
+ if ((wFlags & MF_CHECKED) == MF_CHECKED)
+ lpitem->item_flags |= MF_CHECKED;
+ else
+ lpitem->item_flags &= ((WORD)-1 ^ MF_CHECKED);
+#ifdef DEBUG_MENU
+ printf("CheckMenuItem // Found !\n");
+#endif
+ return(TRUE);
}
- GlobalUnlock(hMenu);
return FALSE;
}
@@ -1277,30 +1281,113 @@
*/
BOOL EnableMenuItem(HMENU hMenu, WORD wItemID, WORD wFlags)
{
- WND *wndPtr;
- LPPOPUPMENU menu;
LPMENUITEM lpitem;
- int i;
#ifdef DEBUG_MENU
printf("EnableMenuItem (%04X, %04X, %04X) !\n", hMenu, wItemID, wFlags);
#endif
+ lpitem = FindMenuItem(hMenu, wItemID, wFlags);
+ if (lpitem != NULL) {
+ if (wFlags && MF_DISABLED)
+ lpitem->item_flags |= MF_DISABLED;
+ else
+ lpitem->item_flags &= ((WORD)-1 ^ MF_DISABLED);
+#ifdef DEBUG_MENU
+ printf("EnableMenuItem // Found !\n");
+#endif
+ return(TRUE);
+ }
+ return FALSE;
+}
+
+
+/**********************************************************************
+ * GetMenuString [USER.161]
+ */
+int GetMenuString(HMENU hMenu, WORD wItemID,
+ LPSTR str, short nMaxSiz, WORD wFlags)
+{
+ LPMENUITEM lpitem;
+ int maxsiz;
+#ifdef DEBUG_MENU
+ printf("GetMenuString(%04X, %04X, %08X, %d, %04X);\n",
+ hMenu, wItemID, str, nMaxSiz, wFlags);
+#endif
+ if (str == NULL) return FALSE;
+ lpitem = FindMenuItem(hMenu, wItemID, wFlags);
+ if (lpitem != NULL) {
+ if (lpitem->item_text != NULL) {
+ maxsiz = min(nMaxSiz - 1, strlen(lpitem->item_text));
+ strncpy(str, lpitem->item_text, maxsiz + 1);
+ }
+ else
+ maxsiz = 0;
+#ifdef DEBUG_MENU
+ printf("GetMenuString // Found !\n");
+#endif
+ return maxsiz;
+ }
+ return 0;
+}
+
+
+/**********************************************************************
+ * HiliteMenuItem [USER.162]
+ */
+BOOL HiliteMenuItem(HWND hWnd, HMENU hMenu, WORD wItemID, WORD wHilite)
+{
+ LPPOPUPMENU menu;
+ LPMENUITEM lpitem;
+ printf("HiliteMenuItem(%04X, %04X, %04X, %04X);\n",
+ hWnd, hMenu, wItemID, wHilite);
menu = (LPPOPUPMENU) GlobalLock(hMenu);
if (menu == NULL) return FALSE;
+ lpitem = FindMenuItem(hMenu, wItemID, wHilite);
+ if (lpitem == NULL) return FALSE;
+ return FALSE;
+}
+
+
+/**********************************************************************
+ * GetMenuItemCount [USER.263]
+ */
+WORD GetMenuItemCount(HMENU hMenu)
+{
+ LPPOPUPMENU menu;
+#ifdef DEBUG_MENU
+ printf("GetMenuItemCount(%04X);\n", hMenu);
+#endif
+ menu = (LPPOPUPMENU) GlobalLock(hMenu);
+ if (menu == NULL) return (WORD)-1;
+#ifdef DEBUG_MENU
+ printf("GetMenuItemCount(%04X) return %d \n", hMenu, menu->nItems);
+#endif
+ return menu->nItems;
+}
+
+
+/**********************************************************************
+ * GetMenuItemID [USER.264]
+ */
+WORD GetMenuItemID(HMENU hMenu, int nPos)
+{
+ WORD i;
+ LPPOPUPMENU menu;
+ LPMENUITEM lpitem;
+ printf("GetMenuItemID(%04X, %d);\n", hMenu, nPos);
+ menu = (LPPOPUPMENU) GlobalLock(hMenu);
+ if (menu == NULL) return -1;
lpitem = menu->firstItem;
for (i = 0; i < menu->nItems; i++) {
if (lpitem == NULL) break;
- if (i == wItemID) {
- if (wFlags && MF_DISABLED)
- lpitem->item_flags |= MF_DISABLED;
- else
- lpitem->item_flags &= ((WORD)-1 ^ MF_DISABLED);
- GlobalUnlock(hMenu);
- return(TRUE);
+ if (i == nPos) {
+#ifdef DEBUG_MENU
+ printf("GetMenuItemID // Found !\n");
+#endif
+ return lpitem->item_id;
}
lpitem = (LPMENUITEM)lpitem->next;
}
- GlobalUnlock(hMenu);
- return FALSE;
+ return -1;
}
@@ -1309,13 +1396,11 @@
*/
BOOL InsertMenu(HMENU hMenu, WORD nPos, WORD wFlags, WORD wItemID, LPSTR lpNewItem)
{
- WND *wndPtr;
LPPOPUPMENU menu;
HANDLE hNewItem;
LPMENUITEM lpitem, lpitem2;
- int i;
#ifdef DEBUG_MENU
- if (wFlags & MF_STRING)
+ if ((wFlags & (MF_BITMAP | MF_SEPARATOR | MF_MENUBREAK | MF_OWNERDRAW)) == 0)
printf("InsertMenu (%04X, %04X, %04X, '%s') !\n",
hMenu, wFlags, wItemID, lpNewItem);
else
@@ -1377,7 +1462,6 @@
*/
BOOL AppendMenu(HMENU hMenu, WORD wFlags, WORD wItemID, LPSTR lpNewItem)
{
- WND *wndPtr;
LPPOPUPMENU menu;
HANDLE hNewItem;
LPMENUITEM lpitem, lpitem2;
@@ -1445,7 +1529,6 @@
*/
BOOL RemoveMenu(HMENU hMenu, WORD nPos, WORD wFlags)
{
- WND *wndPtr;
LPPOPUPMENU menu;
LPMENUITEM lpitem;
int i;
@@ -1521,13 +1604,16 @@
*/
BOOL ModifyMenu(HMENU hMenu, WORD nPos, WORD wFlags, WORD wItemID, LPSTR lpNewItem)
{
- WND *wndPtr;
LPPOPUPMENU menu;
LPMENUITEM lpitem;
int i;
#ifdef DEBUG_MENU
- printf("ModifyMenu (%04X, %04X, %04X, %04X, %08X) !\n",
- hMenu, nPos, wFlags, wItemID, lpNewItem);
+ if ((wFlags & (MF_BITMAP | MF_SEPARATOR | MF_MENUBREAK | MF_OWNERDRAW)) == 0)
+ printf("ModifyMenu (%04X, %04X, %04X, %04X, '%s') !\n",
+ hMenu, nPos, wFlags, wItemID, lpNewItem);
+ else
+ printf("ModifyMenu (%04X, %04X, %04X, %04X, %08X) !\n",
+ hMenu, nPos, wFlags, wItemID, lpNewItem);
#endif
menu = (LPPOPUPMENU) GlobalLock(hMenu);
if (menu == NULL) return FALSE;
@@ -1593,6 +1679,9 @@
menu->Width = 100;
menu->Height = 0;
GlobalUnlock(hMenu);
+#ifdef DEBUG_MENU
+ printf("CreatePopupMenu // return %04X\n", hMenu);
+#endif
return hMenu;
}
@@ -1692,7 +1781,6 @@
BOOL MenuFocusLoop(HWND hWnd, LPPOPUPMENU lpmenu)
{
- WND *wndPtr;
MSG msg;
#ifdef DEBUG_MENU
printf("Enter in Menu Focus Loop !\n");
@@ -1808,8 +1896,7 @@
DWORD GetMenuCheckMarkDimensions()
{
BITMAP bm;
- if (hStdCheck == (HBITMAP)NULL)
- hStdCheck = LoadBitmap((HANDLE)NULL, (LPSTR)OBM_CHECK);
+ InitStdBitmaps();
GetObject(hStdCheck, sizeof(BITMAP), (LPSTR)&bm);
return MAKELONG(bm.bmWidth, bm.bmHeight);
}
@@ -1821,7 +1908,6 @@
BOOL SetMenuItemBitmaps(HMENU hMenu, WORD nPos, WORD wFlags,
HBITMAP hNewCheck, HBITMAP hNewUnCheck)
{
- WND *wndPtr;
LPPOPUPMENU menu;
LPMENUITEM lpitem;
int i;
@@ -1856,7 +1942,7 @@
HMENU hMenu;
LPPOPUPMENU menu;
#ifdef DEBUG_MENU
- printf("CreatePopupMenu !\n");
+ printf("CreateMenu !\n");
#endif
hMenu = GlobalAlloc(GMEM_MOVEABLE, sizeof(POPUPMENU));
menu = (LPPOPUPMENU) GlobalLock(hMenu);
@@ -1877,6 +1963,9 @@
menu->Width = 100;
menu->Height = 0;
GlobalUnlock(hMenu);
+#ifdef DEBUG_MENU
+ printf("CreateMenu // return %04X\n", hMenu);
+#endif
return hMenu;
}
@@ -1983,7 +2072,10 @@
*/
BOOL SetMenu(HWND hWnd, HMENU hMenu)
{
+ RECT rect;
LPPOPUPMENU lpmenu;
+ NCCALCSIZE_PARAMS *params;
+ HANDLE hparams;
WND * wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == NULL) {
printf("SetMenu(%04X, %04X) // Bad window handle !\n", hWnd, hMenu);
@@ -1992,7 +2084,22 @@
#ifdef DEBUG_MENU
printf("SetMenu(%04X, %04X);\n", hWnd, hMenu);
#endif
+ if (GetCapture() == hWnd) ReleaseCapture();
wndPtr->wIDmenu = hMenu;
+ if (hMenu == 0) {
+ printf("SetMenu(%04X, %04X) // Menu removed !\n", hWnd, hMenu);
+ hparams = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(NCCALCSIZE_PARAMS));
+ if (hparams) {
+ params = (NCCALCSIZE_PARAMS *) USER_HEAP_ADDR(hparams);
+ params->rgrc[0] = wndPtr->rectWindow;
+ params->lppos = NULL;
+ SendMessage(hWnd, WM_NCCALCSIZE, FALSE, (LONG)params);
+ wndPtr->rectClient = params->rgrc[0];
+ USER_HEAP_FREE(hparams);
+ }
+ SendMessage(hWnd, WM_NCPAINT, 0, 0L);
+ return TRUE;
+ }
lpmenu = (LPPOPUPMENU) GlobalLock(hMenu);
if (lpmenu == NULL) {
printf("SetMenu(%04X, %04X) // Bad menu handle !\n", hWnd, hMenu);
@@ -2000,7 +2107,6 @@
}
lpmenu->ownerWnd = hWnd;
ResetHiliteFlags(lpmenu);
- if (GetCapture() == hWnd) ReleaseCapture();
GlobalUnlock(hMenu);
return TRUE;
}
@@ -2093,6 +2199,18 @@
/**********************************************************************
+ * InitStdBitmaps (Internal)
+ */
+void InitStdBitmaps()
+{
+ if (hStdCheck == (HBITMAP)NULL)
+ hStdCheck = LoadBitmap((HANDLE)NULL, (LPSTR)OBM_CHECK);
+ if (hStdMnArrow == (HBITMAP)NULL)
+ hStdMnArrow = LoadBitmap((HANDLE)NULL, (LPSTR)OBM_MNARROW);
+}
+
+
+/**********************************************************************
* CopySysMenu (Internal)
*/
HMENU CopySysMenu()
diff --git a/if1632/Imakefile b/if1632/Imakefile
index d1ff205..601424d 100644
--- a/if1632/Imakefile
+++ b/if1632/Imakefile
@@ -16,6 +16,8 @@
dll_shell.o \
dll_sound.o \
dll_stress.o \
+ dll_system.o \
+ dll_toolhelp.o \
dll_unixlib.o \
dll_user.o \
dll_win87em.o \
@@ -39,6 +41,8 @@
MakeDllFromSpec(mmsystem,$(TOP)/$(MODULE))
MakeDllFromSpec(sound,$(TOP)/$(MODULE))
MakeDllFromSpec(stress,$(TOP)/$(MODULE))
+MakeDllFromSpec(system,$(TOP)/$(MODULE))
+MakeDllFromSpec(toolhelp,$(TOP)/$(MODULE))
MakeDllFromSpec(unixlib,$(TOP)/$(MODULE))
MakeDllFromSpec(user,$(TOP)/$(MODULE))
MakeDllFromSpec(win87em,$(TOP)/$(MODULE))
diff --git a/if1632/gdi.spec b/if1632/gdi.spec
index 10c2ba9..82247c5 100644
--- a/if1632/gdi.spec
+++ b/if1632/gdi.spec
@@ -85,7 +85,7 @@
68 pascal DeleteDC(word) DeleteDC(1)
69 pascal DeleteObject(word) DeleteObject(1)
70 pascal EnumFonts(word ptr ptr ptr) EnumFonts(1 2 3 4)
-#71 pascal EnumObjects
+71 pascal EnumObjects(word word ptr ptr) EnumObjects(1 2 3 4)
72 pascal EqualRgn(word word) EqualRgn(1 2)
73 pascal ExcludeVisRect(word s_word s_word s_word s_word)
ExcludeVisRect(1 2 3 4 5)
@@ -136,8 +136,8 @@
129 pascal SaveVisRgn(word) SaveVisRgn(1)
130 pascal RestoreVisRgn(word) RestoreVisRgn(1)
131 pascal InquireVisRgn(word) InquireVisRgn(1)
-#132 pascal SetEnvironment
-#133 pascal GetEnvironment
+132 pascal SetEnvironment(ptr ptr word) SetEnvironment(1 2 3)
+133 pascal GetEnvironment(ptr ptr word) GetEnvironment(1 2 3)
134 pascal GetRgnBox(word ptr) GetRgnBox(1 2)
#135 pascal ScanLr
#136 pascal RemoveFontResource
@@ -276,7 +276,7 @@
CreatePolyPolygonRgn(1 2 3 4)
#452 pascal GDISEEGDIDO
#460 pascal GDITASKTERMINATION
-#461 pascal SETOBJECTOWNER
+461 pascal SetObjectOwner(word) SetObjectOwner(1)
#462 pascal ISGDIOBJECT
#463 pascal MAKEOBJECTPRIVATE
#464 pascal FIXUPBOGUSPUBLISHERMETAFILE
diff --git a/if1632/mmsystem.spec b/if1632/mmsystem.spec
index b9d01e7..22bdf46 100644
--- a/if1632/mmsystem.spec
+++ b/if1632/mmsystem.spec
@@ -67,8 +67,33 @@
509 pascal WAVEINSTART(word) waveInStart(1)
510 pascal WAVEINSTOP(word) waveInStop(1)
511 pascal WAVEINRESET(word) waveInReset(1)
+512 pascal WAVEINGETPOSITION(word ptr word) waveInGetPosition(1 2 3)
513 pascal WAVEINGETID(word ptr) waveInGetID(1 2)
701 pascal MCISENDCOMMAND(word word long long) mciSendCommand(1 2 3 4)
702 pascal MCISENDSTRING(ptr ptr word word) mciSendString(1 2 3 4)
703 pascal MCIGETDEVICEID(ptr) mciSendCommand(1)
706 pascal MCIGETERRORSTRING(long ptr word) mciGetErrorString(1 2 3)
+#1100 pascal DRVOPEN
+#1101 pascal DRVCLOSE
+#1102 pascal DRVSENDMESSAGE
+#1103 pascal DRVGETMODULEHANDLE
+#1104 pascal DRVDEFDRIVERPROC
+#1210 pascal MMIOOPEN
+#1211 pascal MMIOCLOSE
+#1212 pascal MMIOREAD
+#1213 pascal MMIOWRITE
+#1214 pascal MMIOSEEK
+#1215 pascal MMIOGETINFO
+#1216 pascal MMIOSETINFO
+#1217 pascal MMIOSETBUFFER
+#1218 pascal MMIOFLUSH
+#1219 pascal MMIOADVANCE
+#1220 pascal MMIOSTRINGTOFOURCC
+#1221 pascal MMIOINSTALLIOPROC
+#1222 pascal MMIOSENDMESSAGE
+#1223 pascal MMIODESCEND
+#1224 pascal MMIOASCEND
+#1225 pascal MMIOCREATECHUNK
+#1226 pascal MMIORENAME
+
+
diff --git a/if1632/relay.c b/if1632/relay.c
index f5b08b0..ddbf8c9 100644
--- a/if1632/relay.c
+++ b/if1632/relay.c
@@ -24,8 +24,6 @@
#define DEBUG_RELAY /* */
-#define N_BUILTINS 11
-
struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] =
{
{ "KERNEL", KERNEL_table, 410, 1 },
@@ -39,7 +37,10 @@
{ "WINSOCK", WINSOCK_table, 155, 9 },
{ "STRESS", STRESS_table, 15, 10},
{ "MMSYSTEM",MMSYSTEM_table,1023,11},
+ { "SYSTEM", SYSTEM_table, 20 ,12},
+ { "TOOLHELP",TOOLHELP_table, 83, 13},
};
+/* don't forget to increase N_BUILTINS in dll.h if you add a dll */
unsigned short *Stack16Frame;
@@ -220,7 +221,7 @@
int i;
for (i = 0; i < N_BUILTINS; i++)
- if (strcmp(dll_builtin_table[i].dll_name, dll_name) == 0)
+ if (strcasecmp(dll_builtin_table[i].dll_name, dll_name) == 0)
return dll_builtin_table[i].dll_table;
return NULL;
diff --git a/if1632/user.spec b/if1632/user.spec
index 1bb9eed..2b4c0ee 100644
--- a/if1632/user.spec
+++ b/if1632/user.spec
@@ -163,8 +163,8 @@
158 pascal SetMenu(word word) SetMenu(1 2)
159 pascal GetSubMenu(word word) GetSubMenu(1 2)
160 pascal DrawMenuBar(word) DrawMenuBar(1)
-#161 GETMENUSTRING
-#162 HILITEMENUITEM
+161 pascal GetMenuString(word word ptr s_word word) GetMenuString(1 2 3 4 5)
+162 pascal HiliteMenuItem(word word word word) HiliteMenuItem(1 2 3 4)
163 pascal CreateCaret(word word word word) CreateCaret(1 2 3 4)
164 pascal DestroyCaret() DestroyCaret()
165 pascal SetCaretPos(word word) SetCaretPos(1 2)
@@ -272,8 +272,8 @@
#260 DEFERWINDOWPOS
#261 ENDDEFERWINDOWPOS
262 pascal GetWindow(word word) GetWindow(1 2)
-#263 GETMENUITEMCOUNT
-#264 GETMENUITEMID
+263 pascal GetMenuItemCount(word) GetMenuItemCount(1)
+264 pascal GetMenuItemID(word word) GetMenuItemID(1 2)
#265 SHOWOWNEDPOPUPS
266 pascal SetMessageQueue(word) SetMessageQueue(1)
267 pascal ShowScrollBar(word word word) ShowScrollBar(1 2 3)
diff --git a/include/dlls.h b/include/dlls.h
index 9c59b48..574db1e 100644
--- a/include/dlls.h
+++ b/include/dlls.h
@@ -65,5 +65,9 @@
extern struct dll_table_entry_s KEYBOARD_table[];
extern struct dll_table_entry_s WINSOCK_table[];
extern struct dll_table_entry_s STRESS_table[];
+extern struct dll_table_entry_s SYSTEM_table[];
+extern struct dll_table_entry_s TOOLHELP_table[];
+
+#define N_BUILTINS 13
#endif /* DLLS_H */
diff --git a/include/gdi.h b/include/gdi.h
index 27b4d3d..1920d07 100644
--- a/include/gdi.h
+++ b/include/gdi.h
@@ -301,8 +301,6 @@
extern GDIOBJHDR * GDI_GetObjPtr( HANDLE, WORD );
extern Display * XT_display; /* Will be removed */
-extern Screen * XT_screen; /* Will be removed */
-
extern Display * display;
extern Screen * screen;
extern Window rootWindow;
diff --git a/include/windows.h b/include/windows.h
index 0b27568..96a29fe 100644
--- a/include/windows.h
+++ b/include/windows.h
@@ -2975,7 +2975,7 @@
Fe(int,Escape,HDC,a,int,b,int,c,LPSTR,d,LPSTR,e)
Fe(int,ExcludeClipRect,HDC,a,short,b,short,c,short,d,short,e)
Fe(int,ExcludeVisRect,HDC,a,short,b,short,c,short,d,short,e)
-Fe(int,GetMenuString,HMENU,a,WORD,b,LPSTR,c,int,d,WORD,e)
+Fe(int,GetMenuString,HMENU,a,WORD,b,LPSTR,c,short,d,WORD,e)
Fe(int,GetProfileString,LPSTR,a,LPSTR,b,LPSTR,c,LPSTR,d,int,e)
Fe(int,IntersectClipRect,HDC,a,short,b,short,c,short,d,short,e)
Fe(int,IntersectVisRect,HDC,a,short,b,short,c,short,d,short,e)
diff --git a/loader/library.c b/loader/library.c
index 6cfbe08..c53f003 100644
--- a/loader/library.c
+++ b/loader/library.c
@@ -35,9 +35,9 @@
static LPMODULEENTRY lpModList = NULL;
extern struct w_files * wine_files;
-#define N_BUILTINS 11
-extern struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS];
+extern struct dll_name_table_entry_s dll_builtin_table[];
+#define IS_BUILTIN_DLL(handle) ((handle >> 16) == 0xff)
/**********************************************************************
* GetModuleHandle [KERNEL.47]
@@ -50,7 +50,7 @@
printf("GetModuleHandle // searching in loaded modules\n");
while (w) {
/* printf("GetModuleHandle // '%s' \n", w->name); */
- if (strcmp(w->name, lpModuleName) == 0) {
+ if (strcasecmp(w->name, lpModuleName) == 0) {
printf("GetModuleHandle('%s') return %04X \n",
lpModuleName, w->hinstance);
return w->hinstance;
@@ -60,7 +60,7 @@
printf("GetModuleHandle // searching in builtin libraries\n");
for (i = 0; i < N_BUILTINS; i++) {
if (dll_builtin_table[i].dll_name == NULL) break;
- if (strcmp(dll_builtin_table[i].dll_name, lpModuleName) == 0) {
+ if (strcasecmp(dll_builtin_table[i].dll_name, lpModuleName) == 0) {
printf("GetModuleHandle('%s') return %04X \n",
lpModuleName, 0xFF00 + i);
return (0xFF00 + i);
@@ -90,17 +90,30 @@
int GetModuleFileName(HANDLE hModule, LPSTR lpFileName, short nSize)
{
struct w_files *w;
- LPSTR str;
+ LPSTR str;
+ char windir[256], temp[256];
+
printf("GetModuleFileName(%04X, %08X, %d);\n", hModule, lpFileName, nSize);
+
if (lpFileName == NULL) return 0;
- if (nSize < 1) return 0;
- w = GetFileInfo(hModule);
- if (w == NULL) return 0;
- str = w->filename;
- if (str[0] == '/') str++;
+ if (nSize < 1) return 0;
+
+ /* built-in dll ? */
+ if (IS_BUILTIN_DLL(hModule)) {
+ GetWindowsDirectory(windir, sizeof(windir));
+ sprintf(temp, "%s\\%s.DLL", windir, dll_builtin_table[hModule & 0x00ff].dll_name);
+ ToDos(temp);
+ strncpy(lpFileName, temp, nSize);
+ printf("GetModuleFileName copied '%s' (internal dll) return %d \n", lpFileName, nSize);
+ return strlen(lpFileName);
+ }
+
+ /* check loaded dlls */
+ if ((w = GetFileInfo(hModule)) == NULL)
+ return 0;
+ str = GetDosFileName(w->filename);
if (nSize > strlen(str)) nSize = strlen(str) + 1;
strncpy(lpFileName, str, nSize);
- ToDos(lpFileName);
printf("GetModuleFileName copied '%s' return %d \n", lpFileName, nSize);
return nSize - 1;
}
@@ -114,14 +127,31 @@
HANDLE hModule;
LPMODULEENTRY lpMod = lpModList;
LPMODULEENTRY lpNewMod;
-
- if (FindDLLTable(libname))
- {
- printf("Library was a builtin - returning 0x23\n");
- return WINE_CODE_SELECTOR;
- }
+ int i;
+ char temp[64];
printf("LoadLibrary '%s'\n", libname);
+
+ /* extract dllname */
+ strcpy(temp, libname);
+ if (strchr(temp, '\\') || strchr(temp, '/'))
+ for (i = strlen(temp) - 1; i ; i--)
+ if (temp[i] == '\\' || temp[i] == '/') {
+ strcpy(temp, temp + i + 1);
+ break;
+ }
+ for (i = strlen(temp) - 1; i ; i--)
+ if (temp[i] == '.') {
+ temp[i] = 0;
+ break;
+ }
+
+ if (FindDLLTable(temp))
+ {
+ printf("Library was a builtin - \n");
+ return GetModuleHandle(temp);
+ }
+
if (lpMod != NULL)
{
while (TRUE)
@@ -176,7 +206,13 @@
void FreeLibrary(HANDLE hLib)
{
LPMODULEENTRY lpMod = lpModList;
+
printf("FreeLibrary(%04X);\n", hLib);
+
+ /* built-in dll ? */
+ if (IS_BUILTIN_DLL(hLib))
+ return;
+
while (lpMod != NULL) {
if (lpMod->hInst == hLib) {
if (lpMod->Count == 1) {
@@ -201,80 +237,106 @@
*/
FARPROC GetProcAddress(HANDLE hModule, char *proc_name)
{
- WORD wOrdin;
- int sel, addr, ret;
+ int i, sel, addr, ret;
register struct w_files *w = wine_files;
- int ordinal, len;
- char * cpnt;
- char C[128];
- HTASK hTask;
- LPTASKENTRY lpTask;
- if (hModule >= 0xF000) {
- if ((int) proc_name & 0xffff0000) {
- printf("GetProcAddress: builtin %#04X, '%s'\n",
- hModule, proc_name);
-/* wOrdin = FindOrdinalFromName(struct dll_table_entry_s *dll_table, proc_name); */
- }
- else {
- printf("GetProcAddress: builtin %#04X, %d\n",
- hModule, (int)proc_name);
- }
- return NULL;
- }
- if (hModule == 0) {
- hTask = GetCurrentTask();
- printf("GetProcAddress // GetCurrentTask()=%04X\n", hTask);
- lpTask = (LPTASKENTRY) GlobalLock(hTask);
- if (lpTask == NULL) {
- printf("GetProcAddress: can't find current module handle !\n");
- return NULL;
- }
- hModule = lpTask->hInst;
- printf("GetProcAddress: current module=%04X instance=%04X!\n",
- lpTask->hModule, lpTask->hInst);
- GlobalUnlock(hTask);
- }
- while (w && w->hinstance != hModule) w = w->next;
- if (w == NULL) return NULL;
- printf("GetProcAddress // Module Found ! w->filename='%s'\n", w->filename);
- if ((int)proc_name & 0xFFFF0000) {
- AnsiUpper(proc_name);
- printf("GetProcAddress: %04X, '%s'\n", hModule, proc_name);
- cpnt = w->nrname_table;
- while(TRUE) {
- if (((int) cpnt) - ((int)w->nrname_table) >
- w->ne_header->nrname_tab_length) return NULL;
- len = *cpnt++;
- strncpy(C, cpnt, len);
- C[len] = '\0';
+ int ordinal, len;
+ char * cpnt;
+ char C[128];
+ HTASK hTask;
+ LPTASKENTRY lpTask;
+
+ /* built-in dll ? */
+ if (IS_BUILTIN_DLL(hModule))
+ {
+ if ((int) proc_name & 0xffff0000)
+ {
+ printf("GetProcAddress: builtin %#04X, '%s'\n",
+ hModule, proc_name);
+ if (GetEntryDLLName(dll_builtin_table[hModule - 0xFF00].dll_name,
+ proc_name, &sel, &addr))
+ {
+ printf("Address not found !\n");
+ }
+ }
+ else
+ {
+ printf("GetProcAddress: builtin %#04X, %d\n",
+ hModule, (int)proc_name);
+ if (GetEntryDLLOrdinal(dll_builtin_table[hModule-0xFF00].dll_name,
+ (int)proc_name & 0x0000FFFF, &sel, &addr))
+ {
+ printf("Address not found !\n");
+ }
+ }
+ ret = MAKELONG(addr, sel);
+ printf("GetProcAddress // ret=%08X sel=%04X addr=%04X\n",
+ ret, sel, addr);
+ return (FARPROC)ret;
+ }
+ if (hModule == 0)
+ {
+ hTask = GetCurrentTask();
+ printf("GetProcAddress // GetCurrentTask()=%04X\n", hTask);
+ lpTask = (LPTASKENTRY) GlobalLock(hTask);
+ if (lpTask == NULL)
+ {
+ printf("GetProcAddress: can't find current module handle !\n");
+ return NULL;
+ }
+ hModule = lpTask->hInst;
+ printf("GetProcAddress: current module=%04X instance=%04X!\n",
+ lpTask->hModule, lpTask->hInst);
+ GlobalUnlock(hTask);
+ }
+ while (w && w->hinstance != hModule)
+ w = w->next;
+ if (w == NULL)
+ return NULL;
+ printf("GetProcAddress // Module Found ! w->filename='%s'\n", w->filename);
+ if ((int)proc_name & 0xFFFF0000)
+ {
+ AnsiUpper(proc_name);
+ printf("GetProcAddress: %04X, '%s'\n", hModule, proc_name);
+ cpnt = w->nrname_table;
+ while(TRUE)
+ {
+ if (((int) cpnt) - ((int)w->nrname_table) >
+ w->ne_header->nrname_tab_length) return NULL;
+ len = *cpnt++;
+ strncpy(C, cpnt, len);
+ C[len] = '\0';
#ifdef DEBUG_MODULE
- printf("pointing Function '%s' ordinal=%d !\n",
- C, *((unsigned short *)(cpnt + len)));
+ printf("pointing Function '%s' ordinal=%d !\n",
+ C, *((unsigned short *)(cpnt + len)));
#endif
- if (strncmp(cpnt, proc_name, len) == 0) {
- ordinal = *((unsigned short *)(cpnt + len));
- break;
- }
- cpnt += len + 2;
- };
- if (ordinal == 0) {
- printf("GetProcAddress // function '%s' not found !\n", proc_name);
- return NULL;
- }
- }
- else {
- printf("GetProcAddress: %#04x, %d\n", hModule, (int) proc_name);
- ordinal = (int)proc_name;
- }
- ret = GetEntryPointFromOrdinal(w, ordinal);
- if (ret == -1) {
- printf("GetProcAddress // Function #%d not found !\n", ordinal);
- return NULL;
- }
- addr = ret & 0xffff;
- sel = (ret >> 16);
- printf("GetProcAddress // ret=%08X sel=%04X addr=%04X\n", ret, sel, addr);
- return (FARPROC) ret;
+ if (strncmp(cpnt, proc_name, len) == 0)
+ {
+ ordinal = *((unsigned short *)(cpnt + len));
+ break;
+ }
+ cpnt += len + 2;
+ };
+ if (ordinal == 0)
+ {
+ printf("GetProcAddress // function '%s' not found !\n", proc_name);
+ return NULL;
+ }
+ }
+ else
+ {
+ printf("GetProcAddress: %#04x, %d\n", hModule, (int) proc_name);
+ ordinal = (int)proc_name;
+ }
+ ret = GetEntryPointFromOrdinal(w, ordinal);
+ if (ret == -1)
+ {
+ printf("GetProcAddress // Function #%d not found !\n", ordinal);
+ return NULL;
+ }
+ addr = ret & 0xffff;
+ sel = (ret >> 16);
+ printf("GetProcAddress // ret=%08X sel=%04X addr=%04X\n", ret, sel, addr);
+ return (FARPROC) ret;
}
#endif /* ifndef WINELIB */
diff --git a/loader/resource.c b/loader/resource.c
index a5fb3c8..a4f9c1f 100644
--- a/loader/resource.c
+++ b/loader/resource.c
@@ -248,6 +248,43 @@
return read (fd, typeinfo, sizeof (*typeinfo)) == sizeof (*typeinfo);
}
#endif
+
+int
+type_match(int type_id1, int type_id2, int fd, off_t off)
+{
+ off_t old_pos;
+ unsigned char c;
+ size_t nbytes;
+ char name[256];
+
+ if (type_id1 == -1)
+ return 1;
+ if ((type_id1 & 0xffff0000) == 0) {
+ if ((type_id2 & 0x8000) == 0)
+ return 0;
+ return (type_id1 & 0x000f) == (type_id2 & 0x000f);
+ }
+ if ((type_id2 & 0x8000) != 0)
+ return 0;
+#ifdef DEBUG_RESOURCE
+ printf("type_compare: type_id2=%04X !\n", type_id2);
+#endif
+ old_pos = lseek(fd, 0, SEEK_CUR);
+ lseek(fd, off + type_id2, SEEK_SET);
+ read(fd, &c, 1);
+ nbytes = CONV_CHAR_TO_LONG (c);
+#ifdef DEBUG_RESOURCE
+ printf("type_compare: namesize=%d\n", nbytes);
+#endif
+ read(fd, name, nbytes);
+ lseek(fd, old_pos, SEEK_SET);
+ name[nbytes] = '\0';
+#ifdef DEBUG_RESOURCE
+ printf("type_compare: name=`%s'\n", name);
+#endif
+ return strcasecmp((char *) type_id1, name) == 0;
+}
+
/**********************************************************************
* FindResourceByNumber
*/
@@ -281,8 +318,7 @@
/*
* Find resource.
*/
- typeinfo.type_id = 0xffff;
- while (typeinfo.type_id != 0) {
+ for (;;) {
if (!load_typeinfo (ResourceFd, &typeinfo)){
printf("FindResourceByNumber (%X) bad typeinfo size !\n", resource_id);
return -1;
@@ -292,7 +328,8 @@
typeinfo.type_id, typeinfo.count, type_id);
#endif
if (typeinfo.type_id == 0) break;
- if (typeinfo.type_id == type_id || type_id == -1) {
+ if (type_match(type_id, typeinfo.type_id, ResourceFd, rtoff)) {
+
for (i = 0; i < typeinfo.count; i++) {
#ifndef WINELIB
if (read(ResourceFd, &nameinfo, sizeof(nameinfo)) !=
@@ -306,7 +343,7 @@
}
#ifdef DEBUG_RESOURCE
printf("FindResource: search type=%X id=%X // type=%X id=%X\n",
- type_id, resource_id, typeinfo.type_id, nameinfo.id);
+ type_id, resource_id, typeinfo.type_id, type_id2);
#endif
if (nameinfo.id == resource_id) {
memcpy(result_p, &nameinfo, sizeof(nameinfo));
@@ -377,8 +414,7 @@
/*
* Find resource.
*/
- typeinfo.type_id = 0xffff;
- while (typeinfo.type_id != 0)
+ for (;;)
{
if (!load_typeinfo (ResourceFd, &typeinfo))
{
@@ -390,7 +426,7 @@
typeinfo.type_id, typeinfo.count, type_id);
#endif
if (typeinfo.type_id == 0) break;
- if (typeinfo.type_id == type_id || type_id == -1)
+ if (type_match(type_id, typeinfo.type_id, ResourceFd, rtoff))
{
for (i = 0; i < typeinfo.count; i++)
{
@@ -529,6 +565,16 @@
rgbq[1].rgbGreen = 0x00;
rgbq[1].rgbRed = 0x00;
rgbq[1].rgbReserved = 0x00;
+ if (bih->biSizeImage == 0) {
+ if (bih->biCompression != BI_RGB) {
+ printf("Unknown size for compressed Icon bitmap.\n");
+ GlobalFree(rsc_mem);
+ ReleaseDC(GetDesktopWindow(), hdc);
+ return 0;
+ }
+ bih->biSizeImage = (bih->biWidth * bih->biHeight * bih->biBitCount
+ + 7) / 8;
+ }
lpico->hBitMask = CreateDIBitmap(hdc, bih, CBM_INIT,
(LPSTR)lp + bih->biSizeImage - sizeof(BITMAPINFOHEADER) / 2 - 4,
(BITMAPINFO *)bih, DIB_RGB_COLORS );
@@ -667,6 +713,7 @@
{
RESOURCE *r;
HANDLE rh;
+ int type;
if (instance == 0)
return 0;
@@ -688,15 +735,39 @@
r->info_mem = rh;
r->rsc_mem = 0;
- if (((int) resource_name & 0xffff0000) == 0)
+ if (((int) type_name & 0xffff0000) == 0)
{
- r->size_shift = FindResourceByNumber(&r->nameinfo, (int)type_name,
- (int) resource_name | 0x8000);
+ type = (int) type_name;
+ }
+ else if (type_name[0] == '\0')
+ {
+ type = -1;
+ }
+ else if (type_name[0] == '#')
+ {
+ type = atoi(type_name + 1);
}
else
{
- r->size_shift = FindResourceByName(&r->nameinfo, (int)type_name,
- resource_name);
+ type = (int) type_name;
+ }
+ if (((int) resource_name & 0xffff0000) == 0)
+ {
+ r->size_shift = FindResourceByNumber(&r->nameinfo, type,
+ (int) resource_name | 0x8000);
+ }
+ else if (resource_name[0] == '\0')
+ {
+ r->size_shift = FindResourceByNumber(&r->nameinfo, type, -1);
+ }
+ else if (resource_name[0] == '#')
+ {
+ r->size_shift = FindResourceByNumber(&r->nameinfo, type,
+ atoi(resource_name + 1));
+ }
+ else
+ {
+ r->size_shift = FindResourceByName(&r->nameinfo, type, resource_name);
}
if (r->size_shift == -1)
@@ -906,7 +977,7 @@
GlobalFree(hmem);
#ifdef DEBUG_RESOURCE
- printf(" '%s'\n", buffer);
+ printf("LoadString // '%s' copied !\n", buffer);
#endif
return i;
}
diff --git a/loader/selector.c b/loader/selector.c
index 834e252..fea7a6f 100644
--- a/loader/selector.c
+++ b/loader/selector.c
@@ -417,7 +417,7 @@
if (s->shm_key == 0)
{
munmap(s->base_addr, ((s->length + PAGE_SIZE) & ~(PAGE_SIZE - 1)));
- memcpy(s, 0, sizeof(*s));
+ memset(s, 0, sizeof(*s));
SelectorMap[sel_idx] = 0;
}
else
@@ -432,7 +432,7 @@
if (alias_count == 1)
shmctl(s->shm_key, IPC_RMID, NULL);
- memcpy(s, 0, sizeof(*s));
+ memset(s, 0, sizeof(*s));
SelectorMap[sel_idx] = 0;
}
@@ -457,7 +457,7 @@
{
s = &Segments[sel_idx];
munmap(s->base_addr, ((s->length + PAGE_SIZE) & ~(PAGE_SIZE - 1)));
- memcpy(s, 0, sizeof(*s));
+ memset(s, 0, sizeof(*s));
SelectorMap[sel >> 3] = 0;
}
#endif /* HAVE_IPC */
@@ -847,15 +847,10 @@
* First we need to check for local heap. Second we nee to see if
* this is also the stack segment.
*/
- if (i + 1 == ne_header->auto_data_seg)
+ if (i + 1 == ne_header->auto_data_seg || i + 1 == ne_header->ss)
{
- s->length += ne_header->local_heap_length;
-
- if (i + 1 == ne_header->ss)
- {
- s->length += ne_header->stack_length;
- ne_header->sp = s->length;
- }
+ s->length = 0x10000;
+ ne_header->sp = s->length - 2;
}
/*
diff --git a/loader/signal.c b/loader/signal.c
index 92aecd5..7de7064 100644
--- a/loader/signal.c
+++ b/loader/signal.c
@@ -131,6 +131,11 @@
if (!do_int26(scp))
goto oops;
break;
+
+ case 0x2f:
+ if (!do_int2f(scp))
+ goto oops;
+ break;
default:
fprintf(stderr,"Unexpected Windows interrupt %x\n", *instr);
diff --git a/memory/global.c b/memory/global.c
index c257027..0a21566 100644
--- a/memory/global.c
+++ b/memory/global.c
@@ -790,5 +790,6 @@
if (free_map[i] == 1)
total_free++;
+ printf("GetFreeSpace // return %ld !\n", total_free << 16);
return total_free << 16;
}
diff --git a/misc/cursor.c b/misc/cursor.c
index 49ce26c..15bc145 100644
--- a/misc/cursor.c
+++ b/misc/cursor.c
@@ -171,7 +171,7 @@
ReleaseDC(GetDesktopWindow(), hdc);
return 0;
}
- (char *)lp += 2;
+ lp++;
for (j = 0; j < 16; j++)
printf("%04X ", *(lp + j));
/*
diff --git a/misc/dos_fs.c b/misc/dos_fs.c
index 6d34222..77b2429 100644
--- a/misc/dos_fs.c
+++ b/misc/dos_fs.c
@@ -273,7 +273,7 @@
*s++ = toupper(*p);
else {
*s++ = '\\';
- if (*s == '/' || *s == '\\')
+ if (*(p+1) == '/' || *(p+1) == '\\')
p++;
}
}
@@ -390,6 +390,26 @@
return(temp);
}
+char *GetDosFileName(char *unixfilename)
+{
+ int i;
+ char temp[256];
+ /* /dos/windows/system.ini => c:\windows\system.ini */
+
+ for (i = 0 ; i != MAX_DOS_DRIVES; i++) {
+ if (DosDrives[i].rootdir != NULL) {
+ if (strncmp(DosDrives[i].rootdir, unixfilename, strlen(DosDrives[i].rootdir)) == 0) {
+ sprintf(temp, "%c:\\%s", 'A' + i, unixfilename + strlen(DosDrives[i].rootdir) + 1);
+ ToDos(temp);
+ return temp;
+ }
+ }
+ }
+ strcpy(temp, unixfilename);
+ ToDos(temp);
+ return(temp);
+}
+
char *DOS_GetCurrentDir(int drive)
{
/* should return 'WINDOWS\SYSTEM' */
@@ -734,11 +754,7 @@
do {
if ((d = readdir(de->ds)) == NULL)
- {
- closedir(de->ds);
- de->inuse = 0;
- return de;
- }
+ return NULL;
strcpy(de->filename, d->d_name);
if (d->d_reclen > 12)
@@ -765,7 +781,7 @@
void DOS_closedir(struct dosdirent *de)
{
- if (de->inuse)
+ if (de && de->inuse)
{
closedir(de->ds);
de->inuse = 0;
diff --git a/misc/lstr.c b/misc/lstr.c
index eeaf7c2..361ea10 100644
--- a/misc/lstr.c
+++ b/misc/lstr.c
@@ -58,19 +58,25 @@
return strlen(str);
}
+
/* AnsiUpper USER.431 */
char FAR* AnsiUpper(char FAR* strOrChar)
{
/* I am not sure if the locale stuff works with toupper, but then again
I am not sure if the Linux libc locale stuffs works at all */
- if((int)strOrChar<256)
+/* if((int)strOrChar<256)
return (char FAR*) toupper((int)strOrChar);
- else {
+ else {
int i;
- for(i=0;(i<65536)&&strOrChar[i];i++)
- strOrChar[i]=toupper(strOrChar[i]);
+ for(i=0;(i<65536) && strOrChar[i];i++)
+ strOrChar[i]=toupper(strOrChar[i]);
return strOrChar;
- }
+ } */
+ int i;
+ for (i = 0; (i < 65536 && strOrChar[i]);i++)
+ strOrChar[i] = (strOrChar[i] >= 'a' && strOrChar[i] <= 'z') ?
+ strOrChar[i] - ('a' - 'A') : strOrChar[i];
+ return strOrChar;
}
/* AnsiLower USER.432 */
@@ -78,14 +84,18 @@
{
/* I am not sure if the locale stuff works with tolower, but then again
I am not sure if the Linux libc locale stuffs works at all */
- if((int)strOrChar<256)
+/* if((int)strOrChar<256)
return (char FAR*)tolower((int)strOrChar);
else {
int i;
for(i=0;(i<65536)&&strOrChar[i];i++)
strOrChar[i]=tolower(strOrChar[i]);
return strOrChar;
- }
+ }*/
+ int i;
+ for (i = 0; (i < 65536 && strOrChar[i]);i++)
+ strOrChar[i] = (strOrChar[i] >= 'A' && strOrChar[i] <= 'Z') ?
+ strOrChar[i] + ('a' - 'A') : strOrChar[i];
}
/* AnsiUpperBuff USER.437 */
diff --git a/misc/main.c b/misc/main.c
index d5784f3..245b5c9 100644
--- a/misc/main.c
+++ b/misc/main.c
@@ -20,8 +20,9 @@
#define WINE_CLASS "Wine" /* Class name for resources */
+LPSTR lpEnvList;
+
Display * XT_display; /* To be removed */
-Screen * XT_screen; /* To be removed */
Display *display;
Screen *screen;
@@ -298,7 +299,6 @@
screenWidth = WidthOfScreen( screen );
screenHeight = HeightOfScreen( screen );
XT_display = display;
- XT_screen = screen;
if (screenDepth) /* -depth option specified */
{
depth_list = XListDepths(display,DefaultScreen(display),&depth_count);
@@ -360,6 +360,26 @@
}
/***********************************************************************
+ * SetEnvironment (GDI.132)
+ */
+int SetEnvironment(LPSTR lpPortName, LPSTR lpEnviron, WORD nCount)
+{
+ printf("EMPTY STUB ! // SetEnvironnement('%s', '%s', %d) !\n",
+ lpPortName, lpEnviron, nCount);
+ return 0;
+}
+
+/***********************************************************************
+ * GetEnvironment (GDI.134)
+ */
+int GetEnvironment(LPSTR lpPortName, LPSTR lpEnviron, WORD nMaxSiz)
+{
+ printf("EMPTY STUB ! // GetEnvironnement('%s', '%s', %d) !\n",
+ lpPortName, lpEnviron, nMaxSiz);
+ return 0;
+}
+
+/***********************************************************************
* GetTimerResolution (USER.14)
*/
LONG GetTimerResolution(void)
diff --git a/misc/message.c b/misc/message.c
index 23e1be6..0a8da32 100644
--- a/misc/message.c
+++ b/misc/message.c
@@ -58,13 +58,15 @@
if (wndPtr == NULL) {
hInst = hSysRes;
#ifdef DEBUG_MSGBOX
- printf("MessageBox(NULL, '%s', '%s', %04X)\n", str, title, type);
+ printf("MessageBox(NULL, %08X='%s', %08X='%s', %04X)\n",
+ str, str, title, title, type);
#endif
}
else {
hInst = wndPtr->hInstance;
#ifdef DEBUG_MSGBOX
- printf("MessageBox(%04X, '%s', '%s', %04X)\n", hWnd, str, title, type);
+ printf("MessageBox(%04X, %08X='%s', %08X='%s', %04X)\n",
+ hWnd, str, str, title, title, type);
#endif
}
lpmb = (LPMSGBOX) malloc(sizeof(MSGBOX));
@@ -379,7 +381,7 @@
strcpy(str, "WINELOGO");
hBitMap = LoadBitmap((HINSTANCE)NULL, (LPSTR)str);
- strcpy(str, "PROPOSED_LICENSE");
+ strcpy(str, "LICENSE");
printf("str = '%s'\n", str);
hFile = OpenFile((LPSTR)str, &ofstruct, OF_READ);
ptr = (LPSTR)malloc(2048);
diff --git a/misc/mmsystem.c b/misc/mmsystem.c
index 9332079..e4c6a2e 100644
--- a/misc/mmsystem.c
+++ b/misc/mmsystem.c
@@ -13,6 +13,10 @@
static WORD mciActiveDev = 0;
+UINT WINAPI midiGetErrorText(UINT uError, LPSTR lpText, UINT uSize);
+UINT WINAPI waveGetErrorText(UINT uError, LPSTR lpText, UINT uSize);
+
+
int MCI_LibMain(HANDLE hInstance, WORD wDataSeg,
WORD cbHeapSize, LPSTR lpCmdLine)
{
@@ -87,6 +91,7 @@
{
LPSTR msgptr;
int maxbuf;
+ printf("mciGetErrorString(%04X, %08X, %d);\n", wError, lpstrBuffer, uLength);
if ((lpstrBuffer == NULL) || (uLength < 1)) return(FALSE);
lpstrBuffer[0] = '\0';
switch(wError) {
@@ -358,6 +363,7 @@
*/
DWORD mciOpen(UINT wDevID, DWORD dwParam, LPMCI_OPEN_PARMS lpParms)
{
+ char str[128];
DWORD dwDevTyp = 0;
if (lpParms == NULL) return MCIERR_INTERNAL;
printf("mciOpen(%04X, %08X, %08X)\n", wDevID, dwParam, lpParms);
@@ -368,19 +374,22 @@
dwDevTyp = (DWORD)lpParms->lpstrDeviceType;
}
else {
- if (strcmp(lpParms->lpstrDeviceType, "cdaudio") == 0) {
+ printf("MCI_OPEN // Dev='%s' !\n", lpParms->lpstrDeviceType);
+ strcpy(str, lpParms->lpstrDeviceType);
+ AnsiUpper(str);
+ if (strcmp(str, "CDAUDIO") == 0) {
dwDevTyp = MCI_DEVTYPE_CD_AUDIO;
}
else
- if (strcmp(lpParms->lpstrDeviceType, "waveaudio") == 0) {
+ if (strcmp(str, "WAVEAUDIO") == 0) {
dwDevTyp = MCI_DEVTYPE_WAVEFORM_AUDIO;
}
else
- if (strcmp(lpParms->lpstrDeviceType, "Sequencer") == 0) {
+ if (strcmp(str, "SEQUENCER") == 0) {
dwDevTyp = MCI_DEVTYPE_SEQUENCER;
}
else
- if (strcmp(lpParms->lpstrDeviceType, "Animation1") == 0) {
+ if (strcmp(str, "ANIMATION1") == 0) {
dwDevTyp = MCI_DEVTYPE_ANIMATION;
}
}
@@ -393,7 +402,8 @@
return MCIERR_DEVICE_NOT_INSTALLED;
case MCI_DEVTYPE_SEQUENCER:
printf("MCI_OPEN // No SEQUENCER yet !\n");
- return MCIERR_DEVICE_NOT_INSTALLED;
+ break;
+/* return MCIERR_DEVICE_NOT_INSTALLED; */
case MCI_DEVTYPE_ANIMATION:
printf("MCI_OPEN // No ANIMATION yet !\n");
return MCIERR_DEVICE_NOT_INSTALLED;
@@ -556,45 +566,6 @@
-HMMIO WINAPI mmioOpen(LPSTR szFileName, MMIOINFO FAR* lpmmioinfo, DWORD dwOpenFlags)
-{
- printf("mmioOpen('%s', %08X, %08X);\n", szFileName, lpmmioinfo, dwOpenFlags);
- return 0;
-}
-
-
-
-UINT WINAPI mmioClose(HMMIO hmmio, UINT uFlags)
-{
- printf("mmioClose(%04X, %04X);\n", hmmio, uFlags);
- return 0;
-}
-
-
-
-LONG WINAPI mmioRead(HMMIO hmmio, HPSTR pch, LONG cch)
-{
- printf("mmioRead\n");
- return 0;
-}
-
-
-
-LONG WINAPI mmioWrite(HMMIO hmmio, HPCSTR pch, LONG cch)
-{
- printf("mmioWrite\n");
- return 0;
-}
-
-
-LONG WINAPI mmioSeek(HMMIO hmmio, LONG lOffset, int iOrigin)
-{
- printf("mmioSeek\n");
- return 0;
-}
-
-
-
UINT WINAPI midiOutGetNumDevs(void)
{
printf("midiOutGetNumDevs\n");
@@ -625,6 +596,9 @@
}
+/**************************************************************************
+* midiOutGetErrorText [MMSYSTEM.203]
+*/
UINT WINAPI midiOutGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
{
printf("midiOutGetErrorText\n");
@@ -632,6 +606,9 @@
}
+/**************************************************************************
+* midiGetErrorText [internal]
+*/
UINT WINAPI midiGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
{
LPSTR msgptr;
@@ -781,6 +758,9 @@
+/**************************************************************************
+* midiInGetErrorText [MMSYSTEM.303]
+*/
UINT WINAPI midiInGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
{
printf("midiInGetErrorText\n");
@@ -851,35 +831,38 @@
UINT WINAPI midiInStop(HMIDIIN hMidiIn)
{
-printf("midiInStop\n");
-return 0;
+ printf("midiInStop\n");
+ return 0;
}
UINT WINAPI midiInReset(HMIDIIN hMidiIn)
{
-printf("midiInReset\n");
-return 0;
+ printf("midiInReset\n");
+ return 0;
}
UINT WINAPI waveOutGetNumDevs()
{
-printf("waveOutGetNumDevs\n");
-return 0;
+ printf("waveOutGetNumDevs\n");
+ return 0;
}
UINT WINAPI waveOutGetDevCaps(UINT uDeviceID, WAVEOUTCAPS FAR* lpCaps, UINT uSize)
{
-printf("waveOutGetDevCaps\n");
-return 0;
+ printf("waveOutGetDevCaps\n");
+ return MMSYSERR_INVALHANDLE;
}
+/**************************************************************************
+* waveOutGetErrorText [MMSYSTEM.403]
+*/
UINT WINAPI waveOutGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
{
printf("waveOutGetErrorText\n");
@@ -887,6 +870,9 @@
}
+/**************************************************************************
+* waveGetErrorText [internal]
+*/
UINT WINAPI waveGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
{
LPSTR msgptr;
@@ -957,17 +943,17 @@
UINT WINAPI waveOutOpen(HWAVEOUT FAR* lphWaveOut, UINT uDeviceID,
const WAVEFORMAT FAR* lpFormat, DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
{
-printf("waveOutOpen\n");
-if (lphWaveOut != NULL) *lphWaveOut = 0;
-return 0;
+ printf("waveOutOpen\n");
+ if (lphWaveOut != NULL) *lphWaveOut = 0;
+ return MMSYSERR_BADDEVICEID;
}
UINT WINAPI waveOutClose(HWAVEOUT hWaveOut)
{
-printf("waveOutClose\n");
-return 0;
+ printf("waveOutClose\n");
+ return MMSYSERR_INVALHANDLE;
}
@@ -975,8 +961,8 @@
UINT WINAPI waveOutPrepareHeader(HWAVEOUT hWaveOut,
WAVEHDR FAR* lpWaveOutHdr, UINT uSize)
{
-printf("waveOutPrepareHeader\n");
-return 0;
+ printf("waveOutPrepareHeader\n");
+ return MMSYSERR_INVALHANDLE;
}
@@ -984,99 +970,99 @@
UINT WINAPI waveOutUnprepareHeader(HWAVEOUT hWaveOut,
WAVEHDR FAR* lpWaveOutHdr, UINT uSize)
{
-printf("waveOutUnprepareHeader\n");
-return 0;
+ printf("waveOutUnprepareHeader\n");
+ return MMSYSERR_INVALHANDLE;
}
UINT WINAPI waveOutWrite(HWAVEOUT hWaveOut, WAVEHDR FAR* lpWaveOutHdr, UINT uSize)
{
-printf("waveOutWrite\n");
-return 0;
+ printf("waveOutWrite\n");
+ return MMSYSERR_INVALHANDLE;
}
UINT WINAPI waveOutPause(HWAVEOUT hWaveOut)
{
-printf("waveOutPause\n");
-return 0;
+ printf("waveOutPause\n");
+ return MMSYSERR_INVALHANDLE;
}
UINT WINAPI waveOutRestart(HWAVEOUT hWaveOut)
{
-printf("waveOutRestart\n");
-return 0;
+ printf("waveOutRestart\n");
+ return MMSYSERR_INVALHANDLE;
}
UINT WINAPI waveOutReset(HWAVEOUT hWaveOut)
{
-printf("waveOutReset\n");
-return 0;
+ printf("waveOutReset\n");
+ return MMSYSERR_INVALHANDLE;
}
UINT WINAPI waveOutGetPosition(HWAVEOUT hWaveOut, MMTIME FAR* lpInfo, UINT uSize)
{
-printf("waveOutGetPosition\n");
-return 0;
+ printf("waveOutGetPosition\n");
+ return MMSYSERR_INVALHANDLE;
}
UINT WINAPI waveOutGetVolume(UINT uDeviceID, DWORD FAR* lpdwVolume)
{
-printf("waveOutGetVolume\n");
-return 0;
+ printf("waveOutGetVolume\n");
+ return MMSYSERR_INVALHANDLE;
}
UINT WINAPI waveOutSetVolume(UINT uDeviceID, DWORD dwVolume)
{
-printf("waveOutSetVolume\n");
-return 0;
+ printf("waveOutSetVolume\n");
+ return MMSYSERR_INVALHANDLE;
}
UINT WINAPI waveOutGetID(HWAVEOUT hWaveOut, UINT FAR* lpuDeviceID)
{
-printf("waveOutGetID\n");
-return 0;
+ printf("waveOutGetID\n");
+ return MMSYSERR_INVALHANDLE;
}
UINT WINAPI waveOutGetPitch(HWAVEOUT hWaveOut, DWORD FAR* lpdwPitch)
{
-printf("waveOutGetPitch\n");
-return 0;
+ printf("waveOutGetPitch\n");
+ return MMSYSERR_INVALHANDLE;
}
UINT WINAPI waveOutSetPitch(HWAVEOUT hWaveOut, DWORD dwPitch)
{
-printf("waveOutSetPitch\n");
-return 0;
+ printf("waveOutSetPitch\n");
+ return MMSYSERR_INVALHANDLE;
}
UINT WINAPI waveOutGetPlaybackRate(HWAVEOUT hWaveOut, DWORD FAR* lpdwRate)
{
-printf("waveOutGetPlaybackRate\n");
-return 0;
+ printf("waveOutGetPlaybackRate\n");
+ return MMSYSERR_INVALHANDLE;
}
UINT WINAPI waveOutSetPlaybackRate(HWAVEOUT hWaveOut, DWORD dwRate)
{
-printf("waveOutSetPlaybackRate\n");
-return 0;
+ printf("waveOutSetPlaybackRate\n");
+ return MMSYSERR_INVALHANDLE;
}
@@ -1084,26 +1070,29 @@
UINT WINAPI waveOutBreakLoop(HWAVEOUT hWaveOut)
{
-printf("waveOutBreakLoop\n");
-return 0;
+ printf("waveOutBreakLoop\n");
+ return MMSYSERR_INVALHANDLE;
}
UINT WINAPI waveInGetNumDevs()
{
-printf("waveInGetNumDevs\n");
-return 0;
+/* printf("waveInGetNumDevs\n"); */
+ return 0;
}
UINT WINAPI waveInGetDevCaps(UINT uDeviceID, WAVEINCAPS FAR* lpCaps, UINT uSize)
{
-printf("waveInGetDevCaps\n");
-return 0;
+ printf("waveInGetDevCaps\n");
+ return MMSYSERR_INVALHANDLE;
}
+/**************************************************************************
+* waveInGetErrorText [MMSYSTEM.503]
+*/
UINT WINAPI waveInGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
{
printf("waveInGetErrorText\n");
@@ -1111,83 +1100,191 @@
}
+/**************************************************************************
+* waveInOpen [MMSYSTEM.504]
+*/
UINT WINAPI waveInOpen(HWAVEIN FAR* lphWaveIn, UINT uDeviceID,
const WAVEFORMAT FAR* lpFormat, DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
{
-printf("waveInOpen\n");
-if (lphWaveIn != NULL) *lphWaveIn = 0;
-return 0;
+ printf("waveInOpen\n");
+ if (lphWaveIn != NULL) *lphWaveIn = 0;
+ return MMSYSERR_BADDEVICEID;
}
+/**************************************************************************
+* waveInClose [MMSYSTEM.505]
+*/
UINT WINAPI waveInClose(HWAVEIN hWaveIn)
{
-printf("waveInClose\n");
-return 0;
+ printf("waveInClose\n");
+ return MMSYSERR_INVALHANDLE;
}
+/**************************************************************************
+* waveInPrepareHeader [MMSYSTEM.506]
+*/
UINT WINAPI waveInPrepareHeader(HWAVEIN hWaveIn,
WAVEHDR FAR* lpWaveInHdr, UINT uSize)
{
-printf("waveInPrepareHeader\n");
-return 0;
+ printf("waveInPrepareHeader\n");
+ return MMSYSERR_INVALHANDLE;
}
+/**************************************************************************
+* waveInUnprepareHeader [MMSYSTEM.507]
+*/
UINT WINAPI waveInUnprepareHeader(HWAVEIN hWaveIn,
WAVEHDR FAR* lpWaveInHdr, UINT uSize)
{
-printf("waveInUnprepareHeader\n");
-return 0;
+ printf("waveInUnprepareHeader\n");
+ return MMSYSERR_INVALHANDLE;
}
+/**************************************************************************
+* waveInAddBuffer [MMSYSTEM.508]
+*/
UINT WINAPI waveInAddBuffer(HWAVEIN hWaveIn,
WAVEHDR FAR* lpWaveInHdr, UINT uSize)
{
-printf("waveInAddBuffer\n");
-return 0;
-}
-
-UINT WINAPI waveInReset(HWAVEIN hWaveIn)
-{
-printf("waveInReset\n");
-return 0;
+ printf("waveInAddBuffer\n");
+ return 0;
}
+/**************************************************************************
+* waveInStart [MMSYSTEM.509]
+*/
UINT WINAPI waveInStart(HWAVEIN hWaveIn)
{
-printf("waveInStart\n");
-return 0;
+ printf("waveInStart\n");
+ return MMSYSERR_INVALHANDLE;
}
+/**************************************************************************
+* waveInStop [MMSYSTEM.510]
+*/
UINT WINAPI waveInStop(HWAVEIN hWaveIn)
{
-printf("waveInStop\n");
-return 0;
+ printf("waveInStop\n");
+ return MMSYSERR_INVALHANDLE;
}
+/**************************************************************************
+* waveInReset [MMSYSTEM.511]
+*/
+UINT WINAPI waveInReset(HWAVEIN hWaveIn)
+{
+ printf("waveInReset\n");
+ return MMSYSERR_INVALHANDLE;
+}
+
+/**************************************************************************
+* waveInGetPosition [MMSYSTEM.512]
+*/
UINT WINAPI waveInGetPosition(HWAVEIN hWaveIn, MMTIME FAR* lpInfo, UINT uSize)
{
-printf("waveInGetPosition\n");
-return 0;
+ printf("waveInGetPosition\n");
+ return MMSYSERR_INVALHANDLE;
}
+/**************************************************************************
+* waveInGetID [MMSYSTEM.513]
+*/
UINT WINAPI waveInGetID(HWAVEIN hWaveIn, UINT FAR* lpuDeviceID)
{
-printf("waveInGetID\n");
-return 0;
+ printf("waveInGetID\n");
+ return 0;
+}
+
+
+/**************************************************************************
+* mmioOpen [MMSYSTEM.1210]
+*/
+HMMIO WINAPI mmioOpen(LPSTR szFileName, MMIOINFO FAR* lpmmioinfo, DWORD dwOpenFlags)
+{
+ printf("mmioOpen('%s', %08X, %08X);\n", szFileName, lpmmioinfo, dwOpenFlags);
+ return 0;
+}
+
+
+
+/**************************************************************************
+* mmioClose [MMSYSTEM.1211]
+*/
+UINT WINAPI mmioClose(HMMIO hmmio, UINT uFlags)
+{
+ printf("mmioClose(%04X, %04X);\n", hmmio, uFlags);
+ return 0;
+}
+
+
+
+/**************************************************************************
+* mmioRead [MMSYSTEM.1212]
+*/
+LONG WINAPI mmioRead(HMMIO hmmio, HPSTR pch, LONG cch)
+{
+ printf("mmioRead\n");
+ return 0;
+}
+
+
+
+/**************************************************************************
+* mmioWrite [MMSYSTEM.1213]
+*/
+LONG WINAPI mmioWrite(HMMIO hmmio, HPCSTR pch, LONG cch)
+{
+ printf("mmioWrite\n");
+ return 0;
+}
+
+
+/**************************************************************************
+* mmioSeek [MMSYSTEM.1214]
+*/
+LONG WINAPI mmioSeek(HMMIO hmmio, LONG lOffset, int iOrigin)
+{
+ printf("mmioSeek\n");
+ return 0;
+}
+
+
+/**************************************************************************
+* mmioGetInfo [MMSYSTEM.1215]
+*/
+UINT WINAPI mmioGetInfo(HMMIO hmmio, MMIOINFO FAR* lpmmioinfo, UINT uFlags)
+{
+ printf("mmioGetInfo\n");
+ return 0;
+}
+
+
+/**************************************************************************
+* mmioGetInfo [MMSYSTEM.1216]
+*/
+UINT WINAPI mmioSetInfo(HMMIO hmmio, const MMIOINFO FAR* lpmmioinfo, UINT uFlags)
+{
+ printf("mmioSetInfo\n");
+ return 0;
}
/*
+#1100 pascal DRVOPEN
+#1101 pascal DRVCLOSE
+#1102 pascal DRVSENDMESSAGE
+#1103 pascal DRVGETMODULEHANDLE
+#1104 pascal DRVDEFDRIVERPROC
UINT WINAPI mciGetDeviceIDFromElementID (DWORD dwElementID,
LPCSTR lpstrType);
@@ -1201,8 +1298,6 @@
FOURCC WINAPI mmioStringToFOURCC(LPCSTR sz, UINT uFlags);
LPMMIOPROC WINAPI mmioInstallIOProc(FOURCC fccIOProc, LPMMIOPROC pIOProc,
DWORD dwFlags);
-UINT WINAPI mmioGetInfo(HMMIO hmmio, MMIOINFO FAR* lpmmioinfo, UINT uFlags);
-UINT WINAPI mmioSetInfo(HMMIO hmmio, const MMIOINFO FAR* lpmmioinfo, UINT uFlags);
UINT WINAPI mmioSetBuffer(HMMIO hmmio, LPSTR pchBuffer, LONG cchBuffer,
UINT uFlags);
UINT WINAPI mmioFlush(HMMIO hmmio, UINT uFlags);
diff --git a/misc/property.c b/misc/property.c
index 3ce34c8..18119c6 100644
--- a/misc/property.c
+++ b/misc/property.c
@@ -43,11 +43,15 @@
return FALSE;
}
lpProp = (LPPROPENTRY) GlobalLock(wndPtr->hProp);
- if (lpProp == NULL) return 0;
+ if (lpProp == NULL) {
+ printf("Property List Empty !\n");
+ return 0;
+ }
while (TRUE) {
if ((((DWORD)lpStr & 0xFFFF0000) == 0L &&
lpProp->Atom == LOWORD((DWORD)lpStr)) ||
(((DWORD)lpStr & 0xFFFF0000) != 0L &&
+ lpProp->PropName != NULL &&
strcmp(lpProp->PropName, lpStr) == 0)) {
printf("RemoveProp // Property found ! hData=%04X\n", lpProp->hData);
hOldData = lpProp->hData;
@@ -90,11 +94,15 @@
return 0;
}
lpProp = (LPPROPENTRY) GlobalLock(wndPtr->hProp);
- if (lpProp == NULL) return 0;
+ if (lpProp == NULL) {
+ printf("Property List Empty !\n");
+ return 0;
+ }
while (TRUE) {
if ((((DWORD)lpStr & 0xFFFF0000) == 0L &&
lpProp->Atom == LOWORD((DWORD)lpStr)) ||
(((DWORD)lpStr & 0xFFFF0000) != 0L &&
+ lpProp->PropName != NULL &&
strcmp(lpProp->PropName, lpStr) == 0)) {
printf("GetProp // Property found ! hData=%04X\n", lpProp->hData);
GlobalUnlock(wndPtr->hProp);
@@ -136,6 +144,7 @@
if ((((DWORD)lpStr & 0xFFFF0000) == 0L &&
lpProp->Atom == LOWORD((DWORD)lpStr)) ||
(((DWORD)lpStr & 0xFFFF0000) != 0L &&
+ lpProp->PropName != NULL &&
strcmp(lpProp->PropName, lpStr) == 0)) {
#ifdef DEBUG_PROP
printf("SetProp // change already exinsting property !\n");
@@ -177,7 +186,7 @@
}
else {
lpNewProp->Atom = 0;
- lpNewProp->PropName = malloc(strlen(lpStr));
+ lpNewProp->PropName = malloc(strlen(lpStr) + 1);
if (lpNewProp->PropName == NULL) {
printf("SetProp // Can't allocate memory for Property Name !\n");
GlobalUnlock(wndPtr->hProp);
@@ -207,7 +216,10 @@
return 0;
}
lpProp = (LPPROPENTRY) GlobalLock(wndPtr->hProp);
- if (lpProp == NULL) return 0;
+ if (lpProp == NULL) {
+ printf("Property List Empty !\n");
+ return 0;
+ }
if (lpEnumFunc != NULL) return 0;
while (TRUE) {
printf("EnumProps // lpProp->Atom=%04X !\n", lpProp->Atom);
diff --git a/miscemu/Imakefile b/miscemu/Imakefile
index c9c9db8..4b258c4 100644
--- a/miscemu/Imakefile
+++ b/miscemu/Imakefile
@@ -9,6 +9,7 @@
int21.c \
int25.c \
int26.c \
+ int2f.c \
ioports.c \
kernel.c
diff --git a/miscemu/emulate.c b/miscemu/emulate.c
index fd9cc05..1b69503 100644
--- a/miscemu/emulate.c
+++ b/miscemu/emulate.c
@@ -1,6 +1,3 @@
-static char RCSId[] = "$Id: heap.c,v 1.3 1993/07/04 04:04:21 root Exp root $";
-static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
-
#include <stdlib.h>
#include <stdio.h>
#include "prototypes.h"
@@ -19,9 +16,9 @@
WIN87_fpmath()
{
printf( "_fpmath: (%x:%x %x %x)\n",_CONTEXT->sc_cs, _CONTEXT->sc_eip,
- _CONTEXT->sc_es, _BX);
+ _CONTEXT->sc_es, _BX & 0xffff);
- switch(_BX )
+ switch(_BX & 0xffff)
{
case 11:
return 1;
diff --git a/miscemu/int21.c b/miscemu/int21.c
index d0f8003..cefe3ae 100644
--- a/miscemu/int21.c
+++ b/miscemu/int21.c
@@ -709,7 +709,6 @@
do {
if ((dp = DOS_readdir(dp)) == NULL) {
- DOS_closedir(dp);
Error(NoMoreFiles, EC_MediaError , EL_Disk);
EAX = (EAX & 0xffffff00L) | NoMoreFiles;
SetCflag;
@@ -1026,7 +1025,6 @@
fprintf(stderr, "int21: delete file %s\n", temp);
/* unlink(GetUnixFileName(temp)); */
}
-
DOS_closedir(dp);
EAX = (EAX & 0xffffff00L);
}
@@ -1072,7 +1070,6 @@
strcpy(newnameptr, fcb + 1);
fprintf(stderr, "int21: renamefile %s -> %s\n", oldname, newname);
}
-
DOS_closedir(dp);
EAX = (EAX & 0xffffff00L);
}
diff --git a/objects/bitmap.c b/objects/bitmap.c
index 6c21e0c..38fabec 100644
--- a/objects/bitmap.c
+++ b/objects/bitmap.c
@@ -61,7 +61,7 @@
extern void _XInitImageFuncPtrs( XImage* );
XImage * image;
- image = XCreateImage( XT_display, DefaultVisualOfScreen(XT_screen),
+ image = XCreateImage( XT_display, DefaultVisualOfScreen(screen),
bmp->bmBitsPixel, ZPixmap, 0, bmpData,
bmp->bmWidth, bmp->bmHeight, 16, bmp->bmWidthBytes );
if (!image) return 0;
diff --git a/objects/font.c b/objects/font.c
index 2ff21c5..6129981 100644
--- a/objects/font.c
+++ b/objects/font.c
@@ -13,6 +13,8 @@
#include "user.h"
#include "gdi.h"
+#define MAX_FONTS 256
+static LPLOGFONT lpLogFontList[MAX_FONTS] = { NULL };
/***********************************************************************
* FONT_MatchFont
@@ -45,34 +47,35 @@
case FF_DECORATIVE: family = "*"; break;
default: family = "*"; break;
}
+ AnsiLower(family);
- /* Width==0 seems not to be a valid wildcard on SGI's, using * instead */
- if ( width == 0 )
- sprintf( pattern, "-*-%s-%s-%c-normal--*-%d-*-*-%c-*-%s",
- family, weight, slant, height, spacing, charset
- );
- else
- sprintf( pattern, "-*-%s-%s-%c-normal--*-%d-*-*-%c-%d-%s",
- family, weight, slant, height, spacing, width, charset
- );
-
+ while (TRUE) {
+ /* Width==0 seems not to be a valid wildcard on SGI's, using * instead */
+ if ( width == 0 )
+ sprintf( pattern, "-*-%s-%s-%c-normal--*-%d-*-*-%c-*-%s",
+ family, weight, slant, height, spacing, charset);
+ else
+ sprintf( pattern, "-*-%s-%s-%c-normal--*-%d-*-*-%c-%d-%s",
+ family, weight, slant, height, spacing, width, charset);
#ifdef DEBUG_FONT
- printf( "FONT_MatchFont: '%s'\n", pattern );
+ printf( "FONT_MatchFont: '%s'\n", pattern );
#endif
- names = XListFonts( XT_display, pattern, 1, &count );
- if (!count)
- {
+ names = XListFonts( XT_display, pattern, 1, &count );
+ if (count > 0) break;
+ height -= 10;
+ if (height < 10) {
#ifdef DEBUG_FONT
- printf( " No matching font found\n" );
+ printf( " No matching font found\n" );
#endif
- return NULL;
- }
+ return NULL;
+ }
+ }
#ifdef DEBUG_FONT
- printf( " Found '%s'\n", *names );
+ printf( " Found '%s'\n", *names );
#endif
- fontStruct = XLoadQueryFont( XT_display, *names );
- XFreeFontNames( names );
- return fontStruct;
+ fontStruct = XLoadQueryFont( XT_display, *names );
+ XFreeFontNames( names );
+ return fontStruct;
}
@@ -134,6 +137,9 @@
if (!hfont) return 0;
fontPtr = (FONTOBJ *) GDI_HEAP_ADDR( hfont );
memcpy( &fontPtr->logfont, font, sizeof(LOGFONT) );
+#ifdef DEBUG_FONT
+ printf("CreateFontIndirect(%08X); return %04X !\n", font, hfont);
+#endif
return hfont;
}
@@ -173,7 +179,9 @@
X_PHYSFONT * stockPtr;
HFONT prevHandle = dc->w.hFont;
XFontStruct * fontStruct;
-
+#ifdef DEBUG_FONT
+ printf("FONT_SelectObject(%04X, %04X, %08X); !\n", dc, hfont, font);
+#endif
/* Load font if necessary */
if (!font)
@@ -422,6 +430,117 @@
return TRUE;
}
+/*************************************************************************
+ * ParseFontParms [internal]
+ */
+int ParseFontParms(LPSTR lpFont, WORD wParmsNo, LPSTR lpRetStr, WORD wMaxSiz)
+{
+ int i, j;
+#ifdef DEBUG_FONT
+ printf("ParseFontParms('%s', %d, %08X, %d);\n",
+ lpFont, wParmsNo, lpRetStr, wMaxSiz);
+#endif
+ if (lpFont == NULL) return 0;
+ if (lpRetStr == NULL) return 0;
+ for (i = 0; (*lpFont != '\0' && i != wParmsNo); ) {
+ if (*lpFont == '-') i++;
+ lpFont++;
+ }
+ if (i == wParmsNo) {
+ if (*lpFont == '-') lpFont++;
+ wMaxSiz--;
+ for (i = 0; (*lpFont != '\0' && *lpFont != '-' && i < wMaxSiz); i++)
+ *(lpRetStr + i) = *lpFont++;
+ *(lpRetStr + i) = '\0';
+#ifdef DEBUG_FONT
+ printf("ParseFontParms // '%s'\n", lpRetStr);
+#endif
+ return i;
+ }
+ else
+ lpRetStr[0] = '\0';
+ return 0;
+}
+
+
+/*************************************************************************
+ * InitFontsList [internal]
+ */
+void InitFontsList()
+{
+ char str[32];
+ char pattern[100];
+ char *family, *weight, *charset;
+ char **names;
+ char slant, spacing;
+ int i, width, count;
+ LPLOGFONT lpNewFont;
+ weight = "medium";
+ slant = 'r';
+ spacing = '*';
+ charset = "*";
+ family = "*";
+ printf("InitFontsList !\n");
+ sprintf( pattern, "-*-%s-%s-%c-normal--*-*-*-*-%c-*-%s",
+ family, weight, slant, spacing, charset);
+ names = XListFonts( XT_display, pattern, MAX_FONTS, &count );
+#ifdef DEBUG_FONT
+ printf("InitFontsList // count=%d \n", count);
+#endif
+ for (i = 0; i < count; i++) {
+ lpNewFont = malloc(sizeof(LOGFONT) + LF_FACESIZE);
+ if (lpNewFont == NULL) {
+ printf("InitFontsList // Error alloc new font structure !\n");
+ break;
+ }
+#ifdef DEBUG_FONT
+ printf("InitFontsList // names[%d]='%s' \n", i, names[i]);
+#endif
+ ParseFontParms(names[i], 2, str, sizeof(str));
+ if (strcmp(str, "fixed") == 0) strcat(str, "sys");
+ AnsiUpper(str);
+ strcpy(lpNewFont->lfFaceName, str);
+ ParseFontParms(names[i], 7, str, sizeof(str));
+ lpNewFont->lfHeight = atoi(str) / 10;
+ ParseFontParms(names[i], 12, str, sizeof(str));
+ lpNewFont->lfWidth = atoi(str) / 10;
+ lpNewFont->lfEscapement = 0;
+ lpNewFont->lfOrientation = 0;
+ lpNewFont->lfWeight = FW_REGULAR;
+ lpNewFont->lfItalic = 0;
+ lpNewFont->lfUnderline = 0;
+ lpNewFont->lfStrikeOut = 0;
+ ParseFontParms(names[i], 13, str, sizeof(str));
+ if (strcmp(str, "iso8859") == 0)
+ lpNewFont->lfCharSet = ANSI_CHARSET;
+ else
+ lpNewFont->lfCharSet = OEM_CHARSET;
+ lpNewFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
+ lpNewFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
+ lpNewFont->lfQuality = DEFAULT_QUALITY;
+ ParseFontParms(names[i], 11, str, sizeof(str));
+ switch(str[0]) {
+ case 'p':
+ lpNewFont->lfPitchAndFamily = VARIABLE_PITCH | FF_SWISS;
+ break;
+ case 'm':
+ lpNewFont->lfPitchAndFamily = FIXED_PITCH | FF_MODERN;
+ break;
+ default:
+ lpNewFont->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
+ break;
+ }
+#ifdef DEBUG_FONT
+ printf("InitFontsList // lpNewFont->lfHeight=%d \n", lpNewFont->lfHeight);
+ printf("InitFontsList // lpNewFont->lfWidth=%d \n", lpNewFont->lfWidth);
+ printf("InitFontsList // lfFaceName='%s' \n", lpNewFont->lfFaceName);
+#endif
+ lpLogFontList[i] = lpNewFont;
+ lpLogFontList[i+1] = NULL;
+ }
+ XFreeFontNames(names);
+}
+
/*************************************************************************
* EnumFonts [GDI.70]
@@ -430,11 +549,16 @@
{
HANDLE hLog;
HANDLE hMet;
+ HFONT hFont;
+ HFONT hOldFont;
LPLOGFONT lpLogFont;
LPTEXTMETRIC lptm;
+ LPSTR lpFaceList[MAX_FONTS];
+ char FaceName[LF_FACESIZE];
int nRet;
- printf("EnumFonts(%04X, %08X, %08X, %08X)\n",
- hDC, lpFaceName, lpEnumFunc, lpData);
+ int j, i = 0;
+ printf("EnumFonts(%04X, %08X='%s', %08X, %08X)\n",
+ hDC, lpFaceName, lpFaceName, lpEnumFunc, lpData);
if (lpEnumFunc == NULL) return 0;
hLog = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(LOGFONT) + LF_FACESIZE);
lpLogFont = (LPLOGFONT) USER_HEAP_ADDR(hLog);
@@ -449,41 +573,49 @@
printf("EnumFonts // can't alloc TEXTMETRIC struct !\n");
return 0;
}
+ if (lpFaceName != NULL) {
+ strcpy(FaceName, lpFaceName);
+ AnsiUpper(FaceName);
+ }
+ if (lpLogFontList[0] == NULL) InitFontsList();
+ memset(lpFaceList, 0, MAX_FONTS * sizeof(LPSTR));
while (TRUE) {
- printf("EnumFonts // !\n");
- lpLogFont->lfHeight = 18;
- lpLogFont->lfWidth = 12;
- lpLogFont->lfEscapement = 0;
- lpLogFont->lfOrientation = 0;
- lpLogFont->lfWeight = FW_REGULAR;
- lpLogFont->lfItalic = 0;
- lpLogFont->lfUnderline = 0;
- lpLogFont->lfStrikeOut = 0;
- lpLogFont->lfCharSet = ANSI_CHARSET;
- lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
- lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
- lpLogFont->lfQuality = DEFAULT_QUALITY;
- lpLogFont->lfPitchAndFamily = FIXED_PITCH | FF_MODERN;
- strcpy(lpLogFont->lfFaceName, "Courier");
- printf("lpLogFont=%08X lptm=%08X\n", lpLogFont, lptm);
+ if (lpLogFontList[i] == NULL) break;
+ if (lpFaceName == NULL) {
+ for (j = 0; j < MAX_FONTS; j++) {
+ if (lpFaceList[j] == NULL) break;
+ if (strcmp(lpFaceList[j], lpLogFontList[i]->lfFaceName) == 0) {
+ i++; j = 0;
+ }
+ }
+ if (lpLogFontList[i] == NULL) break;
+ lpFaceList[j] = lpLogFontList[i]->lfFaceName;
+ printf("EnumFonts // enum all 'lpFaceName' '%s' !\n", lpFaceList[j]);
+ }
+ else {
+ while(lpLogFontList[i] != NULL) {
+ if (strcmp(FaceName, lpLogFontList[i]->lfFaceName) == 0) break;
+ i++;
+ }
+ if (lpLogFontList[i] == NULL) break;
+ }
+ memcpy(lpLogFont, lpLogFontList[i++], sizeof(LOGFONT) + LF_FACESIZE);
+ hFont = CreateFontIndirect(lpLogFont);
+ hOldFont = SelectObject(hDC, hFont);
+ GetTextMetrics(hDC, lptm);
+ SelectObject(hDC, hOldFont);
+ DeleteObject(hFont);
+ printf("EnumFonts // i=%d lpLogFont=%08X lptm=%08X\n", i, lpLogFont, lptm);
#ifdef WINELIB
nRet = (*lpEnumFunc)(lpLogFont, lptm, 0, lpData);
#else
nRet = CallBack16(lpEnumFunc, 4, 2, (int)lpLogFont,
2, (int)lptm, 0, (int)0, 2, (int)lpData);
#endif
- if (nRet == 0) break;
- lpLogFont->lfPitchAndFamily = VARIABLE_PITCH | FF_SWISS;
- strcpy(lpLogFont->lfFaceName, "Helvetica");
- printf("lpLogFont=%08X lptm=%08X\n", lpLogFont, lptm);
-#ifdef WINELIB
- nRet = (*lpEnumFunc)(lpLogFont, lptm, 0, lpData);
-#else
- nRet = CallBack16(lpEnumFunc, 4, 2, (int)lpLogFont,
- 2, (int)lptm, 0, (int)0, 2, (int)lpData);
-#endif
- if (nRet == 0) break;
- else break;
+ if (nRet == 0) {
+ printf("EnumFonts // EnumEnd requested by application !\n");
+ break;
+ }
}
USER_HEAP_FREE(hMet);
USER_HEAP_FREE(hLog);
@@ -498,9 +630,14 @@
{
HANDLE hLog;
HANDLE hMet;
+ HFONT hFont;
+ HFONT hOldFont;
LPLOGFONT lpLogFont;
LPTEXTMETRIC lptm;
+ LPSTR lpFaceList[MAX_FONTS];
+ char FaceName[LF_FACESIZE];
int nRet;
+ int j, i = 0;
printf("EnumFontFamilies(%04X, %08X, %08X, %08X)\n",
hDC, lpszFamily, lpEnumFunc, lpData);
if (lpEnumFunc == NULL) return 0;
@@ -517,43 +654,49 @@
printf("EnumFontFamilies // can't alloc TEXTMETRIC struct !\n");
return 0;
}
+ if (lpszFamily != NULL) {
+ strcpy(FaceName, lpszFamily);
+ AnsiUpper(FaceName);
+ }
+ if (lpLogFontList[0] == NULL) InitFontsList();
+ memset(lpFaceList, 0, MAX_FONTS * sizeof(LPSTR));
while (TRUE) {
- printf("EnumFontFamilies // !\n");
- lpLogFont->lfHeight = 12;
- lpLogFont->lfWidth = 8;
- lpLogFont->lfEscapement = 0;
- lpLogFont->lfOrientation = 0;
- lpLogFont->lfWeight = FW_REGULAR;
- lpLogFont->lfItalic = 0;
- lpLogFont->lfUnderline = 0;
- lpLogFont->lfStrikeOut = 0;
- lpLogFont->lfCharSet = ANSI_CHARSET;
- lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
- lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
- lpLogFont->lfQuality = DEFAULT_QUALITY;
- lpLogFont->lfPitchAndFamily = FIXED_PITCH | FF_MODERN;
- strcpy(lpLogFont->lfFaceName, "Courier");
-/* lpLogFont->lfFullName[LF_FACESIZE] = 12;
- lpLogFont->lfStyle[LF_FACESIZE] = 12; */
- printf("lpLogFont=%08X lptm=%08X\n", lpLogFont, lptm);
+ if (lpLogFontList[i] == NULL) break;
+ if (lpszFamily == NULL) {
+ for (j = 0; j < MAX_FONTS; j++) {
+ if (lpFaceList[j] == NULL) break;
+ if (strcmp(lpFaceList[j], lpLogFontList[i]->lfFaceName) == 0) {
+ i++; j = 0;
+ }
+ }
+ if (lpLogFontList[i] == NULL) break;
+ lpFaceList[j] = lpLogFontList[i]->lfFaceName;
+ printf("EnumFontFamilies // enum all 'lpszFamily' '%s' !\n", lpFaceList[j]);
+ }
+ else {
+ while(lpLogFontList[i] != NULL) {
+ if (strcmp(FaceName, lpLogFontList[i]->lfFaceName) == 0) break;
+ i++;
+ }
+ if (lpLogFontList[i] == NULL) break;
+ }
+ memcpy(lpLogFont, lpLogFontList[i++], sizeof(LOGFONT) + LF_FACESIZE);
+ hFont = CreateFontIndirect(lpLogFont);
+ hOldFont = SelectObject(hDC, hFont);
+ GetTextMetrics(hDC, lptm);
+ SelectObject(hDC, hOldFont);
+ DeleteObject(hFont);
+ printf("EnumFontFamilies // i=%d lpLogFont=%08X lptm=%08X\n", i, lpLogFont, lptm);
#ifdef WINELIB
nRet = (*lpEnumFunc)(lpLogFont, lptm, 0, lpData);
#else
nRet = CallBack16(lpEnumFunc, 4, 2, (int)lpLogFont,
2, (int)lptm, 0, (int)0, 2, (int)lpData);
#endif
- if (nRet == 0) break;
- lpLogFont->lfPitchAndFamily = VARIABLE_PITCH | FF_SWISS;
- strcpy(lpLogFont->lfFaceName, "Helvetica");
- printf("lpLogFont=%08X lptm=%08X\n", lpLogFont, lptm);
-#ifdef WINELIB
- nRet = (*lpEnumFunc)(lpLogFont, lptm, 0, lpData);
-#else
- nRet = CallBack16(lpEnumFunc, 4, 2, (int)lpLogFont,
- 2, (int)lptm, 0, (int)0, 2, (int)lpData);
-#endif
- if (nRet == 0) break;
- else break;
+ if (nRet == 0) {
+ printf("EnumFontFamilies // EnumEnd requested by application !\n");
+ break;
+ }
}
USER_HEAP_FREE(hMet);
USER_HEAP_FREE(hLog);
diff --git a/objects/gdiobj.c b/objects/gdiobj.c
index 6243fd2..9248c32 100644
--- a/objects/gdiobj.c
+++ b/objects/gdiobj.c
@@ -8,11 +8,19 @@
#include <stdlib.h>
#include <stdio.h>
+#include "user.h"
#include "gdi.h"
#include "prototypes.h"
MDESC *GDI_Heap = NULL;
+/* Object types for EnumObjects() */
+#define OBJ_PEN 1
+#define OBJ_BRUSH 2
+
+#define MAX_OBJ 1024
+HANDLE *lpPenBrushList = NULL;
+
extern HPALETTE COLOR_Init(); /* color.c */
/***********************************************************************
@@ -178,6 +186,36 @@
/***********************************************************************
+ * GDI_AppendToPenBrushList
+ */
+BOOL GDI_AppendToPenBrushList(HANDLE hNewObj)
+{
+ HANDLE *lphObj;
+ int i = 1;
+ if (hNewObj == 0) return FALSE;
+ if (lpPenBrushList == NULL) {
+ lpPenBrushList = malloc(MAX_OBJ * sizeof(HANDLE));
+ lpPenBrushList[0] = 0;
+#ifdef DEBUG_GDI
+ printf("GDI_AppendToPenBrushList() lpPenBrushList allocated !\n");
+#endif
+ }
+ for (lphObj = lpPenBrushList; i < MAX_OBJ; i++) {
+ if (*lphObj == 0) {
+ *lphObj = hNewObj;
+ *(lphObj + 1) = 0;
+#ifdef DEBUG_GDI
+ printf("GDI_AppendToPenBrushList(%04X) appended (count=%d)\n", hNewObj, i);
+#endif
+ return TRUE;
+ }
+ lphObj++;
+ }
+ return FALSE;
+}
+
+
+/***********************************************************************
* GDI_FindPrevObject
*
* Return the GDI object whose hNext field points to obj.
@@ -212,6 +250,9 @@
obj->hNext = 0;
obj->wMagic = magic;
obj->dwCount = ++count;
+ if (magic == PEN_MAGIC || magic == BRUSH_MAGIC) {
+ GDI_AppendToPenBrushList(handle);
+ }
return handle;
}
@@ -389,3 +430,136 @@
#endif
return TRUE;
}
+
+
+/***********************************************************************
+ * EnumObjects (GDI.71)
+ */
+int EnumObjects(HDC hDC, int nObjType, FARPROC lpEnumFunc, LPSTR lpData)
+{
+ HANDLE handle;
+ DC *dc;
+ HANDLE *lphObj;
+ GDIOBJHDR *header;
+ WORD wMagic;
+ LPSTR lpLog; /* Point to a LOGBRUSH or LOGPEN struct */
+ HANDLE hLog;
+ int i, nRet;
+ if (lpEnumFunc == NULL) {
+ printf("EnumObjects // Bad EnumProc callback address !\n");
+ return 0;
+ }
+ switch (nObjType) {
+ case OBJ_PEN:
+ wMagic = PEN_MAGIC;
+ printf("EnumObjects(%04X, OBJ_PEN, %08X, %08X);\n",
+ hDC, lpEnumFunc, lpData);
+ hLog = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(LOGPEN));
+ lpLog = (LPSTR) USER_HEAP_ADDR(hLog);
+ if (lpLog == NULL) {
+ printf("EnumObjects // Unable to alloc LOGPEN struct !\n");
+ return 0;
+ }
+ break;
+ case OBJ_BRUSH:
+ wMagic = BRUSH_MAGIC;
+ printf("EnumObjects(%04X, OBJ_BRUSH, %08X, %08X);\n",
+ hDC, lpEnumFunc, lpData);
+ hLog = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(LOGBRUSH));
+ lpLog = (LPSTR) USER_HEAP_ADDR(hLog);
+ if (lpLog == NULL) {
+ printf("EnumObjects // Unable to alloc LOGBRUSH struct !\n");
+ return 0;
+ }
+ break;
+ default:
+ printf("EnumObjects(%04X, %04X, %08X, %08X); // Unknown OBJ type !\n",
+ hDC, nObjType, lpEnumFunc, lpData);
+ return 0;
+ }
+ printf("EnumObjects // Stock Objects first !\n");
+ for (i = 0; i < NB_STOCK_OBJECTS; i++) {
+ header = StockObjects[i];
+ if (header->wMagic == wMagic) {
+ PEN_GetObject( (PENOBJ *)header, sizeof(LOGPEN), (LPLOGPEN)lpLog);
+ BRUSH_GetObject( (BRUSHOBJ *)header, sizeof(LOGBRUSH), (LPLOGBRUSH)lpLog);
+ printf("EnumObjects // StockObj lpLog=%08X lpData=%08X\n", lpLog, lpData);
+ if (header->wMagic == BRUSH_MAGIC) {
+ printf("EnumObjects // StockBrush lbStyle=%04X\n", ((LPLOGBRUSH)lpLog)->lbStyle);
+ printf("EnumObjects // StockBrush lbColor=%08X\n", ((LPLOGBRUSH)lpLog)->lbColor);
+ printf("EnumObjects // StockBrush lbHatch=%04X\n", ((LPLOGBRUSH)lpLog)->lbHatch);
+ }
+ if (header->wMagic == PEN_MAGIC) {
+ printf("EnumObjects // StockPen lopnStyle=%04X\n", ((LPLOGPEN)lpLog)->lopnStyle);
+ printf("EnumObjects // StockPen lopnWidth=%08X\n", ((LPLOGPEN)lpLog)->lopnWidth);
+ printf("EnumObjects // StockPen lopnColor=%08X\n", ((LPLOGPEN)lpLog)->lopnColor);
+ }
+ nRet = 1;
+/*
+#ifdef WINELIB
+ nRet = (*lpEnumFunc)(lpLog, lpData);
+#else
+ nRet = CallBack16(lpEnumFunc, 4, 2, (int)lpLog, 2, (int)lpData);
+#endif
+*/
+ printf("EnumObjects // after CallBack16 !\n");
+ if (nRet == 0) {
+ USER_HEAP_FREE(hLog);
+ printf("EnumObjects // EnumEnd requested by application !\n");
+ return 0;
+ }
+ }
+ }
+ if (lpPenBrushList == NULL) return 0;
+ printf("EnumObjects // Now DC owned objects %08X !\n", header);
+ for (lphObj = lpPenBrushList; *lphObj != 0; ) {
+#ifdef DEBUG_GDI
+ printf("EnumObjects // *lphObj=%04X\n", *lphObj);
+#endif
+ header = (GDIOBJHDR *) GDI_HEAP_ADDR(*lphObj++);
+ if (header->wMagic == wMagic) {
+#ifdef DEBUG_GDI
+ printf("EnumObjects // DC_Obj lpLog=%08X lpData=%08X\n", lpLog, lpData);
+#endif
+ if (header->wMagic == BRUSH_MAGIC) {
+ BRUSH_GetObject( (BRUSHOBJ *)header, sizeof(LOGBRUSH), (LPLOGBRUSH)lpLog);
+ printf("EnumObjects // DC_Brush lbStyle=%04X\n", ((LPLOGBRUSH)lpLog)->lbStyle);
+ printf("EnumObjects // DC_Brush lbColor=%08X\n", ((LPLOGBRUSH)lpLog)->lbColor);
+ printf("EnumObjects // DC_Brush lbHatch=%04X\n", ((LPLOGBRUSH)lpLog)->lbHatch);
+ }
+ if (header->wMagic == PEN_MAGIC) {
+ PEN_GetObject( (PENOBJ *)header, sizeof(LOGPEN), (LPLOGPEN)lpLog);
+ printf("EnumObjects // DC_Pen lopnStyle=%04X\n", ((LPLOGPEN)lpLog)->lopnStyle);
+ printf("EnumObjects // DC_Pen lopnWidth=%08X\n", ((LPLOGPEN)lpLog)->lopnWidth);
+ printf("EnumObjects // DC_Pen lopnColor=%08X\n", ((LPLOGPEN)lpLog)->lopnColor);
+ }
+/*
+#ifdef WINELIB
+ nRet = (*lpEnumFunc)(lpLog, lpData);
+#else
+ nRet = CallBack16(lpEnumFunc, 4, 2, (int)lpLog, 2, (int)lpData);
+#endif
+*/
+ nRet = 1;
+ printf("EnumObjects // after CallBack16 !\n");
+ if (nRet == 0) {
+ USER_HEAP_FREE(hLog);
+ printf("EnumObjects // EnumEnd requested by application !\n");
+ return 0;
+ }
+ }
+ }
+ USER_HEAP_FREE(hLog);
+ printf("EnumObjects // End of enumeration !\n");
+ return 0;
+}
+
+/***********************************************************************
+ * SetObjectOwner (GDI.461)
+ */
+int SetObjectOwner(HANDLE hObj)
+{
+ printf("EMPTY STUB !!! SetObjectOwner() (I don't know its prototype !\n");
+ return 0;
+}
+
diff --git a/objects/text.c b/objects/text.c
index 0d9690b..e7d3cdb 100644
--- a/objects/text.c
+++ b/objects/text.c
@@ -418,7 +418,7 @@
BOOL ExtTextOut(HDC hDC, short x, short y, WORD wOptions, LPRECT lprect,
LPSTR str, WORD count, LPINT lpDx)
{
- printf("EMPTY STUB !!! ExtTextOut(); ! (call TextOut() for new)\n");
+ printf("EMPTY STUB !!! ExtTextOut(); ! call TextOut() for now !\n");
TextOut(hDC, x, y, str, count);
return FALSE;
}
diff --git a/windows/dialog.c b/windows/dialog.c
index 7724084..2e5b6e3 100644
--- a/windows/dialog.c
+++ b/windows/dialog.c
@@ -156,7 +156,7 @@
LPCSTR data;
#ifdef DEBUG_DIALOG
- printf( "CreateDialogParam: %d,'%s',%d,%p,%d\n",
+ printf( "CreateDialogParam: %d,'%x',%d,%p,%d\n",
hInst, dlgTemplate, owner, dlgProc, param );
#endif
@@ -295,10 +295,10 @@
}
header->style |= WS_CHILD;
CreateWindowEx( WS_EX_NOPARENTNOTIFY,
- class, text, header->style,
- header->x * xUnit / 4, header->y * yUnit / 8,
- header->cx * xUnit / 4, header->cy * yUnit / 8,
- hwnd, header->id, hInst, NULL );
+ class, text, header->style,
+ header->x * xUnit / 4, header->y * yUnit / 8,
+ header->cx * xUnit / 4, header->cy * yUnit / 8,
+ hwnd, header->id, hInst, NULL );
header = next_header;
}
@@ -381,7 +381,7 @@
HWND hwnd;
#ifdef DEBUG_DIALOG
- printf( "DialogBoxParam: %d,'%s',%d,%p,%d\n",
+ printf( "DialogBoxParam: %d,'%x',%d,%p,%d\n",
hInst, dlgTemplate, owner, dlgProc, param );
#endif
hwnd = CreateDialogParam( hInst, dlgTemplate, owner, dlgProc, param );
@@ -451,6 +451,7 @@
int dlgCode = SendMessage( msg->hwnd, WM_GETDLGCODE, 0, 0 );
/* Process key message */
/* .... */
+ SendMessage( msg->hwnd, msg->message, msg->wParam, msg->lParam );
}
return TRUE;
}
diff --git a/windows/graphics.c b/windows/graphics.c
index a80d5cf..4a1abe1 100644
--- a/windows/graphics.c
+++ b/windows/graphics.c
@@ -35,7 +35,7 @@
}
if (DC_SetupGCForPen( dc ))
- XDrawLine(XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XDrawLine(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + XLPTODP( dc, dc->w.CursPosX ),
dc->w.DCOrgY + YLPTODP( dc, dc->w.CursPosY ),
dc->w.DCOrgX + XLPTODP( dc, x ),
@@ -145,7 +145,7 @@
diff_angle = end_angle - start_angle;
if (diff_angle < 0.0) diff_angle += 2*PI;
- XDrawArc( XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1,
(int)(start_angle * 180 * 64 / PI),
@@ -162,7 +162,7 @@
points[1].x = dc->w.DCOrgX + xcenter;
points[1].y = dc->w.DCOrgY + ycenter;
}
- XDrawLines( XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XDrawLines( display, dc->u.x.drawable, dc->u.x.gc,
points, lines+1, CoordModeOrigin );
return TRUE;
}
@@ -222,11 +222,11 @@
if ((left == right) || (top == bottom)) return FALSE;
if (DC_SetupGCForBrush( dc ))
- XFillArc( XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XFillArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1, 0, 360*64 );
if (DC_SetupGCForPen( dc ))
- XDrawArc( XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1, 0, 360*64 );
return TRUE;
@@ -253,11 +253,11 @@
bottom = YLPTODP( dc, bottom );
if (DC_SetupGCForBrush( dc ))
- XFillRectangle( XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1 );
if (DC_SetupGCForPen( dc ))
- XDrawRectangle( XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XDrawRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1 );
return TRUE;
@@ -289,41 +289,41 @@
x2 = XLPTODP(dc, right - ell_width);
y2 = YLPTODP(dc, bottom - ell_height);
if (DC_SetupGCForBrush(dc)) {
- XFillArc(XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XFillArc(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x1, dc->w.DCOrgY + y1,
ell_width, ell_height, 90 * 64, 90 * 64);
- XFillArc(XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XFillArc(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x1, dc->w.DCOrgY + y2,
ell_width, ell_height, 180 * 64, 90 * 64);
- XFillArc(XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XFillArc(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x2, dc->w.DCOrgY + y2,
ell_width, ell_height, 270 * 64, 90 * 64);
- XFillArc(XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XFillArc(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x2, dc->w.DCOrgY + y1,
ell_width, ell_height, 0, 90 * 64);
ell_width /= 2; ell_height /= 2;
- XFillRectangle(XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XFillRectangle(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left + ell_width, dc->w.DCOrgY + top,
right - left - 2 * ell_width, bottom - top);
- XFillRectangle(XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XFillRectangle(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top + ell_height,
ell_width, bottom - top - 2 * ell_height);
- XFillRectangle(XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XFillRectangle(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + right - ell_width, dc->w.DCOrgY + top + ell_height,
ell_width, bottom - top - 2 * ell_height);
ell_width *= 2; ell_height *= 2;
}
if (DC_SetupGCForPen(dc)) {
- XDrawArc(XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XDrawArc(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x1, dc->w.DCOrgY + y1,
ell_width, ell_height, 90 * 64, 90 * 64);
- XDrawArc(XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XDrawArc(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x1, dc->w.DCOrgY + y2,
ell_width, ell_height, 180 * 64, 90 * 64);
- XDrawArc(XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XDrawArc(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x2, dc->w.DCOrgY + y2,
ell_width, ell_height, 270 * 64, 90 * 64);
- XDrawArc(XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XDrawArc(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x2, dc->w.DCOrgY + y1,
ell_width, ell_height, 0, 90 * 64);
}
@@ -423,9 +423,9 @@
pixel = COLOR_ToPhysical( dc, color );
GetPaletteEntries( dc->w.hPalette, pixel, 1, &entry );
- XSetForeground( XT_display, dc->u.x.gc, pixel );
- XSetFunction( XT_display, dc->u.x.gc, GXcopy );
- XDrawPoint( XT_display, dc->u.x.drawable, dc->u.x.gc, x, y );
+ XSetForeground( display, dc->u.x.gc, pixel );
+ XSetFunction( display, dc->u.x.gc, GXcopy );
+ XDrawPoint( display, dc->u.x.drawable, dc->u.x.gc, x, y );
return RGB( entry.peRed, entry.peGreen, entry.peBlue );
}
@@ -450,13 +450,13 @@
{
XWindowAttributes win_attr;
- if (!XGetWindowAttributes( XT_display, dc->u.x.drawable, &win_attr ))
+ if (!XGetWindowAttributes( display, dc->u.x.drawable, &win_attr ))
return 0;
if (win_attr.map_state != IsViewable) return 0;
if ((x >= win_attr.width) || (y >= win_attr.height)) return 0;
}
- image = XGetImage( XT_display, dc->u.x.drawable, x, y,
+ image = XGetImage( display, dc->u.x.drawable, x, y,
1, 1, AllPlanes, ZPixmap );
GetPaletteEntries( dc->w.hPalette, XGetPixel( image, 0, 0 ), 1, &entry );
XDestroyImage( image );
@@ -494,7 +494,7 @@
GetClipBox( hdc, &box );
if (DC_SetupGCForBrush( dc ))
- XFillRectangle( XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + box.left, dc->w.DCOrgY + box.top,
box.right-box.left, box.bottom-box.top );
@@ -541,7 +541,7 @@
oldBkMode = SetBkMode(hdc, TRANSPARENT);
if (DC_SetupGCForPen( dc ))
- XDrawRectangle( XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XDrawRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1 );
@@ -601,12 +601,12 @@
if (DC_SetupGCForPen( dc ))
{
for (i = 0; i < count-1; i ++)
- XDrawLine (XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XDrawLine (display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + XLPTODP(dc, pt [i].x),
dc->w.DCOrgY + YLPTODP(dc, pt [i].y),
dc->w.DCOrgX + XLPTODP(dc, pt [i+1].x),
dc->w.DCOrgY + YLPTODP(dc, pt [i+1].y));
- XDrawLine (XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XDrawLine (display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + XLPTODP(dc, pt [count-1].x),
dc->w.DCOrgY + YLPTODP(dc, pt [count-1].y),
dc->w.DCOrgX + XLPTODP(dc, pt [0].x),
@@ -644,12 +644,12 @@
}
points [count] = points [0];
- XFillPolygon( XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XFillPolygon( display, dc->u.x.drawable, dc->u.x.gc,
points, count, Complex, CoordModeOrigin);
if (DC_SetupGCForPen ( dc ))
{
- XDrawLines( XT_display, dc->u.x.drawable, dc->u.x.gc,
+ XDrawLines( display, dc->u.x.drawable, dc->u.x.gc,
points, count, CoordModeOrigin );
}
}
diff --git a/windows/nonclient.c b/windows/nonclient.c
index a717031..45ca0d8 100644
--- a/windows/nonclient.c
+++ b/windows/nonclient.c
@@ -16,6 +16,7 @@
#include "syscolor.h"
static HBITMAP hbitmapClose = 0;
+static HBITMAP hbitmapMDIClose = 0;
static HBITMAP hbitmapMinimize = 0;
static HBITMAP hbitmapMinimizeD = 0;
static HBITMAP hbitmapMaximize = 0;
@@ -287,11 +288,15 @@
static void NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down )
{
RECT rect;
+ WND *wndPtr = WIN_FindWndPtr( hwnd );
HDC hdcMem = CreateCompatibleDC( hdc );
if (hdcMem)
{
NC_GetInsideRect( hwnd, &rect );
- SelectObject( hdcMem, hbitmapClose );
+ if (wndPtr->dwStyle & WS_CHILD)
+ SelectObject( hdcMem, hbitmapMDIClose );
+ else
+ SelectObject( hdcMem, hbitmapClose );
BitBlt( hdc, rect.left, rect.top, SYSMETRICS_CXSIZE,
SYSMETRICS_CYSIZE, hdcMem, 1, 1, down ? NOTSRCCOPY : SRCCOPY );
DeleteDC( hdcMem );
@@ -457,6 +462,8 @@
{
if (!(hbitmapClose = LoadBitmap( 0, MAKEINTRESOURCE(OBM_CLOSE) )))
return;
+ if (!(hbitmapMDIClose = LoadBitmap( 0, MAKEINTRESOURCE(OBM_OLD_CLOSE) )))
+ return;
hbitmapMinimize = LoadBitmap( 0, MAKEINTRESOURCE(OBM_REDUCE) );
hbitmapMinimizeD = LoadBitmap( 0, MAKEINTRESOURCE(OBM_REDUCED) );
hbitmapMaximize = LoadBitmap( 0, MAKEINTRESOURCE(OBM_ZOOM) );
diff --git a/windows/utility.c b/windows/utility.c
index c16616d..a1e0d0e 100644
--- a/windows/utility.c
+++ b/windows/utility.c
@@ -285,113 +285,72 @@
#ifndef WINELIB
INT windows_wsprintf(BYTE *win_stack)
{
- LPSTR lpOutput, lpFormat;
- BYTE *new_stack, *stack_ptr, *ptr;
- int stacklength, result;
+ LPSTR lpOutput, lpFormat, ptr;
+ BYTE new_stack[1024], *stack_ptr;
lpOutput = (LPSTR) *(DWORD*)win_stack;
win_stack += 4;
lpFormat = (LPSTR) *(DWORD*)win_stack;
win_stack += 4;
- /* determine # of bytes pushed on 16-bit stack by checking printf's
- format string */
-
- ptr = lpFormat;
- stacklength = 0;
- do {
- if (*ptr++ != '%')
- continue;
-
- /* skip width/precision */
- while ( *ptr == '-' || *ptr == '+' || *ptr == '.' ||
- *ptr == ' ' || isdigit(*ptr))
- ptr++;
-
- switch(*ptr++) {
- case 'l': ptr++; /* skip next type character */
- stacklength += 4;
- continue;
- case 's':
- stacklength += 4;
- continue;
- case 'c':
- case 'd':
- case 'i':
- case 'u':
- case 'x':
- case 'X':
- stacklength += 2;
- continue;
- default:
- fprintf(stderr, "wsprintf: oops, unknown formattype `%c' used!\n", *ptr);
- }
- } while (*ptr);
-
/* create 32-bit stack for libc's vsprintf() */
- new_stack = malloc(2 * stacklength);
- stack_ptr = new_stack + 2 * stacklength;
- win_stack += stacklength;
- ptr = lpFormat;
- do {
- if (*ptr++ != '%')
+ for (ptr = lpFormat, stack_ptr = new_stack; *ptr; ptr++) {
+ if (*ptr != '%' || *++ptr == '%')
continue;
/* skip width/precision */
- while ( *ptr == '-' || *ptr == '+' || *ptr == '.' ||
- *ptr == ' ' || isdigit(*ptr))
+ while (*ptr == '-' || *ptr == '+' || *ptr == '.' ||
+ *ptr == ' ' || isdigit(*ptr))
ptr++;
- switch(*ptr++) {
+ switch (*ptr++) {
case 's':
- stack_ptr -= 4;
- win_stack -= 4;
*(DWORD*)stack_ptr = *(DWORD*)win_stack;
- continue;
+ stack_ptr += 4;
+ win_stack += 4;
+ break;
case 'l':
- stack_ptr -= 4;
- win_stack -= 4;
*(DWORD*)stack_ptr = *(DWORD*)win_stack;
+ stack_ptr += 4;
+ win_stack += 4;
ptr++; /* skip next type character */
- continue;
+ break;
case 'c':
- stack_ptr -= 4;
- win_stack -= 2;
-/* windows' wsprintf() %c ignores 0's, we replace 0 with 1 to make sure
+/* windows' wsprintf() %c ignores 0's, we replace 0 with SPACE to make sure
that the remaining part of the string isn't ignored by the winapp */
if (*(WORD*)win_stack)
*(DWORD*)stack_ptr = *(WORD*)win_stack;
else
- *(DWORD*)stack_ptr = 1;
- continue;
+ *(DWORD*)stack_ptr = ' ';
+ stack_ptr += 4;
+ win_stack += 2;
+ break;
case 'd':
case 'i':
- stack_ptr -= 4;
- win_stack -= 2;
*(int*)stack_ptr = *(INT*)win_stack;
- continue;
+ stack_ptr += 4;
+ win_stack += 2;
+ break;
case 'u':
case 'x':
case 'X':
- stack_ptr -= 4;
- win_stack -= 2;
*(DWORD*)stack_ptr = *(WORD*)win_stack;
- continue;
+ stack_ptr += 4;
+ win_stack += 2;
+ break;
default:
- stack_ptr -= 4;
- win_stack -= 4;
*(DWORD*)stack_ptr = 0;
+ stack_ptr += 4;
+ win_stack += 4;
fprintf(stderr, "wsprintf: oops, unknown formattype %c used!\n", *ptr);
+ break;
}
- } while (*ptr);
+ }
- result = vsprintf(lpOutput, lpFormat, stack_ptr);
- free(new_stack);
-
- return result;
+ return vsprintf(lpOutput, lpFormat, new_stack);
}
#endif
diff --git a/windows/win.c b/windows/win.c
index 572dfe6..cbd72f2 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -444,6 +444,9 @@
WIN_SendParentNotify( hwnd, WM_CREATE, MAKELONG( hwnd, wndPtr->wIDmenu ) );
if (style & WS_VISIBLE) ShowWindow( hwnd, SW_SHOW );
+#ifdef DEBUG_WIN
+ printf( "CreateWindowEx: return %04X \n", hwnd);
+#endif
return hwnd;
}
diff --git a/windows/winpos.c b/windows/winpos.c
index f236d49..98cfa11 100644
--- a/windows/winpos.c
+++ b/windows/winpos.c
@@ -230,7 +230,7 @@
int swpflags = 0;
#ifdef DEBUG_WIN
- printf("ShowWindow: hwnd=%d, cmd=%d\n", hwnd, cmd);
+ printf("ShowWindow: hwnd=%04X, cmd=%d\n", hwnd, cmd);
#endif
if (!wndPtr) return FALSE;
@@ -456,7 +456,7 @@
int changeMask = 0;
#ifdef DEBUG_WIN
- printf( "SetWindowPos: %d %d %d,%d %dx%d 0x%x\n",
+ printf( "SetWindowPos: %04X %d %d,%d %dx%d 0x%x\n",
hwnd, hwndInsertAfter, x, y, cx, cy, flags );
#endif
@@ -592,10 +592,14 @@
}
changeMask |= CWStackMode;
}
- if (changeMask) XConfigureWindow( display, wndPtr->window,
- changeMask, &winChanges );
+ if ((newWindowRect.right - newWindowRect.left) != 0 &&
+ (newWindowRect.bottom - newWindowRect.top) != 0)
+ if (changeMask) XConfigureWindow( display, wndPtr->window,
+ changeMask, &winChanges );
- if (winPos->flags & SWP_SHOWWINDOW)
+ if ((newWindowRect.right - newWindowRect.left) != 0 &&
+ (newWindowRect.bottom - newWindowRect.top) != 0 &&
+ (winPos->flags & SWP_SHOWWINDOW))
{
wndPtr->dwStyle |= WS_VISIBLE;
XMapWindow( display, wndPtr->window );