Commit 73450d65 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 940518

Tue May 17 23:03:16 1994 Bob Amstadt (bob@pooh) * [windows/dce.c] Fixed bug with dce initialization that was causing dialog boxes to not be displayed. * [if1632/callback.c] Better fix for bug found by Martin. Sat May 14 19:48:39 1994 Rick Sladkey (jrs@world.std.com) * [ memory/heap.c ] Redirect HEAP_ReAlloc calls with NULL argument to HEAP_Alloc. May 16, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [objects/font.c] Make EnumFonts() calling a callback with dummy fonts ... :-) * [objects/text.c] Add Empty Stub for ExtTextOut(), which temporarely call Textout(). * [if1632/callback.c] Temporarely go around bug in CallWindowProc(), you will see printfs. * [controls/edit.c] Make EDIT controls focused by a mouse click. * [misc/property.c] Bug Fix in function EnumProps(), better use of CallBack16(). * [misc/mmsystem.c] Basic Skelton's for MCI messages dispatching function. Sun May 15 16:15:17 1994 Erik Bos (erik@hacktic.nl) * [windows/utility.c] Added windows_wsprintf() for the emulator, wsprintf() is for libwine. Sat May 14 22:16:40 1994 Rick Sladkey (jrs@world.std.com) * [misc/cursor.c] Fix pointer problems in LoadCursor leading to heap corruption. * [ controls/menu.c ] Fix two NULL dereferencing bugs. Sun May 15 20:07:48 1994 Rick Sladkey (jrs@world.std.com) * [objects/font.c] Fix NULL pointer dereferencing bug in GetCharWidth. * [loader/resource.c] Fix under-allocation of memory in LoadAccelerators. * [windows/class.c] Ignore negative sizes for extra fields in RegisterClass. Sun May 15 06:35:03 1994 David Metcalfe <david@prism.demon.co.uk> * [objects/metafile.c] [include/metafile.h] [include/windows.h] [objects/gdiobj.c] [objects/brush.c] [objects/pen.c] [objects/text.c] [objects/dcvalues.c] [windows/graphics.c] [windows/dc.c] [windows/mapping.c] Beginnings of metafile support. * [misc/file.c] Corrected spelling of _lcreat. * [controls/edit.c] Minor bug fixes.
parent d18872de
----------------------------------------------------------------------
Tue May 17 23:03:16 1994 Bob Amstadt (bob@pooh)
* [windows/dce.c]
Fixed bug with dce initialization that was causing dialog boxes to not
be displayed.
* [if1632/callback.c]
Better fix for bug found by Martin.
Sat May 14 19:48:39 1994 Rick Sladkey (jrs@world.std.com)
* [ memory/heap.c ]
Redirect HEAP_ReAlloc calls with NULL argument to HEAP_Alloc.
May 16, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [objects/font.c]
Make EnumFonts() calling a callback with dummy fonts ... :-)
* [objects/text.c]
Add Empty Stub for ExtTextOut(), which temporarely call Textout().
* [if1632/callback.c]
Temporarely go around bug in CallWindowProc(), you will see printfs.
* [controls/edit.c]
Make EDIT controls focused by a mouse click.
* [misc/property.c]
Bug Fix in function EnumProps(), better use of CallBack16().
* [misc/mmsystem.c]
Basic Skelton's for MCI messages dispatching function.
Sun May 15 16:15:17 1994 Erik Bos (erik@hacktic.nl)
* [windows/utility.c]
Added windows_wsprintf() for the emulator, wsprintf() is
for libwine.
Sat May 14 22:16:40 1994 Rick Sladkey (jrs@world.std.com)
* [misc/cursor.c]
Fix pointer problems in LoadCursor leading to heap corruption.
* [ controls/menu.c ]
Fix two NULL dereferencing bugs.
Sun May 15 20:07:48 1994 Rick Sladkey (jrs@world.std.com)
* [objects/font.c]
Fix NULL pointer dereferencing bug in GetCharWidth.
* [loader/resource.c]
Fix under-allocation of memory in LoadAccelerators.
* [windows/class.c]
Ignore negative sizes for extra fields in RegisterClass.
Sun May 15 06:35:03 1994 David Metcalfe <david@prism.demon.co.uk>
* [objects/metafile.c] [include/metafile.h] [include/windows.h]
[objects/gdiobj.c] [objects/brush.c] [objects/pen.c]
[objects/text.c] [objects/dcvalues.c] [windows/graphics.c]
[windows/dc.c] [windows/mapping.c]
Beginnings of metafile support.
* [misc/file.c]
Corrected spelling of _lcreat.
* [controls/edit.c]
Minor bug fixes.
----------------------------------------------------------------------
May 9, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [controls/scroll.c]
......
......@@ -61,6 +61,7 @@ EMUOBJS = \
debugger.o \
memory.o \
miscemu.o \
opcodes.o \
readline.o
LIBOBJS = \
......@@ -97,3 +98,6 @@ NormalLibraryTarget(wine,$(LIBOBJS) $(COMMONOBJS))
depend::
install::
etags::
etags `find . -name '*.[chS]'`
\ No newline at end of file
......@@ -171,6 +171,13 @@ bob@amscons.com
7. WHAT'S NEW
WHAT'S NEW with Wine-940518: (see ChangeLog for details)
- debugger improvements
- bug fixes to get some dialog boxes working.
- skeleton for passing MCI functions.
- beginnings of metafile support.
- and many many bug fixes!
WHAT'S NEW with Wine-940510: (see ChangeLog for details)
- debugger improvements
- mmsystem
......
......@@ -309,6 +309,7 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
break;
case WM_KEYDOWN:
printf("EDIT WM_KEYDOWN w=%04X !\n", wParam);
EDIT_KeyDownMsg(hwnd, wParam);
break;
......@@ -319,6 +320,7 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
case WM_LBUTTONDOWN:
HideCaret(hwnd);
SetFocus(hwnd);
EDIT_LButtonDownMsg(hwnd, wParam, lParam);
SetCaretPos(es->WndCol, es->WndRow * es->txtht);
ShowCaret(hwnd);
......@@ -2043,8 +2045,6 @@ void EDIT_SetSelMsg(HWND hwnd, LONG lParam)
WND *wndPtr = WIN_FindWndPtr(hwnd);
EDITSTATE *es = (EDITSTATE *)EDIT_HEAP_ADDR((HANDLE)(*(wndPtr->wExtra)));
if ((short)(lParam) < 0 || (short)(lParam >> 16) < 0)
return;
so = LOWORD(lParam);
eo = HIWORD(lParam);
if (so > eo)
......@@ -2343,7 +2343,7 @@ LONG EDIT_LineFromCharMsg(HWND hwnd, WORD wParam)
WND *wndPtr = WIN_FindWndPtr(hwnd);
EDITSTATE *es = (EDITSTATE *)EDIT_HEAP_ADDR((HANDLE)(*(wndPtr->wExtra)));
if (wParam == 0xffff) /* really -1 */
if (wParam == (WORD)-1)
return (LONG)(es->SelBegLine);
else
EDIT_GetLineCol(hwnd, wParam, &row, &col);
......@@ -2362,7 +2362,7 @@ LONG EDIT_LineIndexMsg(HWND hwnd, WORD wParam)
EDITSTATE *es = (EDITSTATE *)EDIT_HEAP_ADDR((HANDLE)(*(wndPtr->wExtra)));
unsigned int *textPtrs = (unsigned int *)EDIT_HEAP_ADDR(es->hTextPtrs);
if (wParam == 0xffff) /* really -1 */
if (wParam == (WORD)-1)
wParam = es->CurrLine;
return (LONG)(*(textPtrs + wParam));
......
......@@ -502,46 +502,53 @@ void MenuButtonUp(HWND hWnd, LPPOPUPMENU lppop, int x, int y)
void MenuMouseMove(HWND hWnd, LPPOPUPMENU lppop, WORD wParam, int x, int y)
{
HDC hDC;
RECT rect;
HMENU hSubMenu;
LPMENUITEM lpitem, lpitem2;
LPPOPUPMENU lppop2;
WORD wRet;
/* if ((wParam & MK_LBUTTON) != 0) { */
if (GetKeyState(VK_LBUTTON) != 0) {
lpitem = MenuFindItem(lppop, x, y, &wRet);
HDC hDC;
RECT rect;
HMENU hSubMenu;
LPMENUITEM lpitem, lpitem2;
LPPOPUPMENU lppop2;
WORD wRet;
if (GetKeyState(VK_LBUTTON) != 0)
{
lpitem = MenuFindItem(lppop, x, y, &wRet);
#ifdef DEBUG_MENU
printf("MenuMouseMove // x=%d y=%d // wRet=%d lpitem=%08X !\n",
x, y, wRet, lpitem);
#endif
if ((lpitem != NULL) && (lppop->FocusedItem != wRet)) {
lpitem2 = GetMenuItemPtr(lppop, lppop->FocusedItem);
hDC = GetWindowDC(hWnd);
if ((lpitem2->item_flags & MF_POPUP) == MF_POPUP) {
HideAllSubPopupMenu(lppop);
}
MenuItemSelect(hWnd, lppop, wRet);
if ((lpitem->item_flags & MF_POPUP) == MF_POPUP) {
hSubMenu = (HMENU)lpitem->item_id;
lppop2 = (LPPOPUPMENU) GlobalLock(hSubMenu);
if (lppop2 == NULL) {
ReleaseDC(hWnd, hDC);
return;
}
if (lppop->BarFlag) {
lppop2->hWndParent = hWnd;
GetWindowRect(hWnd, &rect);
rect.top += lppop->rect.bottom;
TrackPopupMenu(hSubMenu, TPM_LEFTBUTTON,
rect.left + lpitem->rect.left, rect.top,
0, lppop->ownerWnd, (LPRECT)NULL);
}
GlobalUnlock(hSubMenu);
}
ReleaseDC(hWnd, hDC);
}
printf("MenuMouseMove // x=%d y=%d // wRet=%d lpitem=%08X !\n",
x, y, wRet, lpitem);
#endif
if ((lpitem != NULL) && (lppop->FocusedItem != wRet))
{
lpitem2 = GetMenuItemPtr(lppop, lppop->FocusedItem);
hDC = GetWindowDC(hWnd);
if ((lpitem2 != NULL ) &&
(lpitem2->item_flags & MF_POPUP) == MF_POPUP)
{
HideAllSubPopupMenu(lppop);
}
MenuItemSelect(hWnd, lppop, wRet);
if ((lpitem->item_flags & MF_POPUP) == MF_POPUP)
{
hSubMenu = (HMENU)lpitem->item_id;
lppop2 = (LPPOPUPMENU) GlobalLock(hSubMenu);
if (lppop2 == NULL)
{
ReleaseDC(hWnd, hDC);
return;
}
if (lppop->BarFlag)
{
lppop2->hWndParent = hWnd;
GetWindowRect(hWnd, &rect);
rect.top += lppop->rect.bottom;
TrackPopupMenu(hSubMenu, TPM_LEFTBUTTON,
rect.left + lpitem->rect.left, rect.top,
0, lppop->ownerWnd, (LPRECT)NULL);
}
GlobalUnlock(hSubMenu);
}
ReleaseDC(hWnd, hDC);
}
}
}
......@@ -562,38 +569,46 @@ void ResetHiliteFlags(LPPOPUPMENU lppop)
void MenuItemSelect0(HWND hWnd, LPPOPUPMENU lppop,
LPMENUITEM lpitem, WORD wIndex)
{
LPMENUITEM lpprev;
if (lppop == NULL) return;
if (lppop->FocusedItem != (WORD)-1) {
lpprev = GetMenuItemPtr(lppop, lppop->FocusedItem);
if (lpprev != NULL) {
lpprev->item_flags &= MF_HILITE ^ 0xFFFF;
if ((lpprev->item_flags & MF_POPUP) == MF_POPUP)
HideAllSubPopupMenu(lppop);
if (lppop->BarFlag)
DrawMenuBar(hWnd);
else {
InvalidateRect(hWnd, &lpprev->rect, TRUE);
UpdateWindow(hWnd);
}
}
}
LPMENUITEM lpprev;
if (lppop == NULL)
return;
if (lppop->FocusedItem != (WORD)-1)
{
lpprev = GetMenuItemPtr(lppop, lppop->FocusedItem);
if (lpprev != NULL)
{
lpprev->item_flags &= MF_HILITE ^ 0xFFFF;
if ((lpprev->item_flags & MF_POPUP) == MF_POPUP)
HideAllSubPopupMenu(lppop);
if (lppop->BarFlag)
DrawMenuBar(hWnd);
else
{
InvalidateRect(hWnd, &lpprev->rect, TRUE);
UpdateWindow(hWnd);
}
}
}
lppop->FocusedItem = wIndex;
if (lpitem == NULL || wIndex == (WORD)-1) {
ResetHiliteFlags(lppop);
if (lppop->BarFlag) DrawMenuBar(hWnd);
}
else {
lpitem->item_flags |= MF_HILITE;
if (lppop->BarFlag)
DrawMenuBar(hWnd);
else {
InvalidateRect(hWnd, &lpitem->rect, TRUE);
UpdateWindow(hWnd);
}
}
if (lpitem == NULL || wIndex == (WORD)-1)
{
ResetHiliteFlags(lppop);
if (lppop->BarFlag) DrawMenuBar(hWnd);
}
else
{
lpitem->item_flags |= MF_HILITE;
if (lppop->BarFlag)
DrawMenuBar(hWnd);
else
{
InvalidateRect(hWnd, &lpitem->rect, TRUE);
UpdateWindow(hWnd);
}
SendMessage(hWnd, WM_MENUSELECT, lpitem->item_id,
MAKELONG(0, lpitem->item_flags));
MAKELONG(0, lpitem->item_flags));
}
}
......@@ -1984,7 +1999,6 @@ BOOL SetMenu(HWND hWnd, HMENU hMenu)
return FALSE;
}
lpmenu->ownerWnd = hWnd;
printf("SetMenu(%04X, %04X) // %04X\n", hWnd, hMenu, lpmenu->ownerWnd);
ResetHiliteFlags(lpmenu);
if (GetCapture() == hWnd) ReleaseCapture();
GlobalUnlock(hMenu);
......
......@@ -5,32 +5,23 @@
MODULE = debugger
SUBDIRS = readline
SUBDIRS = opcodes readline
DEFINES = -DUSE_READLINE
/* Quick and dirt hack, since i386 is defined as 1. sigh */
#define temp i386
#undef i386
DEFINES = -DUSE_READLINE -Iopcodes
SRCS = \
dbg.tab.c \
break.c \
hash.c \
lex.yy.c \
info.c \
i386-pinsn.c
info.c
OBJS = \
dbg.tab.o \
break.o \
hash.o \
lex.yy.o \
info.o \
i386-pinsn.o
#define i386 temp
#undef temp
info.o
/*
* All the SUBDIR stuff
......
......@@ -19,7 +19,8 @@ unsigned int * regval = NULL;
unsigned int dbg_mask = 0;
unsigned int dbg_mode = 0;
void issue_prompt();
void issue_prompt(void);
void mode_command(int);
%}
......@@ -50,7 +51,7 @@ void issue_prompt();
line: '\n'
| infocmd '\n'
| error '\n' {yyerrok; }
| error '\n' { yyerrok; }
| QUIT '\n' { exit(0); };
| HELP '\n' { dbg_help(); };
| CONT '\n' { return; };
......@@ -161,6 +162,7 @@ wine_debug(int signal, int * regs)
dbg_mode = 16;
};
#endif
fprintf(stderr,"In %d bit mode.\n", dbg_mode);
/* This is intended to read the entry points from the Windows image, and
insert them in the hash table. It does not work yet, so it is commented out. */
......
......@@ -5,33 +5,23 @@
*/
#include <stdio.h>
#include "opcodes/dis-asm.h"
#include "regpos.h"
extern int * regval;
extern unsigned int dbg_mask;
extern unsigned int dbg_mode;
extern int print_insn(char * memaddr, char * realaddr, FILE * stream, int addrlen);
/* THese three helper functions eliminate the need for patching the
module from gdb for disassembly of code */
void application_not_running()
{
fprintf(stderr,"Application not running\n");
}
void read_memory(char * memaddr, char * buffer, int len){
memcpy(buffer, memaddr, len);
}
void fputs_filtered(char * buffer, FILE * outfile){
fputs(buffer, outfile);
}
void print_address(unsigned int addr, FILE * outfile){
char * name;
name = find_nearest_symbol(addr);
extern char * find_nearest_symbol(unsigned int *);
name = find_nearest_symbol((unsigned int *) addr);
if(name)
fprintf(outfile,"0x%8.8x(%s)", addr, name);
else
......@@ -39,12 +29,36 @@ void print_address(unsigned int addr, FILE * outfile){
}
void print_address_info(bfd_vma addr, disassemble_info * info){
print_address((unsigned int) addr, info->stream);
}
int print_insn(char *realmemaddr, char *memaddr, FILE *stream, int addrlen){
static disassemble_info info;
static int initialized = 0;
if (!initialized) {
INIT_DISASSEMBLE_INFO(info, stderr);
info.print_address_func = print_address_info;
initialized = 1;
}
info.stream = stream;
info.buffer = memaddr;
info.buffer_vma = (bfd_vma) realmemaddr;
info.buffer_length = 1024;
if (addrlen == 16)
return print_insn_i286((bfd_vma) realmemaddr, &info);
if (addrlen == 32)
return print_insn_i386((bfd_vma) realmemaddr, &info);
fprintf(stderr, "invalid address length %d.\n", addrlen);
return 0;
}
void info_reg(){
if(!regval) {
application_not_running();
return 0;
return;
}
fprintf(stderr,"Register dump:\n");
......@@ -73,7 +87,7 @@ void info_stack(){
if(!regval) {
application_not_running();
return 0;
return;
}
fprintf(stderr,"Stack dump:\n");
......@@ -234,10 +248,7 @@ char * helptext[] = {
"",
"The disassembly code seems to work most of the time, but it does get",
"a little confused at times. The 16 bit mode probably has not been used",
"much so there are probably bugs. I snagged the file from the gdb-4.7",
"source tree, which is what was on my latest cdrom. I should check to see",
"if newer versions of gdb have anything substanitally different for the",
"disassembler.",
"much so there are probably bugs.",
"",
NULL};
......@@ -271,7 +282,7 @@ void dbg_bt(){
if(!regval) {
application_not_running();
return 0;
return;
}
fprintf(stderr,"Backtrace:\n");
......
static char RCSId[] = "$Id: wine.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
#include "windows.h"
#include "callback.h"
#include "wine.h"
......@@ -143,9 +145,39 @@ LONG CallWindowProc( FARPROC func, HWND hwnd, WORD message,
WORD wParam, LONG lParam )
{
SpyMessage(hwnd, message, wParam, lParam);
if (Is16bitAddress(func))
if (HIWORD((LONG)func) == WINE_CODE_SELECTOR)
{
static struct dll_table_entry_s *user_tab = NULL;
void *address = (void *) ((LONG) func & 0xffff);
if (user_tab == NULL)
user_tab = FindDLLTable("USER");
/* DefWindowProc */
if (user_tab[104].address == address)
return DefWindowProc(hwnd, message, wParam, lParam);
/* DefDlgProc */
else if (user_tab[308].address == address)
return DefDlgProc(hwnd, message, wParam, lParam);
/* DefMDIChildProc */
else if (user_tab[447].address == address)
return DefMDIChildProc(hwnd, message, wParam, lParam);
/* default */
else
{
fprintf(stderr, "wine: Unknown wine callback %08x\n", func);
exit(1);
}
}
else if (Is16bitAddress(func))
{
#ifdef DEBUG_CALLBACK
printf("CallWindowProc // 16bit func=%08X !\n", func);
#endif
PushOn16( CALLBACK_SIZE_WORD, hwnd );
PushOn16( CALLBACK_SIZE_WORD, message );
PushOn16( CALLBACK_SIZE_WORD, wParam );
......@@ -155,6 +187,9 @@ LONG CallWindowProc( FARPROC func, HWND hwnd, WORD message,
}
else
{
#ifdef DEBUG_CALLBACK
printf("CallWindowProc // 32bit func=%08X !\n", func);
#endif
return (*func)(hwnd, message, wParam, lParam);
}
}
......
......@@ -129,9 +129,9 @@ length 490
#122 pascal ReSurRection
#123 pascal PlayMetaFile
#124 pascal GetMetaFile
#125 pascal CreateMetaFile
#126 pascal CloseMetaFile
#127 pascal DeleteMetaFile
125 pascal CreateMetaFile(ptr) CreateMetaFile(1)
126 pascal CloseMetaFile(word) CloseMetaFile(1)
127 pascal DeleteMetaFile(word) DeleteMetaFile(1)
128 pascal MulDiv(s_word s_word s_word) MulDiv(1 2 3)
129 pascal SaveVisRgn(word) SaveVisRgn(1)
130 pascal RestoreVisRgn(word) RestoreVisRgn(1)
......@@ -219,7 +219,7 @@ length 490
#312 pascal CONVERTOUTLINEFONTFILE
#313 pascal GETRASTERIZERCAPS
#314 pascal ENGINEEXTTEXTOUT
#330 pascal ENUMFONTFAMILIES
330 pascal EnumFontFamilies(word ptr ptr ptr) EnumFontFamilies(1 2 3 4)
#332 pascal GETKERNINGPAIRS
345 pascal GetTextAlign(word) GetTextAlign(1)
346 pascal SetTextAlign(word word) SetTextAlign(1 2)
......@@ -227,7 +227,8 @@ length 490
Chord(1 2 3 4 5 6 7 8 9)
349 pascal SetMapperFlags(word word) SetMapperFlags(1 2)
350 pascal GetCharWidth(word word word ptr) GetCharWidth(1 2 3 4)
#351 pascal EXTTEXTOUT
351 pascal ExtTextOut(word s_word s_word word ptr ptr s_word ptr)
ExtTextOut(1 2 3 4 5 6 7 8)
#352 pascal GETPHYSICALFONTHANDLE
#353 pascal GETASPECTRATIOFILTER
#354 pascal SHRINKGDIHEAP
......
......@@ -81,7 +81,7 @@ length 415
#80 RESERVED4
81 pascal _lclose(word) _lclose(1)
82 pascal _lread(word ptr word) _lread(1 2 3)
83 pascal _lcreate(ptr word) _lcreate(1 2)
83 pascal _lcreat(ptr word) _lcreat(1 2)
84 pascal _llseek(word long word) _llseek(1 2 3)
85 pascal _lopen(ptr word) _lopen(1 2)
86 pascal _lwrite(word ptr word) _lwrite(1 2 3)
......
add $8,%esp
popw %es
add $2,%esp
popw %ds
add $2,%esp
popl %edi
popl %esi
popl %ebp
add $4,%esp
popl %ebx
popl %edx
popl %ecx
popl %eax
add $16,%esp
popfl
add $20,%esp
......@@ -9,33 +9,33 @@ length 103
# proper parameters. It's just to have stub for PROGMAN.EXE ...
#
1 pascal RegOpenKey() RegOpenKey()
2 pascal RegCreateKey() RegCreateKey()
3 pascal RegCloseKey() RegCloseKey()
4 pascal RegDeleteKey() RegDeleteKey()
9 pascal DragAcceptFiles() DragAcceptFiles()
20 pascal ShellExecute(ptr) ShellExecute(1)
1 pascal RegOpenKey(word ptr ptr) RegOpenKey(1 2 3)
2 pascal RegCreateKey(word ptr ptr) RegCreateKey(1 2 3)
3 pascal RegCloseKey(word) RegCloseKey(1)
4 pascal RegDeleteKey(word ptr) RegDeleteKey(1 2)
5 pascal RegSetValue(word ptr long ptr long) RegSetValue(1 2 3 4 5)
6 pascal RegQueryValue(word ptr ptr ptr) RegQueryValue(1 2 3 4)
7 pascal RegEnumKey(word long ptr long) RegEnumKey(1 2 3 4)
9 pascal DragAcceptFiles(word word) DragAcceptFiles(1 2)
11 pascal DragQueryFile(word s_word ptr s_word) DragQueryFile(1 2 3 4)
12 pascal DragFinish(word) DragFinish(1)
13 pascal DragQueryPoint(word ptr) DragQueryPoint(1 2)
20 pascal ShellExecute(word ptr ptr ptr ptr s_word) ShellExecute(1 2 3 4 5 6)
21 pascal FindExecutable(ptr ptr ptr) FindExecutable(1 2 3)
22 pascal ShellAbout(word ptr ptr word) ShellAbout(1 2 3 4)
33 pascal AboutDlgProc(word word word long) AboutDlgProc(1 2 3 4)
34 pascal ExtractIcon(word ptr s_word) ExtractIcon(1 2 3)
102 pascal RegisterShellHook(ptr) RegisterShellHook(1)
103 pascal ShellHookProc() ShellHookProc()
# 8 7 0000 WEP exported, shared data
# 33 9 0136 ABOUTDLGPROC exported, shared data
# 34 10 021a EXTRACTICON exported, shared data
# 21 4 1154 FINDEXECUTABLE exported, shared data
#100 4 0550 HERETHARBETYGARS exported, shared data
# 38 5 0000 FINDENVIRONMENTSTRING exported, shared data
# 7 2 14dc REGENUMKEY exported, shared data
# 37 5 00ae DOENVIRONMENTSUBST exported, shared data
# 20 4 110a SHELLEXECUTE exported, shared data
#101 8 010e FINDEXEDLGPROC exported, shared data
# 11 6 0094 DRAGQUERYFILE exported, shared data
# 13 6 0000 DRAGQUERYPOINT exported, shared data
# 5 2 16f4 REGSETVALUE exported, shared data
# 39 10 026e INTERNALEXTRACTICON exported, shared data
# 22 9 0000 SHELLABOUT exported, shared data
# 6 2 168e REGQUERYVALUE exported, shared data
# 32 9 0829 WCI exported, shared data
# 36 10 08dc EXTRACTASSOCIATEDICON exported, shared data
# 12 6 0142 DRAGFINISH exported, shared data
......@@ -108,6 +108,7 @@ length 540
102 pascal AdjustWindowRect(ptr long word) AdjustWindowRect(1 2 3)
103 pascal MapDialogRect(word ptr) MapDialogRect(1 2)
104 pascal MessageBeep(word) MessageBeep(1)
105 pascal FlashWindow(word word) FlashWindow(1 2)
106 pascal GetKeyState(word) GetKeyState(1)
107 pascal DefWindowProc(word word word long) DefWindowProc(1 2 3 4)
108 pascal GetMessage(ptr word word word) GetMessage(1 2 3 4)
......@@ -357,7 +358,9 @@ length 540
417 pascal GetMenuCheckMarkDimensions() GetMenuCheckMarkDimensions()
418 pascal SetMenuItemBitmaps(word word word word word)
SetMenuItemBitmaps(1 2 3 4 5)
420 pascal wsprintf(ptr ptr) wsprintf(1 2)
420 pascal wsprintf() windows_wsprintf()
# windows_wsprintf() handles arguments itself, as libc can't handle an
# 16-bit stack. DLLRelay() will pass 16-bit stack pointer as 1st arg.
421 pascal wvsprintf(ptr ptr ptr) wvsprintf(1 2 3)
#422 DLGDIRSELECTEX
#423 DLGDIRSELECTCOMBOBOXEX
......
......@@ -60,16 +60,18 @@ extern LHEAP *HEAP_LocalFindHeap(unsigned short owner);
*/
typedef struct global_mem_desc_s
{
struct global_mem_desc_s *next;
struct global_mem_desc_s *prev;
unsigned short handle;
short sequence;
void *addr;
int length;
int lock_count;
void *linear_addr;
int linear_key;
int linear_count;
struct global_mem_desc_s *next; /* Next GDESC in list */
struct global_mem_desc_s *prev; /* Previous GDESC in list */
unsigned short handle; /* Handle of this block. */
short sequence; /* Block sequence # in huge block */
void *addr; /* Address allocated with mmap() */
int length; /* Length of block */
int lock_count; /* Block lock count */
unsigned short alias; /* Offset-zero alias selector */
unsigned int alias_key; /* Offset-zero alias sh. mem. key */
void *linear_addr; /* Linear address of huge block */
int linear_key; /* Linear shared memory key */
int linear_count; /* Linear lock count */
} GDESC;
extern GDESC *GlobalList;
......
......@@ -6,6 +6,8 @@
#ifndef SEGMEM_H
#define SEGMEM_H
#include "wine.h"
#ifdef __linux__
#define HAVE_IPC
#include <sys/ipc.h>
......@@ -77,13 +79,10 @@ extern int IPCCopySelector(int i_old, unsigned long new, int swap_type);
static __inline__ int Is16bitAddress(void *address)
{
return ((int) address >= (((FIRST_SELECTOR << 3) | 0x0007) << 16));
return ((unsigned int) address
>= (((FIRST_SELECTOR << 3) | 0x0007) << 16));
}
extern SEGDESC Segments[];
#endif /* SEGMEM_H */
......@@ -45,7 +45,7 @@ DECLARE_HANDLE(HMENU);
DECLARE_HANDLE(HBITMAP);
DECLARE_HANDLE(HBRUSH);
DECLARE_HANDLE(LOCALHANDLE);
DECLARE_HANDLE(HMETAFILE);
#define TRUE 1
#define FALSE 0
......@@ -850,14 +850,6 @@ typedef struct tagLOGPEN
#define ALTERNATE 1
#define WINDING 2
typedef struct {
DWORD rdSize;
WORD rdFunction, rdParam[1];
} METARECORD;
typedef METARECORD *LPMETARECORD;
typedef METARECORD *NPMETARECORD;
typedef METARECORD *PMETARECORD;
/* Background modes */
#define TRANSPARENT 1
#define OPAQUE 2
......@@ -1334,12 +1326,6 @@ typedef struct tagCOMSTAT
#define WF_PAGING 0x0800
#define WF_WLO 0x8000
typedef struct
{
HANDLE objectHandle[1];
}HANDLETABLE;
typedef HANDLETABLE *LPHANDLETABLE;
#define MAKEINTRESOURCE(i) (LPSTR)((DWORD)((WORD)(i)))
#define IDI_APPLICATION MAKEINTRESOURCE(32512)
......@@ -2240,6 +2226,126 @@ typedef COMPAREITEMSTRUCT FAR* LPCOMPAREITEMSTRUCT;
#define WM_ASKCBFORMATNAME 0x030C
#define WM_CHANGECBCHAIN 0x030D
/* Metafile header structure */
typedef struct tagMETAHEADER
{
WORD mtType;
WORD mtHeaderSize;
WORD mtVersion;
DWORD mtSize __attribute__ ((packed));
WORD mtNoObjects;
DWORD mtMaxRecord __attribute__ ((packed));
WORD mtNoParameters;
} METAHEADER;
/* Metafile typical record structure */
typedef struct tagMETARECORD
{
DWORD rdSize;
WORD rdFunction;
WORD rdParam[1];
} METARECORD;
typedef METARECORD *PMETARECORD;
typedef METARECORD *LPMETARECORD;
/* Handle table structure */
typedef struct tagHANDLETABLE
{
HANDLE objectHandle[1];
} HANDLETABLE;
typedef HANDLETABLE *PHANDLETABLE;
typedef HANDLETABLE *LPHANDLETABLE;
/* Clipboard metafile picture structure */
typedef struct tagMETAFILEPICT
{
int mm;
int xExt;
int yExt;
HMETAFILE hMF;
} METAFILEPICT;
typedef METAFILEPICT *LPMETAFILEPICT;
/* Metafile functions */
#define META_SETBKCOLOR 0x0201
#define META_SETBKMODE 0x0102
#define META_SETMAPMODE 0x0103
#define META_SETROP2 0x0104
#define META_SETRELABS 0x0105
#define META_SETPOLYFILLMODE 0x0106
#define META_SETSTRETCHBLTMODE 0x0107
#define META_SETTEXTCHAREXTRA 0x0108
#define META_SETTEXTCOLOR 0x0209
#define META_SETTEXTJUSTIFICATION 0x020A
#define META_SETWINDOWORG 0x020B
#define META_SETWINDOWEXT 0x020C
#define META_SETVIEWPORTORG 0x020D
#define META_SETVIEWPORTEXT 0x020E
#define META_OFFSETWINDOWORG 0x020F
#define META_SCALEWINDOWEXT 0x0410
#define META_OFFSETVIEWPORTORG 0x0211
#define META_SCALEVIEWPORTEXT 0x0412
#define META_LINETO 0x0213
#define META_MOVETO 0x0214
#define META_EXCLUDECLIPRECT 0x0415
#define META_INTERSECTCLIPRECT 0x0416
#define META_ARC 0x0817
#define META_ELLIPSE 0x0418
#define META_FLOODFILL 0x0419
#define META_PIE 0x081A
#define META_RECTANGLE 0x041B
#define META_ROUNDRECT 0x061C
#define META_PATBLT 0x061D
#define META_SAVEDC 0x001E
#define META_SETPIXEL 0x041F
#define META_OFFSETCLIPRGN 0x0220
#define META_TEXTOUT 0x0521
#define META_BITBLT 0x0922
#define META_STRETCHBLT 0x0B23
#define META_POLYGON 0x0324
#define META_POLYLINE 0x0325
#define META_ESCAPE 0x0626
#define META_RESTOREDC 0x0127
#define META_FILLREGION 0x0228
#define META_FRAMEREGION 0x0429
#define META_INVERTREGION 0x012A
#define META_PAINTREGION 0x012B
#define META_SELECTCLIPREGION 0x012C
#define META_SELECTOBJECT 0x012D
#define META_SETTEXTALIGN 0x012E
#define META_DRAWTEXT 0x062F
#define META_CHORD 0x0830
#define META_SETMAPPERFLAGS 0x0231
#define META_SETTEXTOUT 0x0A32
#define META_SETDIBTODEV 0x0D33
#define META_SELECTPALETTE 0x0234
#define META_REALIZEPALETTE 0x0035
#define META_ANIMATEPALETTE 0x0436
#define META_SETPALENTRIES 0x0037
#define META_POLYPOLYGON 0x0538
#define META_RESIZEPALETTE 0x0139
#define META_DIBBITBLT 0x0940
#define META_DIBSTRETCHBLT 0x0B41
#define META_DIBCREATEPATTERNBRUSH 0x0142
#define META_STRETCHDIB 0x0F43
#define META_EXTFLOODFILL 0x0548
#define META_RESETDC 0x014C
#define META_STARTDOC 0x014D
#define META_STARTPAGE 0x004F
#define META_ENDPAGE 0x0050
#define META_ABORTDOC 0x0052
#define META_ENDDOC 0x005E
#define META_DELETEOBJECT 0x01F0
#define META_CREATEPALETTE 0x00F7
#define META_CREATEBRUSH 0x00F8
#define META_CREATEPATTERNBRUSH 0x01F9
#define META_CREATEPENINDIRECT 0x02FA
#define META_CREATEFONTINDIRECT 0x02FB
#define META_CREATEBRUSHINDIRECT 0x02FC
#define META_CREATEBITMAPINDIRECT 0x02FD
#define META_CREATEBITMAP 0x06FE
#define META_CREATEREGION 0x06FF
#define F(ret,name) ret name(void);
#define Fa(ret,name,t1,a1) ret name(t1 a1);
......@@ -2338,7 +2444,7 @@ Fa(ATOM,GlobalDeleteAtom,ATOM,a)
Fa(ATOM,GlobalFindAtom,LPCSTR,a)
Fa(BOOL,BringWindowToTop,HWND,a)
Fa(BOOL,DeleteDC,HDC,a)
Fa(BOOL,DeleteMetaFile,HANDLE,a)
Fa(BOOL,DeleteMetaFile,HMETAFILE,a)
Fa(BOOL,DeleteObject,HANDLE,a)
Fa(BOOL,DestroyCursor,HCURSOR,a)
Fa(BOOL,DestroyIcon,HICON,a)
......@@ -2392,7 +2498,7 @@ Fa(DWORD,GlobalSize,HANDLE,a)
Fa(DWORD,OemKeyScan,WORD,a)
Fa(FARPROC,LocalNotify,FARPROC,a)
Fa(HANDLE,BeginDeferWindowPos,int,nNumWindows)
Fa(HANDLE,CloseMetaFile,HANDLE,a)
Fa(HMETAFILE,CloseMetaFile,HANDLE,a)
Fa(HANDLE,CreateMetaFile,LPSTR,a)
Fa(HANDLE,GetAtomHandle,ATOM,a)
Fa(HANDLE,GetClipboardData,WORD,a)
......@@ -2680,8 +2786,8 @@ Fb(void,ValidateRgn,HWND,a,HRGN,b)
Fc(BOOL,LineTo,HDC,a,short,b,short,c)
Fc(WORD,GetInternalWindowPos,HWND,a,LPRECT,b,LPPOINT,c)
Fc(LONG,_llseek,INT,a,LONG,b,INT,c)
Fc(WORD,_lread,INT,a,LPSTR,b,INT,c)
Fc(WORD,_lwrite,INT,a,LPSTR,b,INT,c)
Fc(INT,_lread,INT,a,LPSTR,b,INT,c)
Fc(INT,_lwrite,INT,a,LPSTR,b,INT,c)
Fc(int,FillRect,HDC,a,LPRECT,b,HBRUSH,c)
Fc(DWORD,MoveTo,HDC,a,short,b,short,c)
Fc(BOOL,CheckMenuItem,HMENU,a,WORD,b,WORD,c)
......@@ -2896,7 +3002,7 @@ Fg(HICON,CreateIcon,HANDLE,a,int,b,int,c,BYTE,d,BYTE,e,LPSTR,f,LPSTR,g)
Fg(int,GetDIBits,HDC,a,HANDLE,a2,WORD,b,WORD,c,LPSTR,d,LPBITMAPINFO,e,WORD,f)
Fg(int,SetDIBits,HDC,a,HANDLE,a2,WORD,b,WORD,c,LPSTR,d,LPBITMAPINFO,e,WORD,f)
Fg(BOOL,SetWindowPos,HWND,a,HWND,b,short,c,short,d,short,e,short,f,WORD,g)
Fh(BOOL,ExtTextOut,HDC,a,int,b,int,c,WORD,d,LPRECT,e,LPSTR,f,WORD,g,LPINT,h)
Fh(BOOL,ExtTextOut,HDC,a,short,b,short,c,WORD,d,LPRECT,e,LPSTR,f,WORD,g,LPINT,h)
Fh(HANDLE,DeferWindowPos,HANDLE,hWinPosInfo,HWND,hWnd,HWND,hWndInsertAfter,int,x,int,y,int,cx,int,cy,WORD,wFlags)
Fh(LONG,TabbedTextOut,HDC,a,int,b,int,c,LPSTR,d,int,e,int,f,LPINT,g,int,h)
Fh(int,ScrollWindowEx,HWND,a,short,b,short,c,LPRECT,d,LPRECT,e,HRGN,f,LPRECT,g,WORD,h)
......
......@@ -117,6 +117,7 @@ HANDLE LoadLibrary(LPSTR libname)
if (FindDLLTable(libname))
{
printf("Library was a builtin - returning 0x23\n");
return WINE_CODE_SELECTOR;
}
......
......@@ -573,7 +573,7 @@ HANDLE LoadAccelerators(HANDLE instance, LPSTR lpTableName)
HANDLE rsc_mem;
BYTE *lp;
ACCELHEADER *lpAccelTbl;
int i, image_size;
int i, image_size, n;
#ifdef DEBUG_ACCEL
if (((LONG)lpTableName & 0xFFFF0000L) == 0L)
printf("LoadAccelerators: instance = %04X, name = %08X\n",
......@@ -597,11 +597,12 @@ HANDLE LoadAccelerators(HANDLE instance, LPSTR lpTableName)
#ifdef DEBUG_ACCEL
printf("LoadAccelerators / image_size=%d\n", image_size);
#endif
n = image_size/5;
hAccel = GlobalAlloc(GMEM_MOVEABLE,
sizeof(ACCELHEADER) + sizeof(ACCELENTRY) + image_size);
sizeof(ACCELHEADER) + (n + 1)*sizeof(ACCELENTRY));
lpAccelTbl = (LPACCELHEADER)GlobalLock(hAccel);
lpAccelTbl->wCount = 0;
for (i = 0; ; i++) {
for (i = 0; i < n; i++) {
lpAccelTbl->tbl[i].type = *(lp++);
lpAccelTbl->tbl[i].wEvent = *((WORD *)lp);
lp += 2;
......@@ -895,6 +896,10 @@ LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen)
buffer[i] = '\0';
}
else {
if (buflen > 1) {
buffer[0] = '\0';
return 0;
}
printf("LoadString // I dont know why , but caller give buflen=%d *p=%d !\n", buflen, *p);
printf("LoadString // and try to obtain string '%s'\n", p + 1);
}
......
......@@ -102,14 +102,14 @@ BOOL EnumTaskWindows(HANDLE hTask, FARPROC lpEnumFunc, LONG lParam)
printf("EnumTaskWindows // found hTask=%04X !\n", hTask);
wptr = lpTask->lpWndList;
if (wptr == NULL) return FALSE;
if (lpEnumFunc == NULL) return FALSE;
while ((hWnd = *(wptr++)) != 0) {
if (++count >= MAXWIN_PER_TASK) return FALSE;
printf("EnumTaskWindows // hWnd=%04X count=%d !\n", hWnd, count);
#ifdef WINELIB
if (lpEnumFunc != NULL) bRet = (*lpEnumFunc)(hWnd, lParam);
bRet = (*lpEnumFunc)(hWnd, lParam);
#else
if (lpEnumFunc != NULL)
bRet = CallBack16(lpEnumFunc, 2, lParam, (int) hWnd);
bRet = CallBack16(lpEnumFunc, 2, 0, (int)hWnd, 2, (int)lParam);
#endif
if (bRet == 0) break;
}
......
......@@ -103,18 +103,20 @@ GlobalGetFreeSegments(unsigned int flags, int n_segments)
for (count = 0; count < n_segments; count++, s++)
{
g = (GDESC *) malloc(sizeof(*g));
if (g == NULL) {
if (g == NULL)
{
printf("GlobalGetFreeSegments // bad GDESC malloc !\n");
return NULL;
}
g->prev = g_prev;
g->next = NULL;
g->handle = s->selector;
g->sequence = -1;
g->addr = s->base_addr;
g->length = s->length;
g->linear_addr = NULL;
g->linear_key = 0;
}
g->prev = g_prev;
g->next = NULL;
g->handle = s->selector;
g->sequence = -1;
g->addr = s->base_addr;
g->length = s->length;
g->alias = 0;
g->linear_addr = NULL;
g->linear_key = 0;
g->linear_count = 0;
if (!(flags & GLOBAL_FLAGS_MOVEABLE))
g->lock_count = 1;
......@@ -139,14 +141,16 @@ GlobalGetFreeSegments(unsigned int flags, int n_segments)
g = g_start;
for (i = 0; i < n_segments; i++, g = g->next)
{
if (g == NULL) {
if (g == NULL)
{
printf("GlobalGetFreeSegments // bad Segments chain !\n");
return NULL;
}
g->sequence = i + 1;
g->length = n_segments;
g->linear_addr = NULL;
g->linear_key = 0;
}
g->sequence = i + 1;
g->length = n_segments;
g->alias = 0;
g->linear_addr = NULL;
g->linear_key = 0;
g->linear_count = 0;
}
......@@ -154,6 +158,15 @@ GlobalGetFreeSegments(unsigned int flags, int n_segments)
}
/**********************************************************************
* WIN16_GlobalAlloc
*/
HANDLE
WIN16_GlobalAlloc(unsigned int flags, unsigned long size)
{
return GlobalAlloc(flags & ~GLOBAL_FLAGS_MOVEABLE, size);
}
/**********************************************************************
* GlobalAlloc
*/
HANDLE
......@@ -234,14 +247,15 @@ GlobalAlloc(unsigned int flags, unsigned long size)
if (g == NULL)
return 0;
g->handle = next_unused_handle;
g->sequence = 0;
g->addr = m;
g->linear_addr = NULL;
g->linear_key = 0;
g->handle = next_unused_handle;
g->sequence = 0;
g->addr = m;
g->alias = 0;
g->linear_addr = NULL;
g->linear_key = 0;
g->linear_count = 0;
g->length = size;
g->next = g_prev->next;
g->length = size;
g->next = g_prev->next;
if (g->next) g->next->prev = g;
g->lock_count = 0;
......@@ -323,28 +337,15 @@ GlobalLock(unsigned int block)
{
GDESC *g;
if (block == 0)
if ((g = GlobalGetGDesc(block)) == NULL)
return 0;
/*
* Find GDESC for this block.
*/
for (g = GlobalList; g != NULL; g = g->next)
{
if (g->handle == block)
{
g->lock_count++;
#ifdef DEBUG_HEAP
printf("GlobalLock: returning %08x\n", g->addr);
#endif
return g->addr;
}
}
g->lock_count++;
#ifdef DEBUG_HEAP
printf("GlobalLock: returning %08x\n", 0);
printf("GlobalLock: returning %08x\n", g->addr);
#endif
return NULL;
return g->addr;
}
/**********************************************************************
......
......@@ -116,23 +116,28 @@ HEAP_ReAlloc(MDESC **free_list, void *old_block,
{
MDESC *m_free;
MDESC *m;
if (!old_block)
return HEAP_Alloc(free_list, flags, new_size);
/*
* Check validity of block
*/
m = (MDESC *) old_block - 1;
#ifdef DEBUG_HEAP
printf("HEAP_ReAlloc new_size=%d !\n", new_size);
printf("HEAP_ReAlloc old_block=%08X !\n", old_block);
printf("HEAP_ReAlloc m=%08X free_list=%08X !\n", m, free_list);
printf("HEAP_ReAlloc m->prev=%08X !\n", m->prev);
printf("HEAP_ReAlloc m->next=%08X !\n", m->next);
printf("HEAP_ReAlloc *free_list=%08X !\n", *free_list);
printf("HEAP_ReAlloc new_size=%d !\n", new_size);
printf("HEAP_ReAlloc old_block=%08X !\n", old_block);
printf("HEAP_ReAlloc m=%08X free_list=%08X !\n", m, free_list);
printf("HEAP_ReAlloc m->prev=%08X !\n", m->prev);
printf("HEAP_ReAlloc m->next=%08X !\n", m->next);
printf("HEAP_ReAlloc *free_list=%08X !\n", *free_list);
#endif
if (m->prev != m || m->next != m ||
if (m->prev != m || m->next != m ||
((int) m & 0xffff0000) != ((int) *free_list & 0xffff0000))
{
printf("Attempt to resize bad pointer, m = %08x, *free_list = %08x\n",
m, free_list);
#ifdef DEBUG_HEAP
printf("Attempt to resize bad pointer, m = %08x, *free_list = %08x\n",
m, free_list);
......@@ -144,8 +149,9 @@ HEAP_ReAlloc(MDESC **free_list, void *old_block,
* Check for grow block
*/
#ifdef DEBUG_HEAP
printf("HEAP_ReAlloc Check for grow block !\n");
printf("HEAP_ReAlloc Check for grow block !\n");
#endif
if (new_size > m->length)
{
m_free = m + 1 + m->length / sizeof(MDESC);
......
......@@ -171,7 +171,7 @@ HCURSOR LoadCursor(HANDLE instance, LPSTR cursor_name)
ReleaseDC(GetDesktopWindow(), hdc);
return 0;
}
lp += 2;
(char *)lp += 2;
for (j = 0; j < 16; j++)
printf("%04X ", *(lp + j));
/*
......@@ -180,7 +180,7 @@ HCURSOR LoadCursor(HANDLE instance, LPSTR cursor_name)
else
*/
lpcur->hBitmap = 0;
lp += sizeof(BITMAP);
/* lp += sizeof(BITMAP); */
for (i = 0; i < 81; i++) {
char temp = *((char *)lp + 162 + i);
*((char *)lp + 162 + i) = *((char *)lp + 324 - i);
......
......@@ -12,7 +12,7 @@
*
* DEC 93 Erik Bos (erik@(trashcan.)hacktic.nl)
* - Existing functions modified to use dosfs functions.
* - Added _llseek, _lcreate, GetDriveType, GetTempDrive,
* - Added _llseek, _lcreat, GetDriveType, GetTempDrive,
* GetWindowsDirectory, GetSystemDirectory, GetTempFileName.
*
************************************************************************/
......@@ -27,7 +27,7 @@
#include <windows.h>
#include "prototypes.h"
#define DEBUG_FILE
/* #define DEBUG_FILE */
char WindowsDirectory[256], SystemDirectory[256], TempDirectory[256];
......@@ -63,7 +63,7 @@ INT _lopen (LPSTR lpPathName, INT iReadWrite)
/***************************************************************************
_lread
***************************************************************************/
WORD _lread (INT hFile, LPSTR lpBuffer, INT wBytes)
INT _lread (INT hFile, LPSTR lpBuffer, INT wBytes)
{
int result;
......@@ -83,7 +83,7 @@ WORD _lread (INT hFile, LPSTR lpBuffer, INT wBytes)
/****************************************************************************
_lwrite
****************************************************************************/
WORD _lwrite (INT hFile, LPSTR lpBuffer, INT wBytes)
INT _lwrite (INT hFile, LPSTR lpBuffer, INT wBytes)
{
int result;
......@@ -196,15 +196,15 @@ LONG _llseek (INT hFile, LONG lOffset, INT nOrigin)
}
/***************************************************************************
_lcreate
_lcreat
***************************************************************************/
INT _lcreate (LPSTR lpszFilename, INT fnAttribute)
INT _lcreat (LPSTR lpszFilename, INT fnAttribute)
{
int handle;
char *UnixFileName;
#ifdef DEBUG_FILE
fprintf(stderr, "_lcreate: filename %s, attributes %d\n",lpszFilename,
fprintf(stderr, "_lcreat: filename %s, attributes %d\n",lpszFilename,
fnAttribute);
#endif
if ((UnixFileName = GetUnixFileName(lpszFilename)) == NULL)
......@@ -307,7 +307,7 @@ INT GetTempFileName(BYTE bDriveLetter, LPCSTR lpszPrefixString, UINT uUnique, LP
fprintf(stderr,"GetTempFilename: %c %s %d => %s\n",bDriveLetter,
lpszPrefixString,uUnique,lpszTempFileName);
#endif
if ((handle = _lcreate (lpszTempFileName, 0x0000)) == -1) {
if ((handle = _lcreat (lpszTempFileName, 0x0000)) == -1) {
fprintf(stderr,"GetTempFilename: can't create temp file '%s' !\n", lpszTempFileName);
}
else
......
......@@ -45,7 +45,10 @@ HANDLE RemoveProp(HWND hWnd, LPSTR lpStr)
lpProp = (LPPROPENTRY) GlobalLock(wndPtr->hProp);
if (lpProp == NULL) return 0;
while (TRUE) {
if (strcmp(lpProp->PropName, lpStr) == 0) {
if ((((DWORD)lpStr & 0xFFFF0000) == 0L &&
lpProp->Atom == LOWORD((DWORD)lpStr)) ||
(((DWORD)lpStr & 0xFFFF0000) != 0L &&
strcmp(lpProp->PropName, lpStr) == 0)) {
printf("RemoveProp // Property found ! hData=%04X\n", lpProp->hData);
hOldData = lpProp->hData;
if (lpProp->lpPrevProp != NULL)
......@@ -54,7 +57,7 @@ HANDLE RemoveProp(HWND hWnd, LPSTR lpStr)
if (lpProp->lpNextProp != NULL)
((LPPROPENTRY)lpProp->lpNextProp)->lpPrevProp =
lpProp->lpPrevProp;
free(lpProp->PropName);
if (lpProp->PropName != NULL) free(lpProp->PropName);
free(lpProp);
GlobalUnlock(wndPtr->hProp);
return hOldData;
......@@ -84,7 +87,7 @@ HANDLE GetProp(HWND hWnd, LPSTR lpStr)
wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == NULL) {
printf("GetProp // Bad Window handle !\n");
return FALSE;
return 0;
}
lpProp = (LPPROPENTRY) GlobalLock(wndPtr->hProp);
if (lpProp == NULL) return 0;
......@@ -130,7 +133,10 @@ BOOL SetProp(HWND hWnd, LPSTR lpStr, HANDLE hData)
lpProp = (LPPROPENTRY) GlobalLock(wndPtr->hProp);
if (lpProp != NULL) {
while (TRUE) {
if (strcmp(lpProp->PropName, lpStr) == 0) {
if ((((DWORD)lpStr & 0xFFFF0000) == 0L &&
lpProp->Atom == LOWORD((DWORD)lpStr)) ||
(((DWORD)lpStr & 0xFFFF0000) != 0L &&
strcmp(lpProp->PropName, lpStr) == 0)) {
#ifdef DEBUG_PROP
printf("SetProp // change already exinsting property !\n");
#endif
......@@ -190,8 +196,39 @@ BOOL SetProp(HWND hWnd, LPSTR lpStr, HANDLE hData)
*/
int EnumProps(HWND hWnd, FARPROC lpEnumFunc)
{
printf("EMPTY STUB !!! EnumProps(%04X, %08X)\n", hWnd, lpEnumFunc);
return -1;
WND *wndPtr;
LPPROPENTRY lpProp;
LPSTR str;
int nRet;
printf("EnumProps(%04X, %08X)\n", hWnd, lpEnumFunc);
wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == NULL) {
printf("EnumProps // Bad Window handle !\n");
return 0;
}
lpProp = (LPPROPENTRY) GlobalLock(wndPtr->hProp);
if (lpProp == NULL) return 0;
if (lpEnumFunc != NULL) return 0;
while (TRUE) {
printf("EnumProps // lpProp->Atom=%04X !\n", lpProp->Atom);
str = (LPSTR)MAKELONG(lpProp->Atom, 0);
if (lpProp->PropName != NULL) {
printf("EnumProps // lpProp->PropName='%s' !\n", lpProp->PropName);
str = lpProp->PropName;
}
#ifdef WINELIB
nRet = (*lpEnumFunc)((HWND)hWnd, (WORD)0,
(LPSTR)str, (HANDLE)lpProp->hData);
#else
nRet = CallBack16(lpEnumFunc, 4, (HANDLE)lpProp->hData,
(LPSTR)str, (WORD)0, (HWND)hWnd);
#endif
if (nRet == 0) break;
if (lpProp->lpNextProp == NULL) break;
lpProp = lpProp->lpNextProp;
}
GlobalUnlock(wndPtr->hProp);
return 0;
}
......@@ -134,6 +134,21 @@ HINSTANCE FindExecutable(LPCSTR lpFile, LPCSTR lpDirectory, LPSTR lpResult)
}
char AppName[256], AppMisc[256];
INT AboutDlgProc(HWND hWnd, WORD msg, WORD wParam, LONG lParam);
/*************************************************************************
* ShellAbout [SHELL.22]
*/
INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon)
{
fprintf(stderr, "ShellAbout ! (%s, %s)\n", szApp, szOtherStuff);
strcpy(AppName, szApp);
strcpy(AppMisc, szOtherStuff);
return DialogBox(hSysRes, "SHELL_ABOUT_MSGBOX", hWnd, (FARPROC)AboutDlgProc);
}
/*************************************************************************
* AboutDlgProc [SHELL.33]
......@@ -145,7 +160,7 @@ INT AboutDlgProc(HWND hWnd, WORD msg, WORD wParam, LONG lParam)
switch(msg) {
case WM_INITDIALOG:
sprintf(temp, "About %s", AppName);
/* SetDlgItemText(hWnd, 0, temp);*/
SetWindowText(hWnd, temp);
SetDlgItemText(hWnd, 100, AppMisc);
break;
......@@ -160,20 +175,6 @@ INT AboutDlgProc(HWND hWnd, WORD msg, WORD wParam, LONG lParam)
}
/*************************************************************************
* ShellAbout [SHELL.22]
*/
INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon)
{
fprintf(stderr, "ShellAbout ! (%s, %s)\n", szApp, szOtherStuff);
strcpy(AppName, szApp);
strcpy(AppMisc, szOtherStuff);
return DialogBox(hSysRes, "SHELL_ABOUT_MSGBOX", hWnd, (FARPROC)AboutDlgProc);
}
/*************************************************************************
* ExtractIcon [SHELL.34]
*/
HICON ExtractIcon(HINSTANCE hInst, LPCSTR lpszExeFileName, UINT nIconIndex)
......
......@@ -549,8 +549,12 @@ struct servent *Winsock_getservbyport(INT port, const char FAR *proto)
/******************** winsock specific functions ************************
*
*/
static HANDLE new_handle = 0;
#define AllocWSAHandle() getpid()
HANDLE AllocWSAHandle(void)
{
return new_handle++;
}
static void recv_message(int sig)
{
......
......@@ -17,7 +17,8 @@ SRCS = \
bitblt.c \
linedda.c \
color.c \
dither.c
dither.c \
metafile.c
OBJS = \
bitmap.o \
......@@ -34,7 +35,8 @@ OBJS = \
bitblt.o \
linedda.o \
color.o \
dither.o
dither.o \
metafile.o
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget()
......
......@@ -9,6 +9,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "gdi.h"
#include "bitmap.h"
#include "prototypes.h"
#include "metafile.h"
#define NB_HATCH_STYLES 6
......@@ -228,6 +229,26 @@ HBRUSH BRUSH_SelectObject( HDC hdc, DC * dc, HBRUSH hbrush, BRUSHOBJ * brush )
HBITMAP hBitmap;
BITMAPINFO * bmpInfo;
HBRUSH prevHandle = dc->w.hBrush;
if (dc->header.wMagic == METAFILE_DC_MAGIC)
{
switch (brush->logbrush.lbStyle)
{
case BS_SOLID:
case BS_HATCHED:
case BS_HOLLOW:
if (!MF_CreateBrushIndirect(dc, &(brush->logbrush)))
return 0;
break;
case BS_PATTERN:
case BS_DIBPATTERN:
if (!MF_CreatePatternBrush(dc, &(brush->logbrush)))
return 0;
break;
}
return 1;
}
dc->w.hBrush = hbrush;
......
......@@ -7,6 +7,7 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "gdi.h"
#include "metafile.h"
/* Default DC values */
const WIN_DC_INFO DCVAL_defaultValues =
......@@ -96,25 +97,33 @@ func_type func_name( HDC hdc, func_type val ) \
return prevVal; \
}
#define DC_SET_MODE( func_name, dc_field, min_val, max_val ) \
#define DC_SET_MODE( func_name, dc_field, min_val, max_val, meta_func ) \
WORD func_name( HDC hdc, WORD mode ) \
{ \
WORD prevMode; \
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
if (!dc) return 0; \
if ((mode < min_val) || (mode > max_val)) return 0; \
if (!dc) { \
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC); \
if (!dc) return 0; \
MF_MetaParam1(dc, meta_func, mode); \
return 1; \
} \
prevMode = dc->w.dc_field; \
dc->w.dc_field = mode; \
return prevMode; \
}
DC_SET_MODE( SetBkMode, backgroundMode, TRANSPARENT, OPAQUE ) /* GDI.2 */
DC_SET_MODE( SetROP2, ROPmode, R2_BLACK, R2_WHITE ) /* GDI.4 */
DC_SET_MODE( SetRelAbs, relAbsMode, ABSOLUTE, RELATIVE ) /* GDI.5 */
DC_SET_MODE( SetPolyFillMode, polyFillMode, ALTERNATE, WINDING ) /* GDI.6 */
DC_SET_MODE( SetBkMode, backgroundMode, TRANSPARENT, OPAQUE,
META_SETBKMODE ) /* GDI.2 */
DC_SET_MODE( SetROP2, ROPmode, R2_BLACK, R2_WHITE, META_SETROP2 ) /* GDI.4 */
DC_SET_MODE( SetRelAbs, relAbsMode, ABSOLUTE, RELATIVE,
META_SETRELABS ) /* GDI.5 */
DC_SET_MODE( SetPolyFillMode, polyFillMode, ALTERNATE, WINDING,
META_SETPOLYFILLMODE ) /* GDI.6 */
DC_SET_MODE( SetStretchBltMode, stretchBltMode,
BLACKONWHITE, COLORONCOLOR ) /* GDI.7 */
BLACKONWHITE, COLORONCOLOR, META_SETSTRETCHBLTMODE ) /* GDI.7 */
DC_GET_VAL( COLORREF, GetBkColor, backgroundColor ) /* GDI.75 */
DC_GET_VAL( WORD, GetBkMode, backgroundMode ) /* GDI.76 */
DC_GET_X_Y( DWORD, GetCurrentPosition, CursPosX, CursPosY ) /* GDI.78 */
......
......@@ -10,6 +10,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <stdlib.h>
#include <string.h>
#include <X11/Xatom.h>
#include "user.h"
#include "gdi.h"
......@@ -414,7 +415,7 @@ BOOL GetCharWidth(HDC hdc, WORD wFirstChar, WORD wLastChar, LPINT lpBuffer)
for (i = wFirstChar, j = 0; i <= wLastChar; i++, j++)
{
CI_GET_CHAR_INFO(xfont, i, def, cs);
*(lpBuffer + j) = cs->width;
*(lpBuffer + j) = cs ? cs->width : xfont->max_bounds.width;
if (*(lpBuffer + j) < 0)
*(lpBuffer + j) = 0;
}
......@@ -425,11 +426,138 @@ BOOL GetCharWidth(HDC hdc, WORD wFirstChar, WORD wLastChar, LPINT lpBuffer)
/*************************************************************************
* EnumFonts [GDI.70]
*/
int EnumFonts(HDC hDC, LPSTR lpFaceName, FARPROC lpFontFunc, LPSTR lpData)
int EnumFonts(HDC hDC, LPSTR lpFaceName, FARPROC lpEnumFunc, LPSTR lpData)
{
printf("EMPTY STUB !!! EnumFonts(%04X, %08X, %08X, %08X)\n",
hDC, lpFaceName, lpFontFunc, lpData);
return -1;
HANDLE hLog;
HANDLE hMet;
LPLOGFONT lpLogFont;
LPTEXTMETRIC lptm;
int nRet;
printf("EnumFonts(%04X, %08X, %08X, %08X)\n",
hDC, lpFaceName, lpEnumFunc, lpData);
if (lpEnumFunc == NULL) return 0;
hLog = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(LOGFONT) + LF_FACESIZE);
lpLogFont = (LPLOGFONT) USER_HEAP_ADDR(hLog);
if (lpLogFont == NULL) {
printf("EnumFonts // can't alloc LOGFONT struct !\n");
return 0;
}
hMet = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(TEXTMETRIC));
lptm = (LPTEXTMETRIC) USER_HEAP_ADDR(hMet);
if (lptm == NULL) {
USER_HEAP_FREE(hLog);
printf("EnumFonts // can't alloc TEXTMETRIC struct !\n");
return 0;
}
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);
#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;
}
USER_HEAP_FREE(hMet);
USER_HEAP_FREE(hLog);
return 0;
}
/*************************************************************************
* EnumFontFamilies [GDI.330]
*/
int EnumFontFamilies(HDC hDC, LPSTR lpszFamily, FARPROC lpEnumFunc, LPSTR lpData)
{
HANDLE hLog;
HANDLE hMet;
LPLOGFONT lpLogFont;
LPTEXTMETRIC lptm;
int nRet;
printf("EnumFontFamilies(%04X, %08X, %08X, %08X)\n",
hDC, lpszFamily, lpEnumFunc, lpData);
if (lpEnumFunc == NULL) return 0;
hLog = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(LOGFONT) + LF_FACESIZE);
lpLogFont = (LPLOGFONT) USER_HEAP_ADDR(hLog);
if (lpLogFont == NULL) {
printf("EnumFontFamilies // can't alloc LOGFONT struct !\n");
return 0;
}
hMet = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(TEXTMETRIC));
lptm = (LPTEXTMETRIC) USER_HEAP_ADDR(hMet);
if (lptm == NULL) {
USER_HEAP_FREE(hLog);
printf("EnumFontFamilies // can't alloc TEXTMETRIC struct !\n");
return 0;
}
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);
#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;
}
USER_HEAP_FREE(hMet);
USER_HEAP_FREE(hLog);
return 0;
}
......
......@@ -356,7 +356,11 @@ HANDLE SelectObject( HDC hdc, HANDLE handle )
if (!ptr) return 0;
dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return 0;
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return 0;
}
switch(ptr->wMagic)
{
......
......@@ -7,6 +7,7 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "gdi.h"
#include "metafile.h"
extern WORD COLOR_ToPhysical( DC *dc, COLORREF color );
......@@ -60,8 +61,11 @@ HPEN PEN_SelectObject( DC * dc, HPEN hpen, PENOBJ * pen )
static char dash_dot[] = { 2, 2 }; /* -- -- -- -- -- -- */
static char dash_dashdot[] = { 4,3,2,3 }; /* ---- -- ---- -- */
static char dash_dashdotdot[] = { 4,2,2,2,2,2 }; /* ---- -- -- ---- */
HPEN prevHandle = dc->w.hPen;
if (dc->header.wMagic == METAFILE_DC_MAGIC)
return MF_CreatePenIndirect(dc, &(pen->logpen));
dc->w.hPen = hpen;
dc->u.x.pen.style = pen->logpen.lopnStyle;
......
......@@ -9,6 +9,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <X11/Xatom.h>
#include "windows.h"
#include "gdi.h"
#include "metafile.h"
#define TAB 9
#define LF 10
......@@ -255,7 +256,14 @@ BOOL TextOut( HDC hdc, short x, short y, LPSTR str, short count )
XFontStruct *font;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return FALSE;
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
MF_TextOut(dc, x, y, str, count);
return TRUE;
}
if (!DC_SetupGCForText( dc )) return TRUE;
font = dc->u.x.font.fstruct;
......@@ -403,3 +411,17 @@ BOOL GrayString(HDC hdc, HBRUSH hbr, FARPROC gsprc, LPARAM lParam,
return s;
}
}
/***********************************************************************
* ExtTextOut [GDI.351]
*/
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");
TextOut(hDC, x, y, str, count);
return FALSE;
}
......@@ -110,6 +110,11 @@ ATOM RegisterClass( LPWNDCLASS class )
if (!(prevClassPtr->wc.style & CS_GLOBALCLASS)) return 0;
}
/* bug for bug compatible */
if (class->cbClsExtra < 0) class->cbClsExtra = 0;
if (class->cbWndExtra < 0) class->cbWndExtra = 0;
/* Create class */
handle = USER_HEAP_ALLOC( GMEM_MOVEABLE, sizeof(CLASS)+class->cbClsExtra );
......
......@@ -10,6 +10,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <string.h>
#include "gdi.h"
#include "bitmap.h"
#include "metafile.h"
static DeviceCaps * displayDevCaps = NULL;
......@@ -104,6 +105,7 @@ static void DC_InitDC( HDC hdc )
SelectObject( hdc, dc->w.hFont );
XSetGraphicsExposures( XT_display, dc->u.x.gc, False );
CLIPPING_SetDeviceClipping( dc );
FONT_SelectObject(dc, STOCK_SYSTEM_FIXED_FONT, NULL);
}
......@@ -477,7 +479,13 @@ COLORREF SetBkColor( HDC hdc, COLORREF color )
{
COLORREF oldColor;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return 0x80000000;
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return 0x80000000;
MF_MetaParam2(dc, META_SETBKCOLOR, HIWORD(color), LOWORD(color));
return 0; /* ?? */
}
oldColor = dc->w.backgroundColor;
dc->w.backgroundColor = color;
......@@ -493,7 +501,13 @@ COLORREF SetTextColor( HDC hdc, COLORREF color )
{
COLORREF oldColor;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return 0x80000000;
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return 0x80000000;
MF_MetaParam2(dc, META_SETTEXTCOLOR, HIWORD(color), LOWORD(color));
return 0; /* ?? */
}
oldColor = dc->w.textColor;
dc->w.textColor = color;
......
......@@ -4,6 +4,8 @@
* Copyright 1993 Alexandre Julliard
*/
#define DEBUG_DIALOG /* */
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <stdlib.h>
......@@ -267,6 +269,9 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, LPCSTR dlgTemplate,
return 0;
}
ShowWindow(hwnd, SW_SHOWNORMAL);
UpdateWindow(hwnd);
/* Create control windows */
#ifdef DEBUG_DIALOG
......
......@@ -26,7 +26,14 @@ extern int COLOR_ToPhysical( DC *dc, COLORREF color );
BOOL LineTo( HDC hdc, short x, short y )
{
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return FALSE;
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
MF_MetaParam2(dc, META_LINETO, x, y);
return TRUE;
}
if (DC_SetupGCForPen( dc ))
XDrawLine(XT_display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + XLPTODP( dc, dc->w.CursPosX ),
......@@ -44,9 +51,21 @@ BOOL LineTo( HDC hdc, short x, short y )
*/
DWORD MoveTo( HDC hdc, short x, short y )
{
POINT pt;
if (MoveToEx( hdc, x, y, &pt )) return pt.x | (pt.y << 16);
else return 0;
short oldx, oldy;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
MF_MetaParam2(dc, META_MOVETO, x, y);
return 0;
}
oldx = dc->w.CursPosX;
oldy = dc->w.CursPosY;
dc->w.CursPosX = x;
dc->w.CursPosY = y;
return oldx | (oldy << 16);
}
......@@ -81,7 +100,29 @@ BOOL GRAPH_DrawArc( HDC hdc, int left, int top, int right, int bottom,
double start_angle, end_angle, diff_angle;
XPoint points[3];
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return FALSE;
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
switch (lines)
{
case 0:
MF_MetaParam8(dc, META_ARC, left, top, right, bottom,
xstart, ystart, xend, yend);
break;
case 1:
MF_MetaParam8(dc, META_CHORD, left, top, right, bottom,
xstart, ystart, xend, yend);
break;
case 2:
MF_MetaParam8(dc, META_PIE, left, top, right, bottom,
xstart, ystart, xend, yend);
break;
}
return 0;
}
left = XLPTODP( dc, left );
top = YLPTODP( dc, top );
......@@ -166,7 +207,13 @@ BOOL Chord( HDC hdc, int left, int top, int right, int bottom,
BOOL Ellipse( HDC hdc, int left, int top, int right, int bottom )
{
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return FALSE;
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
MF_MetaParam4(dc, META_ELLIPSE, left, top, right, bottom);
return 0;
}
left = XLPTODP( dc, left );
top = YLPTODP( dc, top );
......@@ -192,7 +239,13 @@ BOOL Ellipse( HDC hdc, int left, int top, int right, int bottom )
BOOL Rectangle( HDC hdc, int left, int top, int right, int bottom )
{
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return FALSE;
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
MF_MetaParam4(dc, META_RECTANGLE, left, top, right, bottom);
return TRUE;
}
left = XLPTODP( dc, left );
top = YLPTODP( dc, top );
......@@ -219,7 +272,14 @@ BOOL RoundRect( HDC hDC, short left, short top, short right, short bottom,
{
int x1, y1, x2, y2;
DC * dc = (DC *) GDI_GetObjPtr(hDC, DC_MAGIC);
if (!dc) return FALSE;
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hDC, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
MF_MetaParam6(dc, META_ROUNDRECT, left, top, right, bottom,
ell_width, ell_height);
return TRUE;
}
/*
printf("RoundRect(%d %d %d %d %d %d\n",
left, top, right, bottom, ell_width, ell_height);
......@@ -350,7 +410,13 @@ COLORREF SetPixel( HDC hdc, short x, short y, COLORREF color )
PALETTEENTRY entry;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return 0;
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return 0;
MF_MetaParam4(dc, META_SETPIXEL, x, y, HIWORD(color), LOWORD(color));
return 1;
}
x = dc->w.DCOrgX + XLPTODP( dc, x );
y = dc->w.DCOrgY + YLPTODP( dc, y );
......@@ -522,25 +588,32 @@ void DrawReliefRect( HDC hdc, RECT rect, int thickness, BOOL pressed )
*/
BOOL Polyline (HDC hdc, LPPOINT pt, int count)
{
register int i;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (DC_SetupGCForPen( dc ))
{
for (i = 0; i < count-1; i ++)
XDrawLine (XT_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,
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),
dc->w.DCOrgY + YLPTODP(dc, pt [0].y));
}
register int i;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
MF_MetaPoly(dc, META_POLYLINE, pt, count);
return TRUE;
}
if (DC_SetupGCForPen( dc ))
{
for (i = 0; i < count-1; i ++)
XDrawLine (XT_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,
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),
dc->w.DCOrgY + YLPTODP(dc, pt [0].y));
}
return (TRUE);
return (TRUE);
}
......@@ -549,31 +622,39 @@ BOOL Polyline (HDC hdc, LPPOINT pt, int count)
*/
BOOL Polygon (HDC hdc, LPPOINT pt, int count)
{
register int i;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
XPoint *points = (XPoint *) malloc (sizeof (XPoint) * count+1);
register int i;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
XPoint *points = (XPoint *) malloc (sizeof (XPoint) * count+1);
if (DC_SetupGCForBrush( dc ))
{
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
MF_MetaPoly(dc, META_POLYGON, pt, count);
return TRUE;
}
if (DC_SetupGCForBrush( dc ))
{
for (i = 0; i < count; i++)
{
points [i].x = dc->w.DCOrgX + XLPTODP(dc, pt [i].x);
points [i].y = dc->w.DCOrgY + YLPTODP(dc, pt [i].y);
}
points [count] = points [0];
for (i = 0; i < count; i++)
{
points [i].x = dc->w.DCOrgX + XLPTODP(dc, pt [i].x);
points [i].y = dc->w.DCOrgY + YLPTODP(dc, pt [i].y);
}
points [count] = points [0];
XFillPolygon( XT_display, dc->u.x.drawable, dc->u.x.gc,
points, count, Complex, CoordModeOrigin);
XFillPolygon( XT_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,
points, count, CoordModeOrigin );
}
if (DC_SetupGCForPen ( dc ))
{
XDrawLines( XT_display, dc->u.x.drawable, dc->u.x.gc,
points, count, CoordModeOrigin );
}
free ((void *) points);
return (TRUE);
}
free ((void *) points);
return (TRUE);
}
/**********************************************************************
......@@ -619,51 +700,57 @@ static BOOL FloodFill_rec(XImage *image, int x, int y,
*/
BOOL FloodFill(HDC hdc, short x, short y, DWORD crColor)
{
Pixel boundrypixel;
int imagex, imagey;
XImage *image;
DC *dc;
Pixel boundrypixel;
int imagex, imagey;
XImage *image;
DC *dc;
#ifdef DEBUG_GRAPHICS
printf("FloodFill %x %d,%d %x\n", hdc, x, y, crColor);
printf("FloodFill %x %d,%d %x\n", hdc, x, y, crColor);
#endif
dc = (DC *) GDI_GetObjPtr(hdc, DC_MAGIC);
if (!dc) return 0;
dc = (DC *) GDI_GetObjPtr(hdc, DC_MAGIC);
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
MF_MetaParam4(dc, META_FLOODFILL, x, y, HIWORD(crColor),
LOWORD(crColor));
return TRUE;
}
x = dc->w.DCOrgX + XLPTODP(dc, x);
y = dc->w.DCOrgY + YLPTODP(dc, y);
x = dc->w.DCOrgX + XLPTODP(dc, x);
y = dc->w.DCOrgY + YLPTODP(dc, y);
if (x < dc->w.DCOrgX || x > dc->w.DCOrgX + dc->w.DCSizeX ||
y < dc->w.DCOrgY || y > dc->w.DCOrgY + dc->w.DCSizeY)
return 0;
if (x < dc->w.DCOrgX || x > dc->w.DCOrgX + dc->w.DCSizeX ||
y < dc->w.DCOrgY || y > dc->w.DCOrgY + dc->w.DCSizeY)
return FALSE;
if (!DC_SetupGCForBrush(dc))
return FALSE;
if (!DC_SetupGCForBrush(dc))
return FALSE;
boundrypixel = GetNearestPaletteIndex( dc->w.hPalette, crColor );
boundrypixel = GetNearestPaletteIndex( dc->w.hPalette, crColor );
image = XGetImage(display, dc->u.x.drawable,
dc->w.DCOrgX, dc->w.DCOrgY,
dc->w.DCSizeX, dc->w.DCSizeY, AllPlanes, ZPixmap);
if (XGetPixel(image, x, y) == boundrypixel)
return FALSE;
if (!FloodFill_rec(image, x, y,
0,0,
dc->w.DCOrgX + dc->w.DCSizeX,
dc->w.DCOrgY + dc->w.DCSizeY,
boundrypixel, dc->u.x.brush.pixel)) {
XDestroyImage(image);
return 0;
}
XPutImage(display, dc->u.x.drawable, dc->u.x.gc, image,
0, 0,
dc->w.DCOrgX, dc->w.DCOrgY,
dc->w.DCSizeX, dc->w.DCSizeY);
image = XGetImage(display, dc->u.x.drawable,
dc->w.DCOrgX, dc->w.DCOrgY,
dc->w.DCSizeX, dc->w.DCSizeY, AllPlanes, ZPixmap);
if (XGetPixel(image, x, y) == boundrypixel)
return FALSE;
if (!FloodFill_rec(image, x, y,
0, 0,
dc->w.DCOrgX + dc->w.DCSizeX,
dc->w.DCOrgY + dc->w.DCSizeY,
boundrypixel, dc->u.x.brush.pixel)) {
XDestroyImage(image);
return FALSE;
}
return TRUE;
XPutImage(display, dc->u.x.drawable, dc->u.x.gc, image,
0, 0,
dc->w.DCOrgX, dc->w.DCOrgY,
dc->w.DCSizeX, dc->w.DCSizeY);
XDestroyImage(image);
return TRUE;
}
......@@ -7,6 +7,7 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "gdi.h"
#include "metafile.h"
/***********************************************************************
......@@ -75,7 +76,13 @@ WORD SetMapMode( HDC hdc, WORD mode )
{
WORD prevMode;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return 0;
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return 0;
MF_MetaParam1(dc, META_SETMAPMODE, mode);
return 1;
}
#ifdef DEBUG_GDI
printf( "SetMapMode: %d %d\n", hdc, mode );
......
......@@ -52,7 +52,7 @@ void UTILITY_strip015(char *dest) {
int
DebugPrintString(char *str)
{
printf("%s", str);
fprintf(stderr, "%s", str);
return 0;
}
......@@ -78,7 +78,7 @@ void OutputDebugString(LPSTR foo)
static void UTILITY_qualify(const char *source, char *dest)
{
#ifdef debug_utility
printf("UTILITY_qualify(\"%s\", \"%s\");\n", source, dest);
fprintf(stderr, "UTILITY_qualify(\"%s\", \"%s\");\n", source, dest);
#endif
if(!source) return; /* Dumbass attack! */
while(*source) {
......@@ -130,7 +130,7 @@ size_t UTILITY_argsize(const char *format, BOOL windows)
if(*format) {
char modifier = ' ';
#ifdef debug_utility
printf("found:\t\"%%");
fprintf(stderr, "found:\t\"%%");
#endif
format++; /* skip past '%' */
/* First skip the flags, field width, etc. */
......@@ -138,39 +138,39 @@ size_t UTILITY_argsize(const char *format, BOOL windows)
if ((*format == '#') || (*format == '-') || (*format == '+')
|| (*format == ' ')) {
#ifdef debug_utility
printf("%c", *format);
fprintf(stderr, "%c", *format);
#endif
format++;
}
/* Now the field width, etc. */
while(isdigit(*format)) {
#ifdef debug_utility
printf("%c", *format);
fprintf(stderr, "%c", *format);
#endif
format++;
}
if(*format == '.') {
#ifdef debug_utility
printf("%c", *format);
fprintf(stderr, "%c", *format);
#endif
format++;
}
while(isdigit(*format)) {
#ifdef debug_utility
printf("%c", *format);
fprintf(stderr, "%c", *format);
#endif
format++;
}
/* Now we handle the rest */
if((*format == 'h') || (*format == 'l') || (*format == 'L')) {
#ifdef debug_utility
printf("%c", modifier);
fprintf(stderr, "%c", modifier);
#endif
modifier = *(format++);
}
/* Handle the actual type. */
#ifdef debug_utility
printf("%c\"\n", *format);
fprintf(stderr, "%c\"\n", *format);
#endif
switch(*format) {
case 'd':
......@@ -200,7 +200,7 @@ size_t UTILITY_argsize(const char *format, BOOL windows)
};
#undef INT_SIZE
#ifdef debug_utility
printf("UTILITY_argsize: returning %i\n", size);
fprintf(stderr, "UTILITY_argsize: returning %i\n", size);
#endif
return size;
};
......@@ -228,7 +228,7 @@ char *UTILITY_convertArgs(char *format, char *winarg)
if(*format) {
char modifier = ' ';
#ifdef debug_utility
printf("found:\t\"%%");
fprintf(stderr, "found:\t\"%%");
#endif
format++; /* skip past '%' */
/* First skip the flags, field width, etc. */
......@@ -244,7 +244,7 @@ char *UTILITY_convertArgs(char *format, char *winarg)
modifier = *(format++);
/* Handle the actual type. */
#ifdef debug_utility
printf("%c\"\n", *format);
fprintf(stderr, "%c\"\n", *format);
#endif
switch(*format) {
case 'd':
......@@ -282,18 +282,132 @@ char *UTILITY_convertArgs(char *format, char *winarg)
return result;
};
#ifndef WINELIB
INT windows_wsprintf(BYTE *win_stack)
{
LPSTR lpOutput, lpFormat;
BYTE *new_stack, *stack_ptr, *ptr;
int stacklength, result;
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++ != '%')
continue;
/* skip width/precision */
while ( *ptr == '-' || *ptr == '+' || *ptr == '.' ||
*ptr == ' ' || isdigit(*ptr))
ptr++;
switch(*ptr++) {
case 's':
stack_ptr -= 4;
win_stack -= 4;
*(DWORD*)stack_ptr = *(DWORD*)win_stack;
continue;
case 'l':
stack_ptr -= 4;
win_stack -= 4;
*(DWORD*)stack_ptr = *(DWORD*)win_stack;
ptr++; /* skip next type character */
continue;
case 'c':
stack_ptr -= 4;
win_stack -= 2;
/* windows' wsprintf() %c ignores 0's, we replace 0 with 1 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;
case 'd':
case 'i':
stack_ptr -= 4;
win_stack -= 2;
*(int*)stack_ptr = *(INT*)win_stack;
continue;
case 'u':
case 'x':
case 'X':
stack_ptr -= 4;
win_stack -= 2;
*(DWORD*)stack_ptr = *(WORD*)win_stack;
continue;
default:
stack_ptr -= 4;
win_stack -= 4;
*(DWORD*)stack_ptr = 0;
fprintf(stderr, "wsprintf: oops, unknown formattype %c used!\n", *ptr);
}
} while (*ptr);
result = vsprintf(lpOutput, lpFormat, stack_ptr);
free(new_stack);
return result;
}
#endif
/**************************************************************************
* wsprintf [USER.420]
* wsprintf [USER.420] (not used by relay)
*/
int wsprintf(LPSTR lpOutput, LPSTR lpFormat, ...)
{
va_list valist;
int ArgCnt;
va_start(valist, lpFormat);
ArgCnt = vsprintf(lpOutput, lpFormat, valist);
va_end(valist);
return (ArgCnt);
va_list valist;
int ArgCnt;
va_start(valist, lpFormat);
ArgCnt = vsprintf(lpOutput, lpFormat, valist);
va_end(valist);
return ArgCnt;
}
......@@ -320,12 +434,11 @@ int wvsprintf(LPSTR buf, LPSTR format, LPSTR args)
/* Change the format string so that ints are handled as short by
default */
UTILITY_qualify(format, qualified_fmt);
/* Convert agruments to 32-bit values */
newargs = UTILITY_convertArgs(format, args);
result = vsprintf(buf, qualified_fmt, newargs);
free(newargs);
return result;
};
......@@ -971,6 +971,15 @@ BOOL AnyPopup()
return FALSE;
}
/*******************************************************************
* FlashWindow [USER.105]
*/
BOOL FlashWindow(HWND hWnd, BOOL bInvert)
{
printf("EMPTY STUB !! FlashWindow !\n");
return FALSE;
}
/*******************************************************************
* SetSysModalWindow [USER.188]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment