diff --git a/ANNOUNCE b/ANNOUNCE index 20b0e35f013..3a4afcceea0 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,16 +1,13 @@ -This is release 970616 of Wine, the MS Windows emulator. This is still a +This is release 970629 of Wine, the MS Windows emulator. This is still a developer's only release. There are many bugs and many unimplemented API features. Most applications still do not work correctly. Patches should be submitted to "julliard@lrc.epfl.ch". Please don't forget to include a ChangeLog entry. -WHAT'S NEW with Wine-970616: (see ChangeLog for details) - - More improvements to multimedia code. - - New font mapper. - - Icon titles. - - Print spooling. - - Direct I/O ports access. +WHAT'S NEW with Wine-970629: (see ChangeLog for details) + - Start of COMDLG32 implementation. + - Relay debugging knows about strings. - Lots of bug fixes. See the README file in the distribution for installation instructions. @@ -19,10 +16,10 @@ Because of lags created by using mirror, this message may reach you before the release is available at the ftp sites. The sources will be available from the following locations: - ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-970616.tar.gz - ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-970616.tar.gz - ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970616.tar.gz - ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-970616.tar.gz + ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-970629.tar.gz + ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-970629.tar.gz + ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970629.tar.gz + ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-970629.tar.gz It should also be available from any site that mirrors tsx-11 or sunsite. diff --git a/BUGS b/BUGS index f706ac64987..473e87eb980 100644 --- a/BUGS +++ b/BUGS @@ -11,7 +11,7 @@ General: * TrueType, .FON rasterizer. - * No thread/process/kernel-object support in Win32 code. + * No thread/process scheduling support in Win32 code. * Very alpha printing code. [john@division.co.uk] @@ -20,23 +20,19 @@ General: * No MS Video support (perhaps interface with xanim, don't hold your breath for this one). - * No COMDLG32 support. (Needed badly, the Windows95 comdlg32.dll - doesn't work with WINE.) + * COMDLG32 support not complete yet. * No COMMCTRL/COMCTL32 support. - * No icon titles. - - Windows uses a special window class to display icon titles. - Handles to these title windows are stored in the icon window - properties. - * No manual pages describing the various Windows calls. - You can find information about most of the Win32 API calls on the www.microsoft.com (go to 'search'). Miscellaneous: - * New font mapping scheme can be improved. + * Text alignment problems in Word and Write (variable pitch fonts). + + * Font mapper weights * "Cursor XXXX has more than 1 bpp!" diff --git a/ChangeLog b/ChangeLog index f8b8b962a0a..50fa2fe7fe2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,72 @@ +---------------------------------------------------------------------- +Thu Jun 26 02:14:03 1997 Slaven Rezic + + * [Makefile.in] + New target install_includes. + + * [rc/parser.h] [rc/parser.y] [rc/winerc.c] + Some bug fixes. + +Wed Jun 25 14:43:41 1997 Victor Schneider + + * [controls/edit.c] + Fixed WM_GETTEXT return value. + +Tue Jun 24 23:46:04 1997 Michiel van Loon + + * [multimedia/*.c] [include/mmsystem.h] + Added more callback code, including (I hope) function callback. + Changed some linear pointers into segmented. + + * [multimedia/audio.c] + Removed some bugs. + +Sat Jun 28 11:37:56 1997 Marcus Meissner + + * [if1632/commdlg.spec][if1632/comdlg32.spec][misc/commdlg.c] + [include/commdlg.h] + Implemented parts of comdlg32: GetOpenFileName32*, + GetSaveFileName32*, GetFileTitle32* using the 16 bit equivalents. + + * [windows/event.c] + EVENT_QueryZOrder: check for children !=NULL (happens when + using -managed). + + * [BUGS][DEVELOPER-HINTS] + Updated. + + * [objects/text.c] + Added GetTextCharset... (stub mostly). + +Sat Jun 21 08:47:58 1997 Philippe De Muyter + + * [if1632/kernel.spec] [if1632/gdi.spec] [include/windows.h] + [loader/resource.c] [graphics/x11drv/xfont.c] + SetResourceHandler & RemoveFontResource prototypes fixed. + + * [if1632/relay.c] [if1632/kernel.spec] [if1632/user.spec] + [if1632/olesvr.spec] [if1632/commdlg.spec] [if1632/ddeml.spec] + [if1632/gdi.spec] [if1632/lzexpand.spec] [if1632/shell.spec] + [include/windows.h] [memory/string.c] [tools/build.c] + New type of parameter allowed in .spec files : str, printed + as a string with -debugmsg +relay. .spec files updated. + + * [objects/dc.c] + In DC_SetupGCForPen, call BlackPixelOfScreen, not BlackPixel. + Likewise for WhitePixel. + + * [objects/gdiobj.c] [graphics/x11drv/brush.c] + Use BS_HATCHED with an added entry in HatchBrushes for DkGrayBrush, + instead of BS_SOLID. + +Fri May 30 17:58:00 1997 Chris Faherty + + * [windows/keyboard.c] + Added vkey to scancode translation table. + This was primarily to fix Citrix WinFrame client which + always needs scancodes in WM_KEYDOWN. + Tested with Exceed 5.1.0.1 & XFree86 3.1.2. + ---------------------------------------------------------------------- Sat Jun 14 13:05:23 1997 Andreas Mohr <100.30936@germany.net> diff --git a/DEVELOPERS-HINTS b/DEVELOPERS-HINTS index 14b47e13d97..7f68ba4bd56 100644 --- a/DEVELOPERS-HINTS +++ b/DEVELOPERS-HINTS @@ -243,9 +243,12 @@ DEBUG_XXX's in include/stddebug.h or in a specific file. MORE INFO ========= -1. http://www.sonic.net/~undoc/bookstore.html +1. There is a FREE online version of the MSDN library (including + documentation for the Win32 API) on http://www.microsoft.com/msdn/ -2. In 1993 Dr. Dobbs Journal published a column called "Undocumented Corner". +2. http://www.sonic.net/~undoc/bookstore.html -3. You might want to check out BYTE from December 1983 as well :-) +3. In 1993 Dr. Dobbs Journal published a column called "Undocumented Corner". + +4. You might want to check out BYTE from December 1983 as well :-) diff --git a/Makefile.in b/Makefile.in index 039c74142c8..c62eb54c888 100644 --- a/Makefile.in +++ b/Makefile.in @@ -23,6 +23,7 @@ LDLIBS = @LDLIBS@ AR = ar rc RANLIB = @RANLIB@ RM = rm -f +MKDIR = mkdir SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)' @SET_MAKE@ @@ -37,6 +38,7 @@ bindir = @bindir@ libdir = @libdir@ mandir = @mandir@/man1 manext = .1 +includedir = @includedir@/wine # Main target to build @@ -118,15 +120,19 @@ libwine.a: $(COMMONSUBDIRS) $(LIBSUBDIRS) dummy $(AR) $@ $(COMMONOBJS) $(LIBOBJS) $(RANLIB) $@ -install_libwine.a: dummy +install_libwine.a: install_includes $(INSTALL_DATA) libwine.a $(libdir) libwine.so.1.0: $(COMMONSUBDIRS) $(LIBSUBDIRS) dummy $(CC) -shared -Wl,-soname,libwine.so -o$@ $(COMMONOBJS) $(LIBOBJS) $(LDOPTIONS) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LDLIBS) -install_libwine.so.1.0: dummy +install_libwine.so.1.0: install_includes $(INSTALL_DATA) libwine.so.1.0 $(libdir) +install_includes: dummy + if [ -d $(includedir) ]; then : ; else $(MKDIR) $(includedir); fi + cd include; $(INSTALL_DATA) windows.h wintypes.h $(includedir) + $(ALLSUBDIRS): dummy @cd $@; $(SUBMAKE) @@ -143,9 +149,8 @@ etags: clean: for i in $(ALLSUBDIRS); do (cd $$i; $(MAKE) clean) || exit 1; done - $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc + for i in . include documentation; do (cd $$i; $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc); done $(RM) wine wine.sym libwine.a libwine.so.1.0 TAGS - (cd include; $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc) distclean: clean $(RM) config.* Make.rules include/config.h diff --git a/controls/edit.c b/controls/edit.c index f557b62c17c..707bc691bce 100644 --- a/controls/edit.c +++ b/controls/edit.c @@ -3078,9 +3078,9 @@ static INT32 EDIT_WM_GetText(WND *wnd, EDITSTATE *es, INT32 count, LPSTR text) if (count > len) { lstrcpy32A(text, es->text); - return len + 1; + return len; } else - return 0; + return -1; } diff --git a/controls/listbox.c b/controls/listbox.c index 516fb24ab58..71f56beea7d 100644 --- a/controls/listbox.c +++ b/controls/listbox.c @@ -1731,9 +1731,12 @@ static LRESULT LISTBOX_HandleLButtonUp( WND *wnd, LB_DESCR *descr ) if (LISTBOX_Timer != LB_TIMER_NONE) KillSystemTimer32( wnd->hwndSelf, LB_TIMER_ID ); LISTBOX_Timer = LB_TIMER_NONE; - if (GetCapture32() == wnd->hwndSelf) ReleaseCapture(); - if (descr->style & LBS_NOTIFY) - SEND_NOTIFICATION( wnd, descr, LBN_SELCHANGE ); + if (GetCapture32() == wnd->hwndSelf) + { + ReleaseCapture(); + if (descr->style & LBS_NOTIFY) + SEND_NOTIFICATION( wnd, descr, LBN_SELCHANGE ); + } return 0; } diff --git a/documentation/fonts b/documentation/fonts index 32376131123..00ef738b06a 100644 --- a/documentation/fonts +++ b/documentation/fonts @@ -4,8 +4,8 @@ How To Convert Windows Fonts If you have access to Windows installation you should use fnt2bdf utility (found in the 'tools)' directory to convert -bitmap fonts (SYSTEM.FON, SSERIFE.FON, and SERIFE.FON) into -the format that X Window System can recognize. +bitmap fonts (VGASYS.FON, SSERIFE.FON, and SERIFE.FON) into +the format that X Window System can recognize. Step 1. Extract bitmap fonts with 'fnt2bdf'. @@ -14,14 +14,25 @@ Step 2. Convert .bdf files produced by the Step 1 into Step 3. Copy .pcf files to the font server directory which is usually /usr/lib/X11/fonts/misc (you will probably - need superuser privileges). + need superuser privileges). If you want to create a new + font directory you will need to add it to the font path. Step 4. Run 'mkfontdir' for the directory you copied fonts to. If you are already in X you should run 'xset fp rehash' to make X server aware of the new fonts. +Step 5. Edit wine.conf file to remove aliases for the fonts + you've just installed. + Wine can get by without these fonts but 'the look and feel' -will be quite different. +will be quite different. Also, some applications try to load +their custom fonts on the fly (WinWord 6.0) and since Wine does +not implement this yet it instead prints out something like; + +STUB: AddFontResource( somefile.FON ) + +You can convert this file too. Note that .FON file may not hold +any bitmap fonts and fnt2bdf will fail if this is the case. What to do with TrueType fonts? There are several commercial font tools that can convert them to the Type1 format but the @@ -87,7 +98,9 @@ installations, however X font table starts with whatever is the first line in the fonts.dir. Therefore WINE uses the following entry to determine which font to check first. -Default = ... +Example: + +Default = -adobe-times- Comments: It is better to have a scalable font family (bolds and italics included) diff --git a/graphics/x11drv/brush.c b/graphics/x11drv/brush.c index 62bc41f8dbc..1fe88daf5d3 100644 --- a/graphics/x11drv/brush.c +++ b/graphics/x11drv/brush.c @@ -12,14 +12,15 @@ #include "stddebug.h" #include "debug.h" -static const char HatchBrushes[NB_HATCH_STYLES][8] = +static const char HatchBrushes[NB_HATCH_STYLES + 1][8] = { { 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00 }, /* HS_HORIZONTAL */ { 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 }, /* HS_VERTICAL */ { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }, /* HS_FDIAGONAL */ { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }, /* HS_BDIAGONAL */ { 0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08, 0x08 }, /* HS_CROSS */ - { 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81 } /* HS_DIAGCROSS */ + { 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81 }, /* HS_DIAGCROSS */ + { 0xee, 0xbb, 0xee, 0xbb, 0xee, 0xbb, 0xee, 0xbb } /* Hack for DKGRAY */ }; /* Levels of each primary for dithering */ diff --git a/graphics/x11drv/text.c b/graphics/x11drv/text.c index cc7249d2b3f..0b90d62e710 100644 --- a/graphics/x11drv/text.c +++ b/graphics/x11drv/text.c @@ -107,20 +107,17 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags, /* Compute text starting position */ - XTextExtents( font, str, count, &dir, &ascent, &descent, &info ); - - if (lpDx) /* have explicit character cell x offsets */ + if (lpDx) /* have explicit character cell x offsets in logical coordinates */ { - /* sum lpDx array and add the width of last character */ - - info.width = XTextWidth( font, str + count - 1, 1) + dc->w.charExtra; - if (str[count-1] == dfBreakChar) - info.width += dc->w.breakExtra; - - for (i = 0; i < count; i++) info.width += lpDx[i]; + int extra = dc->wndExtX / 2; + for (i = info.width = 0; i < count; i++) info.width += lpDx[i]; + info.width = (info.width * dc->vportExtX + extra ) / dc->wndExtX; } else - info.width += count*dc->w.charExtra + dc->w.breakExtra*dc->w.breakCount; + { + XTextExtents( font, str, count, &dir, &ascent, &descent, &info ); + info.width += count*dc->w.charExtra + dc->w.breakExtra*dc->w.breakCount; + } switch( dc->w.textAlign & (TA_LEFT | TA_RIGHT | TA_CENTER) ) { @@ -200,32 +197,50 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags, pitem = items = xmalloc( count * sizeof(XTextItem) ); delta = i = 0; - while (i < count) - { - /* initialize text item with accumulated delta */ + if( lpDx ) /* explicit character widths */ + { + int extra = dc->wndExtX / 2; - pitem->chars = (char *)str + i; - pitem->delta = delta; - pitem->nchars = 0; - pitem->font = None; - delta = 0; + while (i < count) + { + /* initialize text item with accumulated delta */ - /* stuff characters into the same XTextItem until new delta - * becomes non-zero */ + pitem->chars = (char *)str + i; + pitem->delta = delta; + pitem->nchars = 0; + pitem->font = None; + delta = 0; - do + /* add characters to the same XTextItem until new delta + * becomes non-zero */ + + do + { + delta += (lpDx[i] * dc->vportExtX + extra) / dc->wndExtX + - XTextWidth( font, str + i, 1); + pitem->nchars++; + } while ((++i < count) && !delta); + pitem++; + } + } + else /* charExtra or breakExtra */ + { + while (i < count) { - if (lpDx) delta += lpDx[i] - XTextWidth( font, str + i, 1); - else + pitem->chars = (char *)str + i; + pitem->delta = delta; + pitem->nchars = 0; + pitem->font = None; + delta = 0; + + do { delta += dc->w.charExtra; - if (str[i] == (char)dfBreakChar) - delta += dc->w.breakExtra; - } - pitem->nchars++; + if (str[i] == (char)dfBreakChar) delta += dc->w.breakExtra; + pitem->nchars++; + } while ((++i < count) && !delta); + pitem++; } - while ((++i < count) && !delta); - pitem++; } XDrawText( display, dc->u.x.drawable, dc->u.x.gc, diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c index 60aa82fe959..f12d89f3fd6 100644 --- a/graphics/x11drv/xfont.c +++ b/graphics/x11drv/xfont.c @@ -606,6 +606,7 @@ static void XFONT_GetTextMetric( fontObject* pfo, LPTEXTMETRIC32A pTM ) pTM->tmCharSet = pdf->dfCharSet; pTM->tmPitchAndFamily = pdf->dfPitchAndFamily; + pTM->tmDigitizedAspectX = pdf->dfHorizRes; pTM->tmDigitizedAspectY = pdf->dfVertRes; } @@ -1147,10 +1148,10 @@ BOOL32 X11DRV_FONT_Init( DeviceCaps* pDevCaps ) if( !fr ) /* add new family */ { - if( n_ff++ > MAX_FONT_FAMILIES ) break; - + if( n_ff >= MAX_FONT_FAMILIES ) break; if( !LFD_InitFontInfo( fi, lpstr) ) continue; + n_ff++; fr = (fontResource*) HeapAlloc(SystemHeap, 0, sizeof(fontResource)); memset(fr, 0, sizeof(fontResource)); fr->resource = (char*) HeapAlloc(SystemHeap, 0, j + 1 ); @@ -1318,8 +1319,11 @@ static UINT32 XFONT_Match( fontMatch* pfm ) pfm->flags = 0; - if( plf->lfCharSet != DEFAULT_CHARSET && - plf->lfCharSet != pfi->df.dfCharSet ) penalty += 0x200; + if( plf->lfCharSet == DEFAULT_CHARSET ) + { + if( (pfi->df.dfCharSet!= ANSI_CHARSET) && (pfi->df.dfCharSet!=DEFAULT_CHARSET) ) penalty += 0x200; + } + else if (plf->lfCharSet != pfi->df.dfCharSet) penalty += 0x200; /* TMPF_FIXED_PITCH means exactly the opposite */ @@ -1937,7 +1941,7 @@ BOOL32 X11DRV_GetCharWidth( DC *dc, UINT32 firstChar, UINT32 lastChar, cs = &xfs->per_char[(i - xfs->min_char_or_byte2)]; if (CI_NONEXISTCHAR(cs)) cs = def; } else cs = def; - *buffer++ = MAX( cs->width, 0 ); + *buffer++ = MAX(cs->width, 0 ); } } return TRUE; @@ -1993,9 +1997,14 @@ INT32 AddFontResource32W( LPCWSTR str ) /*********************************************************************** * RemoveFontResource16 (GDI.136) */ -BOOL16 RemoveFontResource16( LPCSTR str ) +BOOL16 RemoveFontResource16( SEGPTR str ) { - return RemoveFontResource32A( str ); + if (HIWORD(str)) + fprintf( stdnimp, "STUB: RemoveFontResource('%s')\n", + (char *)PTR_SEG_TO_LIN( str) ); + else + fprintf( stdnimp, "STUB: RemoveFontResource(%04x)\n", LOWORD(str) ); + return TRUE; } diff --git a/if1632/advapi32.spec b/if1632/advapi32.spec index 4a88641e02b..792099541bd 100644 --- a/if1632/advapi32.spec +++ b/if1632/advapi32.spec @@ -12,7 +12,7 @@ base 0 0007 stub AddAce 0008 stub AddAuditAccessAce 0009 stub AdjustTokenGroups -0010 stub AdjustTokenPrivileges +0010 stdcall AdjustTokenPrivileges(long long ptr long ptr ptr) AdjustTokenPrivileges 0011 stdcall AllocateAndInitializeSid(ptr long long long long long long long long long ptr) AllocateAndInitializeSid 0012 stdcall AllocateLocallyUniqueId(ptr) AllocateLocallyUniqueId 0013 stub AreAllAccessesGranted @@ -94,7 +94,7 @@ base 0 0089 stub LookupPrivilegeDisplayNameW 0090 stub LookupPrivilegeNameA 0091 stub LookupPrivilegeNameW -0092 stub LookupPrivilegeValueA +0092 stdcall LookupPrivilegeValueA(ptr ptr ptr) LookupPrivilegeValue32A 0093 stub LookupPrivilegeValueW 0094 stub MakeAbsoluteSD 0095 stub MakeSelfRelativeSD diff --git a/if1632/builtin.c b/if1632/builtin.c index 288e3633010..16756875640 100644 --- a/if1632/builtin.c +++ b/if1632/builtin.c @@ -148,7 +148,7 @@ static BUILTIN_DLL BuiltinDLLs[] = /* Win32 DLLs */ { &ADVAPI32_Descriptor, 0 }, { &COMCTL32_Descriptor, DLL_FLAG_NOT_USED }, - { &COMDLG32_Descriptor, DLL_FLAG_NOT_USED }, + { &COMDLG32_Descriptor, 0 }, { &CRTDLL_Descriptor, 0 }, { &OLE32_Descriptor, DLL_FLAG_NOT_USED }, { &GDI32_Descriptor, 0 }, diff --git a/if1632/comdlg32.spec b/if1632/comdlg32.spec index b6fa002b9c0..a42e1a142d6 100644 --- a/if1632/comdlg32.spec +++ b/if1632/comdlg32.spec @@ -7,15 +7,15 @@ base 1 0002 stub ChooseColorW 0003 stub ChooseFontA 0004 stub ChooseFontW -0005 stub CommDlgExtendedError +0005 stdcall CommDlgExtendedError() CommDlgExtendedError 0006 stub FindTextA 0007 stub FindTextW -0008 stub GetFileTitleA -0009 stub GetFileTitleW -0010 stub GetOpenFileNameA -0011 stub GetOpenFileNameW -0012 stub GetSaveFileNameA -0013 stub GetSaveFileNameW +0008 stdcall GetFileTitleA(ptr ptr long) GetFileTitle32A +0009 stdcall GetFileTitleW(ptr ptr long) GetFileTitle32W +0010 stdcall GetOpenFileNameA(ptr) GetOpenFileName32A +0011 stdcall GetOpenFileNameW(ptr) GetOpenFileName32W +0012 stdcall GetSaveFileNameA(ptr) GetSaveFileName32A +0013 stdcall GetSaveFileNameW(ptr) GetSaveFileName32A 0014 stub LoadAlterBitmap 0015 stub PageSetupDlgA 0016 stub PageSetupDlgW diff --git a/if1632/commdlg.spec b/if1632/commdlg.spec index 5eb618148db..1a705ea55a5 100644 --- a/if1632/commdlg.spec +++ b/if1632/commdlg.spec @@ -1,8 +1,8 @@ name commdlg type win16 -1 pascal16 GetOpenFileName(segptr) GetOpenFileName -2 pascal16 GetSaveFileName(segptr) GetSaveFileName +1 pascal16 GetOpenFileName(segptr) GetOpenFileName16 +2 pascal16 GetSaveFileName(segptr) GetSaveFileName16 5 pascal16 ChooseColor(ptr) ChooseColor 6 pascal FileOpenDlgProc(word word word long) FileOpenDlgProc 7 pascal FileSaveDlgProc(word word word long) FileSaveDlgProc @@ -22,7 +22,7 @@ type win16 #23 pascal EDITINTEGERONLY exported, shared data #25 pascal WANTARROWS exported, shared data 26 pascal CommDlgExtendedError() CommDlgExtendedError -27 pascal16 GetFileTitle(ptr ptr word) GetFileTitle +27 pascal16 GetFileTitle(str ptr word) GetFileTitle16 #28 pascal WEP exported, shared data #29 pascal DWLBSUBCLASS exported, shared data #30 pascal DWUPARROWHACK exported, shared data diff --git a/if1632/crtdll.spec b/if1632/crtdll.spec index 7e43ce9f577..42a88053f96 100644 --- a/if1632/crtdll.spec +++ b/if1632/crtdll.spec @@ -431,7 +431,7 @@ base 1 426 stub longjmp 427 cdecl malloc(ptr) CRTDLL_malloc 428 stub mblen -429 stub mbstowcs +429 cdecl mbstowcs(ptr ptr long) CRTDLL_mbstowcs 430 cdecl mbtowc(long) CRTDLL_mbtowc 431 cdecl memchr(ptr long long) memchr 432 cdecl memcmp(ptr ptr long) memcmp diff --git a/if1632/ddeml.spec b/if1632/ddeml.spec index 12c1420b953..8da729c8d34 100644 --- a/if1632/ddeml.spec +++ b/if1632/ddeml.spec @@ -20,9 +20,9 @@ type win16 18 stub DdeUnaccessData #(word) DdeUnaccessData 19 stub DdeFreeDataHandle #(word) DdeFreeDataHandle 20 stub DdeGetLastError #(long) DdeGetLastError -21 stub DdeCreateStringHandle #(long ptr word) DdeCreateStringHandle +21 stub DdeCreateStringHandle #(long str word) DdeCreateStringHandle 22 stub DdeFreeStringHandle #(long word) DdeFreeStringHandle -23 stub DdeQueryString #(long word ptr long word) DdeQueryString +23 stub DdeQueryString #(long word ptr long word) DdeQueryString 24 stub DdeKeepStringHandle #(long word) DdeKeepStringHandle 26 stub DdeEnableCallback #(long word word) DdeEnableCallback diff --git a/if1632/dummy.c b/if1632/dummy.c index cb0758eb4cd..abc792eda84 100644 --- a/if1632/dummy.c +++ b/if1632/dummy.c @@ -44,3 +44,4 @@ long stub_USER_919(void) { fprintf(stderr, "Warning: USER_919: unimplemented stu long stub_USER_920(void) { fprintf(stderr, "Warning: USER_920: unimplemented stub\n"); return 0; } long stub_USER_922(void) { fprintf(stderr, "Warning: USER_922: unimplemented stub\n"); return 0; } long stub_USER_923(void) { fprintf(stderr, "Warning: USER_923: unimplemented stub\n"); return 0; } +long stub_KERNEL_700(void) { fprintf(stderr, "Warning: KERNEL_700: unimplemented stub\n"); return 1; } diff --git a/if1632/gdi.spec b/if1632/gdi.spec index 4db37d0531a..f1ef2bd4c19 100644 --- a/if1632/gdi.spec +++ b/if1632/gdi.spec @@ -63,7 +63,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 54 pascal16 CreateEllipticRgn(s_word s_word s_word s_word) CreateEllipticRgn16 55 pascal16 CreateEllipticRgnIndirect(ptr) CreateEllipticRgnIndirect16 56 pascal16 CreateFont(s_word s_word s_word s_word s_word word word word - word word word word word ptr) CreateFont16 + word word word word word str) CreateFont16 57 pascal16 CreateFontIndirect(ptr) CreateFontIndirect16 58 pascal16 CreateHatchBrush(word long) CreateHatchBrush16 60 pascal16 CreatePatternBrush(word) CreatePatternBrush16 @@ -76,7 +76,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 67 pascal16 DPtoLP(word ptr s_word) DPtoLP16 68 pascal16 DeleteDC(word) DeleteDC16 69 pascal16 DeleteObject(word) DeleteObject16 -70 pascal16 EnumFonts(word ptr segptr long) THUNK_EnumFonts16 +70 pascal16 EnumFonts(word str segptr long) THUNK_EnumFonts16 71 pascal16 EnumObjects(word word segptr long) THUNK_EnumObjects16 72 pascal16 EqualRgn(word word) EqualRgn16 73 pascal16 ExcludeVisRect(word s_word s_word s_word s_word) ExcludeVisRect @@ -115,28 +115,28 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 105 pascal16 SelectVisRgn(word word) SelectVisRgn 106 pascal SetBitmapBits(word long ptr) SetBitmapBits16 117 pascal SetDCOrg(word s_word s_word) SetDCOrg -119 pascal16 AddFontResource(ptr) AddFontResource16 +119 pascal16 AddFontResource(str) AddFontResource16 #121 pascal Death #122 pascal ReSurRection 123 pascal16 PlayMetaFile(word word) PlayMetaFile16 -124 pascal16 GetMetaFile(ptr) GetMetaFile16 -125 pascal16 CreateMetaFile(ptr) CreateMetaFile16 +124 pascal16 GetMetaFile(str) GetMetaFile16 +125 pascal16 CreateMetaFile(str) CreateMetaFile16 126 pascal16 CloseMetaFile(word) CloseMetaFile16 127 pascal16 DeleteMetaFile(word) DeleteMetaFile16 128 pascal16 MulDiv(s_word s_word s_word) MulDiv16 129 pascal16 SaveVisRgn(word) SaveVisRgn 130 pascal16 RestoreVisRgn(word) RestoreVisRgn 131 pascal16 InquireVisRgn(word) InquireVisRgn -132 pascal16 SetEnvironment(ptr ptr word) SetEnvironment -133 pascal16 GetEnvironment(ptr ptr word) GetEnvironment +132 pascal16 SetEnvironment(str str word) SetEnvironment +133 pascal16 GetEnvironment(str str word) GetEnvironment 134 pascal16 GetRgnBox(word ptr) GetRgnBox16 #135 pascal ScanLr -136 pascal16 RemoveFontResource(ptr) RemoveFontResource16 +136 pascal16 RemoveFontResource(segptr) RemoveFontResource16 148 pascal SetBrushOrg(word s_word s_word) SetBrushOrg 149 pascal GetBrushOrg(word) GetBrushOrg 150 pascal16 UnrealizeObject(word) UnrealizeObject16 -151 pascal16 CopyMetaFile(word ptr) CopyMetaFile16 -153 pascal16 CreateIC(ptr ptr ptr ptr) CreateIC16 +151 pascal16 CopyMetaFile(word str) CopyMetaFile16 +153 pascal16 CreateIC(str str str ptr) CreateIC16 154 pascal GetNearestColor(word long) GetNearestColor16 155 stub QueryAbort 156 pascal16 CreateDiscardableBitmap(word word word) CreateDiscardableBitmap16 @@ -219,7 +219,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 307 pascal16 GetCharABCWidths(word word word ptr) GetCharABCWidths16 308 stub GetOutLineTextMetrics 309 pascal GetGlyphOutline(word word word ptr long ptr ptr) GetGlyphOutline16 -310 pascal16 CreateScalableFontResource(word ptr ptr ptr) CreateScalableFontResource16 +310 pascal16 CreateScalableFontResource(word str str str) CreateScalableFontResource16 311 stub GetFontData 312 stub ConvertOutLineFontFile 313 pascal16 GetRasterizerCaps(ptr word) GetRasterizerCaps16 @@ -227,7 +227,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 315 stub EngineRealizeFontExt 316 stub EngineGetCharWidthStr 317 stub EngineGetGlyphBmpExt -330 pascal16 EnumFontFamilies(word ptr segptr long) THUNK_EnumFontFamilies16 +330 pascal16 EnumFontFamilies(word str segptr long) THUNK_EnumFontFamilies16 332 pascal16 GetKerningPairs(word word ptr) GetKerningPairs16 345 pascal16 GetTextAlign(word) GetTextAlign16 346 pascal16 SetTextAlign(word word) SetTextAlign16 @@ -380,7 +380,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 609 stub GDIFreeResources 610 stub GDISignalProc32 611 stub GetRandomRgn -612 stub GetTextCharSet +612 pascal16 GetTextCharset(word) GetTextCharset16 613 pascal16 EnumFontFamiliesEx(word ptr segptr long long) THUNK_EnumFontFamiliesEx16 614 stub AddLpkToGDI 615 stub GetCharacterPlacement diff --git a/if1632/gdi32.spec b/if1632/gdi32.spec index 7e6131e6e66..5cf890af671 100644 --- a/if1632/gdi32.spec +++ b/if1632/gdi32.spec @@ -134,7 +134,7 @@ base 1 0126 stub GdiDeleteLocalDC 0127 stub GdiDeleteLocalObject 0128 stub GdiFlush -0129 stub GdiGetBatchLimit +0129 return GdiGetBatchLimit 0 1 0130 stub GdiGetLocalBrush 0131 stub GdiGetLocalDC 0132 stub GdiGetLocalFont @@ -193,7 +193,7 @@ base 1 0185 stub GetGlyphOutline 0186 stdcall GetGlyphOutlineA(long long long ptr long ptr ptr) GetGlyphOutline32A 0187 stdcall GetGlyphOutlineW(long long long ptr long ptr ptr) GetGlyphOutline32W -0188 stub GetGraphicsMode +0188 return GetGraphicsMode 4 1 # just return 1 0189 stub GetICMProfileA 0190 stub GetICMProfileW 0191 stub GetKerningPairs @@ -231,7 +231,7 @@ base 1 0223 stdcall GetSystemPaletteUse() GetSystemPaletteUse32 0224 stdcall GetTextAlign(long) GetTextAlign32 0225 stdcall GetTextCharacterExtra(long) GetTextCharacterExtra32 -0226 stub GetTextCharset +0226 stdcall GetTextCharset(long) GetTextCharset32 0227 stdcall GetTextColor(long) GetTextColor32 0228 stdcall GetTextExtentExPointA(long ptr long long ptr ptr ptr) GetTextExtentExPoint32A 0229 stdcall GetTextExtentExPointW(long ptr long long ptr ptr ptr) GetTextExtentExPoint32W @@ -249,7 +249,7 @@ base 1 0241 stub GetWinMetaFileBits 0242 stdcall GetWindowExtEx(long ptr) GetWindowExtEx32 0243 stdcall GetWindowOrgEx(long ptr) GetWindowOrgEx32 -0244 stub GetWorldTransform +0244 return GetWorldTransform 8 0 0245 stdcall IntersectClipRect(long long long long long) IntersectClipRect32 0246 stdcall InvertRgn(long long) InvertRgn32 0247 stdcall LPtoDP(long ptr long) LPtoDP32 @@ -323,7 +323,7 @@ base 1 0314 stub SetDeviceGammaRamp 0315 stub SetEnhMetaFileBits 0316 stub SetFontEnumeration -0317 stub SetGraphicsMode +0317 return SetGraphicsMode 8 1 0318 stub SetICMMode 0319 stub SetICMProfileA 0320 stub SetICMProfileW diff --git a/if1632/kernel.spec b/if1632/kernel.spec index af3761c8917..6c4c9a9ed8e 100644 --- a/if1632/kernel.spec +++ b/if1632/kernel.spec @@ -41,7 +41,7 @@ type win16 38 pascal SetTaskSignalProc(word segptr) SetTaskSignalProc 41 return EnableDos 0 0 42 return DisableDos 0 0 -45 pascal16 LoadModule(ptr ptr) LoadModule16 +45 pascal16 LoadModule(str ptr) LoadModule16 46 pascal16 FreeModule(word) FreeModule16 47 pascal16 GetModuleHandle(segptr) WIN16_GetModuleHandle 48 pascal16 GetModuleUsage(word) GetModuleUsage @@ -53,9 +53,9 @@ type win16 54 pascal16 GetInstanceData(word word word) GetInstanceData 55 pascal16 Catch(ptr) Catch 56 pascal16 Throw(ptr word) Throw -57 pascal16 GetProfileInt(ptr ptr s_word) GetProfileInt16 -58 pascal16 GetProfileString(ptr ptr ptr ptr word) GetProfileString16 -59 pascal16 WriteProfileString(ptr ptr ptr) WriteProfileString16 +57 pascal16 GetProfileInt(str str s_word) GetProfileInt16 +58 pascal16 GetProfileString(str str str ptr word) GetProfileString16 +59 pascal16 WriteProfileString(str str str) WriteProfileString16 60 pascal16 FindResource(word segptr segptr) FindResource16 61 pascal16 LoadResource(word word) LoadResource16 62 pascal LockResource(word) WIN16_LockResource16 @@ -63,14 +63,14 @@ type win16 64 pascal16 AccessResource(word word) AccessResource16 65 pascal SizeofResource(word word) SizeofResource16 66 pascal16 AllocResource(word word long) AllocResource16 -67 pascal SetResourceHandler(word ptr ptr) SetResourceHandler +67 pascal SetResourceHandler(word segptr ptr) SetResourceHandler 68 pascal16 InitAtomTable(word) InitAtomTable16 69 pascal16 FindAtom(segptr) FindAtom16 70 pascal16 AddAtom(segptr) AddAtom16 71 pascal16 DeleteAtom(word) DeleteAtom16 72 pascal16 GetAtomName(word ptr word) GetAtomName16 73 pascal16 GetAtomHandle(word) GetAtomHandle -74 pascal16 OpenFile(ptr ptr word) OpenFile16 +74 pascal16 OpenFile(str ptr word) OpenFile16 75 stub OpenPathName 76 stub DeletePathName 77 stub KERNEL_77 #RESERVED1 @@ -79,21 +79,21 @@ type win16 #80 RESERVED4 81 pascal16 _lclose(word) _lclose16 82 pascal16 _lread(word segptr word) WIN16_lread -83 pascal16 _lcreat(ptr word) _lcreat16 +83 pascal16 _lcreat(str word) _lcreat16 84 pascal _llseek(word long word) _llseek16 -85 pascal16 _lopen(ptr word) _lopen16 +85 pascal16 _lopen(str word) _lopen16 86 pascal16 _lwrite(word ptr word) _lwrite16 -87 pascal16 RESERVED5(ptr ptr) lstrcmp16 -88 pascal lstrcpy(segptr segptr) lstrcpy16 -89 pascal lstrcat(segptr segptr) lstrcat16 -90 pascal16 lstrlen(ptr) lstrlen16 +87 pascal16 RESERVED5(str str) lstrcmp16 +88 pascal lstrcpy(segptr str) lstrcpy16 +89 pascal lstrcat(segptr str) lstrcat16 +90 pascal16 lstrlen(str) lstrlen16 91 register InitTask() InitTask 92 pascal GetTempDrive(byte) WIN16_GetTempDrive 93 pascal16 GetCodeHandle(segptr) GetCodeHandle 94 stub DefineHandleTable -95 pascal16 LoadLibrary(ptr) LoadLibrary16 +95 pascal16 LoadLibrary(str) LoadLibrary16 96 pascal16 FreeLibrary(word) FreeLibrary16 -97 pascal16 GetTempFileName(byte ptr word ptr) GetTempFileName16 +97 pascal16 GetTempFileName(byte str word ptr) GetTempFileName16 98 return GetLastDiskChange 0 0 99 stub GetLPErrMode 100 return ValidateCodeSegments 0 0 @@ -111,7 +111,7 @@ type win16 112 pascal16 GlobalUnWire(word) GlobalUnWire16 113 equate __AHSHIFT 3 114 equate __AHINCR 8 -115 pascal16 OutputDebugString(ptr) OutputDebugString16 +115 pascal16 OutputDebugString(str) OutputDebugString16 116 stub InitLib 117 pascal16 OldYield() OldYield 118 register GetTaskQueueDS() GetTaskQueueDS @@ -123,10 +123,10 @@ type win16 124 return EnableKernel 0 0 125 return DisableKernel 0 0 126 stub MemoryFreed -127 pascal16 GetPrivateProfileInt(ptr ptr s_word ptr) GetPrivateProfileInt16 -128 pascal16 GetPrivateProfileString(ptr ptr ptr ptr word ptr) +127 pascal16 GetPrivateProfileInt(str str s_word str) GetPrivateProfileInt16 +128 pascal16 GetPrivateProfileString(str str str ptr word str) GetPrivateProfileString16 -129 pascal16 WritePrivateProfileString(ptr ptr ptr ptr) +129 pascal16 WritePrivateProfileString(str str str str) WritePrivateProfileString16 130 pascal FileCDR(ptr) FileCDR 131 pascal GetDOSEnvironment() GetDOSEnvironment @@ -135,7 +135,7 @@ type win16 134 pascal16 GetWindowsDirectory(ptr word) GetWindowsDirectory16 135 pascal16 GetSystemDirectory(ptr word) GetSystemDirectory16 136 pascal16 GetDriveType(byte) GetDriveType16 -137 pascal16 FatalAppExit(word ptr) FatalAppExit16 +137 pascal16 FatalAppExit(word str) FatalAppExit16 138 pascal GetHeapSpaces(word) GetHeapSpaces 139 stub DoSignal 140 pascal16 SetSigHandler(segptr ptr ptr word word) SetSigHandler @@ -163,7 +163,7 @@ type win16 163 pascal16 GlobalLRUOldest(word) GlobalLRUOldest 164 pascal16 GlobalLRUNewest(word) GlobalLRUNewest 165 return A20Proc 2 0 -166 pascal16 WinExec(ptr word) WinExec16 +166 pascal16 WinExec(str word) WinExec16 167 pascal16 GetExpWinVer(word) GetExpWinVer 168 pascal16 DirectResAlloc(word word word) DirectResAlloc 169 pascal GetFreeSpace(word) GetFreeSpace16 @@ -268,8 +268,8 @@ type win16 349 pascal _hread(word segptr long) WIN16_hread 350 pascal _hwrite(word ptr long) _hwrite16 #351 BUNNY_351 -352 pascal lstrcatn(segptr segptr word) lstrcatn16 -353 pascal lstrcpyn(segptr segptr word) lstrcpyn16 +352 pascal lstrcatn(segptr str word) lstrcatn16 +353 pascal lstrcpyn(segptr str word) lstrcpyn16 354 pascal GetAppCompatFlags(word) GetAppCompatFlags16 355 pascal16 GetWinDebugInfo(ptr word) GetWinDebugInfo 356 pascal16 SetWinDebugInfo(ptr) SetWinDebugInfo @@ -311,6 +311,7 @@ type win16 472 stub KERNEL_472 473 stub KERNEL_473 482 stub KERNEL_482 +485 stub KERNEL_485 491 stub RegisterServiceProcess 500 stub KERNEL_500 502 stub KERNEL_502 @@ -338,4 +339,4 @@ type win16 630 stub KERNEL_630 631 stub FUNC004 # shell hook 651 stub KERNEL_651 -700 return KERNEL_700 0 1 +700 pascal KERNEL_700() stub_KERNEL_700 diff --git a/if1632/lzexpand.spec b/if1632/lzexpand.spec index a12c7e223f8..134347c046f 100644 --- a/if1632/lzexpand.spec +++ b/if1632/lzexpand.spec @@ -2,7 +2,7 @@ name lzexpand type win16 1 pascal LZCopy(word word) LZCopy16 -2 pascal16 LZOpenFile(ptr ptr word) LZOpenFile16 +2 pascal16 LZOpenFile(str ptr word) LZOpenFile16 3 pascal16 LZInit(word) LZInit16 4 pascal LZSeek(word long word) LZSeek16 5 pascal16 LZRead(word ptr word) LZRead16 @@ -10,6 +10,6 @@ type win16 7 pascal16 LZStart() LZStart16 8 pascal CopyLZFile(word word) CopyLZFile16 9 pascal16 LZDone() LZDone -10 pascal16 GetExpandedName(ptr ptr) GetExpandedName16 +10 pascal16 GetExpandedName(str ptr) GetExpandedName16 #11 WEP #12 ___EXPORTEDSTUB diff --git a/if1632/olesvr.spec b/if1632/olesvr.spec index 922da545e8f..3eac9779c7a 100644 --- a/if1632/olesvr.spec +++ b/if1632/olesvr.spec @@ -2,11 +2,11 @@ name olesvr type win16 #1 WEP -2 pascal OleRegisterServer(ptr ptr ptr word word) OleRegisterServer +2 pascal OleRegisterServer(str ptr ptr word word) OleRegisterServer 3 pascal OleRevokeServer(long) OleRevokeServer 4 pascal OleBlockServer(long) OleBlockServer 5 pascal OleUnblockServer(long ptr) OleUnblockServer -6 pascal OleRegisterServerDoc(long ptr ptr ptr) OleRegisterServerDoc +6 pascal OleRegisterServerDoc(long str ptr ptr) OleRegisterServerDoc 7 pascal OleRevokeServerDoc(long) OleRevokeServerDoc 8 stub OLERENAMESERVERDOC 9 stub OLEREVERTSERVERDOC diff --git a/if1632/relay.c b/if1632/relay.c index 7f478f1bd7a..642f0e7b910 100644 --- a/if1632/relay.c +++ b/if1632/relay.c @@ -82,6 +82,7 @@ void RELAY_DebugCallFrom16( int func_type, char *args, break; case 'l': case 'p': + case 't': args16 += 4; break; } @@ -100,6 +101,14 @@ void RELAY_DebugCallFrom16( int func_type, char *args, args16 -= 4; printf( "0x%08x", *(int *)args16 ); break; + case 't': + args16 -= 4; + if (HIWORD(*(int *)args16)) + printf( "0x%08x \"%s\"", *(int *)args16, + (char *)PTR_SEG_TO_LIN(*(int *)args16) ); + else + printf( "0x%08x", *(int *)args16 ); + break; case 'p': args16 -= 4; printf( "%04x:%04x", *(WORD *)(args16+2), *(WORD *)args16 ); @@ -386,6 +395,7 @@ WIN16_CallProc32W() { DWORD argconvmask = win_stack[1]; FARPROC32 proc32 = (FARPROC32)win_stack[2]; DWORD *args,ret; + STACK16FRAME stf16; int i; fprintf(stderr,"CallProc32W(%ld,%ld,%p,args[",nrofargs,argconvmask,proc32); @@ -419,6 +429,16 @@ WIN16_CallProc32W() { ret = 0; break; } + /* POP nrofargs DWORD arguments and 3 DWORD parameters */ + /* FIXME: this is a BAD hack, but I don't see any other way to + * pop a variable number of arguments. -MM + * The -2 in the size is for not copying WORD args[0] (which would + * overwrite the top WORD on the return stack) + */ + memcpy(&stf16,CURRENT_STACK16,sizeof(stf16)-2); + IF1632_Saved16_sp += (3+nrofargs)*sizeof(DWORD); + memcpy(CURRENT_STACK16,&stf16,sizeof(stf16)-2); + fprintf(stderr,"returns %08lx\n",ret); free(args); return ret; diff --git a/if1632/shell.spec b/if1632/shell.spec index 74e9ef37425..00ec20e5893 100644 --- a/if1632/shell.spec +++ b/if1632/shell.spec @@ -1,22 +1,22 @@ name shell type win16 - 1 pascal RegOpenKey(long ptr ptr) RegOpenKey16 - 2 pascal RegCreateKey(long ptr ptr) RegCreateKey16 + 1 pascal RegOpenKey(long str ptr) RegOpenKey16 + 2 pascal RegCreateKey(long str ptr) RegCreateKey16 3 pascal RegCloseKey(long) RegCloseKey - 4 pascal RegDeleteKey(long ptr) RegDeleteKey16 - 5 pascal RegSetValue(long ptr long ptr long) RegSetValue16 - 6 pascal RegQueryValue(long ptr ptr ptr) RegQueryValue16 + 4 pascal RegDeleteKey(long str) RegDeleteKey16 + 5 pascal RegSetValue(long str long str long) RegSetValue16 + 6 pascal RegQueryValue(long str ptr ptr) RegQueryValue16 7 pascal RegEnumKey(long long ptr long) RegEnumKey16 9 pascal16 DragAcceptFiles(word word) DragAcceptFiles 11 pascal16 DragQueryFile(word s_word ptr s_word) DragQueryFile 12 pascal16 DragFinish(word) DragFinish 13 pascal16 DragQueryPoint(word ptr) DragQueryPoint - 20 pascal16 ShellExecute(word ptr ptr ptr ptr s_word) ShellExecute16 - 21 pascal16 FindExecutable(ptr ptr ptr) FindExecutable16 + 20 pascal16 ShellExecute(word str str str str s_word) ShellExecute16 + 21 pascal16 FindExecutable(str str ptr) FindExecutable16 22 pascal16 ShellAbout(word ptr ptr word) ShellAbout16 33 pascal16 AboutDlgProc(word word word long) AboutDlgProc16 - 34 pascal16 ExtractIcon(word ptr s_word) ExtractIcon16 + 34 pascal16 ExtractIcon(word str s_word) ExtractIcon16 36 pascal16 ExtractAssociatedIcon(word ptr ptr) ExtractAssociatedIcon 37 pascal DoEnvironmentSubst(ptr word) DoEnvironmentSubst 38 pascal FindEnvironmentString(ptr) FindEnvironmentString diff --git a/if1632/user.spec b/if1632/user.spec index fe0c4f750c7..2977f4a052f 100644 --- a/if1632/user.spec +++ b/if1632/user.spec @@ -2,7 +2,7 @@ name user type win16 heap 65520 -1 pascal16 MessageBox(word ptr ptr word) MessageBox16 +1 pascal16 MessageBox(word str str word) MessageBox16 2 stub OldExitWindows 3 stub EnableOEMLayer 4 stub DisableOEMLayer @@ -40,7 +40,7 @@ heap 65520 38 pascal16 GetWindowTextLength(word) GetWindowTextLength16 39 pascal16 BeginPaint(word ptr) BeginPaint16 40 pascal16 EndPaint(word ptr) EndPaint16 -41 pascal16 CreateWindow(ptr ptr long s_word s_word s_word s_word +41 pascal16 CreateWindow(str str long s_word s_word s_word s_word word word word segptr) CreateWindow16 42 pascal16 ShowWindow(word word) ShowWindow16 43 pascal16 CloseWindow(word) CloseWindow16 @@ -50,7 +50,7 @@ heap 65520 47 pascal16 IsWindow(word) IsWindow16 48 pascal16 IsChild(word word) IsChild16 49 pascal16 IsWindowVisible(word) IsWindowVisible16 -50 pascal16 FindWindow(segptr ptr) FindWindow16 +50 pascal16 FindWindow(segptr str) FindWindow16 #51 BEAR51 52 pascal16 AnyPopup() AnyPopup16 53 pascal16 DestroyWindow(word) DestroyWindow16 @@ -170,7 +170,7 @@ heap 65520 168 pascal16 SetCaretBlinkTime(word) SetCaretBlinkTime16 169 pascal16 GetCaretBlinkTime() GetCaretBlinkTime16 170 pascal16 ArrangeIconicWindows(word) ArrangeIconicWindows16 -171 pascal16 WinHelp(word ptr word long) WinHelp16 +171 pascal16 WinHelp(word str word long) WinHelp16 172 pascal16 SwitchToThisWindow(word word) SwitchToThisWindow16 173 pascal16 LoadCursor(word segptr) LoadCursor16 174 pascal16 LoadIcon(word segptr) LoadIcon16 @@ -200,7 +200,7 @@ heap 65520 197 pascal GetTabbedTextExtent(word ptr word word ptr) GetTabbedTextExtent16 198 pascal16 CascadeChildWindows(word word) CascadeChildWindows 199 pascal16 TileChildWindows(word word) TileChildWindows -200 pascal16 OpenComm(ptr word word) OpenComm +200 pascal16 OpenComm(str word word) OpenComm 201 pascal16 SetCommState(ptr) SetCommState16 202 pascal16 GetCommState(word ptr) GetCommState16 203 pascal16 GetCommError(word ptr) GetCommError @@ -254,7 +254,7 @@ heap 65520 249 pascal16 GetAsyncKeyState(word) GetAsyncKeyState16 250 pascal16 GetMenuState(word word word) GetMenuState16 251 pascal SendDriverMessage(word word long long) SendDriverMessage -252 pascal16 OpenDriver(ptr ptr long) OpenDriver +252 pascal16 OpenDriver(str str long) OpenDriver 253 pascal CloseDriver(word long long) CloseDriver 254 pascal16 GetDriverModuleHandle(word) GetDriverModuleHandle 255 pascal DefDriverProc(long word word long long) DefDriverProc @@ -377,15 +377,15 @@ heap 65520 427 pascal16 FindWindowEx(word word segptr ptr) FindWindowEx16 428 stub TileWindows 429 stub CascadeWindows -430 pascal16 lstrcmp(ptr ptr) lstrcmp16 +430 pascal16 lstrcmp(str str) lstrcmp16 431 pascal AnsiUpper(segptr) AnsiUpper16 432 pascal AnsiLower(segptr) AnsiLower16 433 pascal16 IsCharAlpha(byte) IsCharAlpha16 434 pascal16 IsCharAlphanumeric(byte) IsCharAlphanumeric16 435 pascal16 IsCharUpper(byte) IsCharUpper16 436 pascal16 IsCharLower(byte) IsCharLower16 -437 pascal16 AnsiUpperBuff(ptr word) AnsiUpperBuff16 -438 pascal16 AnsiLowerBuff(ptr word) AnsiLowerBuff16 +437 pascal16 AnsiUpperBuff(str word) AnsiUpperBuff16 +438 pascal16 AnsiLowerBuff(str word) AnsiLowerBuff16 441 stub InsertMenuItem 443 stub GetMenuItemInfo 445 pascal DefFrameProc(word word word word long) DefFrameProc16 @@ -395,7 +395,7 @@ heap 65520 449 stub DrawState 450 stub CreateIconFromResourceEx 451 pascal16 TranslateMDISysAccel(word ptr) TranslateMDISysAccel16 -452 pascal16 CreateWindowEx(long ptr ptr long s_word s_word s_word s_word +452 pascal16 CreateWindowEx(long str str long s_word s_word s_word s_word word word word segptr) CreateWindowEx16 454 pascal16 AdjustWindowRectEx(ptr long word long) AdjustWindowRectEx16 455 pascal16 GetIconID(word long) GetIconID @@ -411,7 +411,7 @@ heap 65520 465 pascal16 DragDetect(word long) DragDetect16 466 pascal16 DrawFocusRect(word ptr) DrawFocusRect16 470 stub StringFunc -471 pascal16 lstrcmpi(ptr ptr) lstrcmpi16 +471 pascal16 lstrcmpi(str str) lstrcmpi16 472 pascal AnsiNext(segptr) AnsiNext16 473 pascal AnsiPrev(segptr segptr) AnsiPrev16 475 pascal16 SetScrollInfo(word s_word ptr word) SetScrollInfo16 diff --git a/if1632/user32.spec b/if1632/user32.spec index ff7dd1aca66..0256cb05b50 100644 --- a/if1632/user32.spec +++ b/if1632/user32.spec @@ -140,7 +140,7 @@ base 1 0133 stdcall DestroyMenu(long) DestroyMenu32 0134 stdcall DestroyWindow(long) DestroyWindow32 0135 stdcall DialogBoxIndirectParamA(long ptr long ptr long) DialogBoxIndirectParam32A -0136 stub DialogBoxIndirectParamAorW +0136 stdcall DialogBoxIndirectParamAorW(long ptr long ptr long) DialogBoxIndirectParam32A 0137 stdcall DialogBoxIndirectParamW(long ptr long ptr long) DialogBoxIndirectParam32W 0138 stdcall DialogBoxParamA(long ptr long ptr long) DialogBoxParam32A 0139 stdcall DialogBoxParamW(long ptr long ptr long) DialogBoxParam32W diff --git a/include/commdlg.h b/include/commdlg.h index 4e85561d1c3..61ac06fc7fe 100644 --- a/include/commdlg.h +++ b/include/commdlg.h @@ -43,6 +43,9 @@ extern "C" { #define OFN_NOREADONLYRETURN 0x00008000 #define OFN_NOTESTFILECREATE 0x00010000 +#define OFN_UNICODE 0x40000000 /*to differ between 32W/A hook*/ +#define OFN_WINE32 0x80000000 /* comdlg32 */ + #define OFN_SHAREFALLTHROUGH 2 #define OFN_SHARENOWARN 1 #define OFN_SHAREWARN 0 @@ -68,9 +71,56 @@ typedef struct { LPARAM lCustData; WNDPROC16 lpfnHook; SEGPTR lpTemplateName; - } OPENFILENAME; -typedef OPENFILENAME * LPOPENFILENAME; +} OPENFILENAME16,*LPOPENFILENAME16; +typedef struct { + DWORD lStructSize; + HWND32 hwndOwner; + HINSTANCE32 hInstance; + LPCSTR lpstrFilter; + LPSTR lpstrCustomFilter; + DWORD nMaxCustFilter; + DWORD nFilterIndex; + LPSTR lpstrFile; + DWORD nMaxFile; + LPSTR lpstrFileTitle; + DWORD nMaxFileTitle; + LPCSTR lpstrInitialDir; + LPCSTR lpstrTitle; + DWORD Flags; + WORD nFileOffset; + WORD nFileExtension; + LPCSTR lpstrDefExt; + LPARAM lCustData; + WNDPROC32 lpfnHook; + LPCSTR lpTemplateName; +} OPENFILENAME32A,*LPOPENFILENAME32A; + +typedef struct { + DWORD lStructSize; + HWND32 hwndOwner; + HINSTANCE32 hInstance; + LPCWSTR lpstrFilter; + LPWSTR lpstrCustomFilter; + DWORD nMaxCustFilter; + DWORD nFilterIndex; + LPWSTR lpstrFile; + DWORD nMaxFile; + LPWSTR lpstrFileTitle; + DWORD nMaxFileTitle; + LPCWSTR lpstrInitialDir; + LPCWSTR lpstrTitle; + DWORD Flags; + WORD nFileOffset; + WORD nFileExtension; + LPCWSTR lpstrDefExt; + LPARAM lCustData; + WNDPROC32 lpfnHook; + LPCWSTR lpTemplateName; +} OPENFILENAME32W,*LPOPENFILENAME32W; + +DECL_WINELIB_TYPE_AW(OPENFILENAME); +DECL_WINELIB_TYPE_AW(LPOPENFILENAME); typedef struct { DWORD lStructSize; @@ -82,7 +132,7 @@ typedef struct { LPARAM lCustData; WNDPROC16 lpfnHook; SEGPTR lpTemplateName; - } CHOOSECOLOR; +} CHOOSECOLOR; typedef CHOOSECOLOR *LPCHOOSECOLOR; #define CC_RGBINIT 0x00000001 @@ -278,9 +328,18 @@ typedef DEVNAMES * LPDEVNAMES; BOOL16 ChooseColor(LPCHOOSECOLOR lpChCol); DWORD CommDlgExtendedError(void); HWND16 FindText( SEGPTR find); -short GetFileTitle(LPCSTR lpFile, LPSTR lpTitle, UINT16 cbBuf); -BOOL16 GetOpenFileName(SEGPTR ofn); -BOOL16 GetSaveFileName(SEGPTR ofn); +INT16 GetFileTitle16(LPCSTR lpFile, LPSTR lpTitle, UINT16 cbBuf); +INT16 GetFileTitle32A(LPCSTR lpFile, LPSTR lpTitle, UINT32 cbBuf); +INT16 GetFileTitle32W(LPCWSTR lpFile, LPWSTR lpTitle, UINT32 cbBuf); +#define GetFileTitle WINELIB_NAME_AW(GetFileTitle) +BOOL16 GetOpenFileName16(SEGPTR ofn); +BOOL32 GetOpenFileName32A(LPOPENFILENAME32A ofn); +BOOL32 GetOpenFileName32W(LPOPENFILENAME32W ofn); +#define GetOpenFileName WINELIB_NAME_AW(GetOpenFileName) +BOOL16 GetSaveFileName16(SEGPTR ofn); +BOOL32 GetSaveFileName32A(LPOPENFILENAME32A ofn); +BOOL32 GetSaveFileName32W(LPOPENFILENAME32W ofn); +#define GetSaveFileName WINELIB_NAME_AW(GetSaveFileName) BOOL16 PrintDlg( SEGPTR print); HWND16 ReplaceText( SEGPTR find); BOOL16 ChooseFont(LPCHOOSEFONT lpChFont); diff --git a/include/mmsystem.h b/include/mmsystem.h index 29cb8ea7582..2941b4a266b 100644 --- a/include/mmsystem.h +++ b/include/mmsystem.h @@ -171,7 +171,8 @@ typedef struct wavehdr_tag { DWORD dwUser; /* for client's use */ DWORD dwFlags; /* assorted flags (see defines) */ DWORD dwLoops; /* loop control counter */ - struct wavehdr_tag *lpNext; /* reserved for driver */ +/* struct wavehdr_tag *lpNext;*/ + SEGPTR lp16Next; /* reserved for driver */ DWORD reserved; /* reserved for driver */ } WAVEHDR, *LPWAVEHDR; diff --git a/include/windows.h b/include/windows.h index dc3a49457b4..fe00984f6e1 100644 --- a/include/windows.h +++ b/include/windows.h @@ -5122,7 +5122,7 @@ INT16 SetEnvironment(LPCSTR,LPCSTR,UINT16); WORD SetHookFlags(HDC16,WORD); HMETAFILE16 SetMetaFileBits(HGLOBAL16); VOID SetPriority(HTASK16,INT16); -FARPROC16 SetResourceHandler(HINSTANCE16,LPSTR,FARPROC16); +FARPROC16 SetResourceHandler(HINSTANCE16,SEGPTR,FARPROC16); WORD SetSelectorBase(WORD,DWORD); WORD SetSelectorLimit(WORD,DWORD); LONG SetSwapAreaSize(WORD); @@ -6949,7 +6949,7 @@ BOOL16 RemoveDirectory16(LPCSTR); BOOL32 RemoveDirectory32A(LPCSTR); BOOL32 RemoveDirectory32W(LPCWSTR); #define RemoveDirectory WINELIB_NAME_AW(RemoveDirectory) -BOOL16 RemoveFontResource16(LPCSTR); +BOOL16 RemoveFontResource16(SEGPTR); BOOL32 RemoveFontResource32A(LPCSTR); BOOL32 RemoveFontResource32W(LPCWSTR); #define RemoveFontResource WINELIB_NAME_AW(RemoveFontResource) @@ -7413,11 +7413,11 @@ BOOL16 WriteProfileString16(LPCSTR,LPCSTR,LPCSTR); BOOL32 WriteProfileString32A(LPCSTR,LPCSTR,LPCSTR); BOOL32 WriteProfileString32W(LPCWSTR,LPCWSTR,LPCWSTR); #define WriteProfileString WINELIB_NAME_AW(WriteProfileString) -SEGPTR lstrcat16(SEGPTR,SEGPTR); +SEGPTR lstrcat16(SEGPTR,LPCSTR); LPSTR lstrcat32A(LPSTR,LPCSTR); LPWSTR lstrcat32W(LPWSTR,LPCWSTR); #define lstrcat WINELIB_NAME_AW(lstrcat) -SEGPTR lstrcatn16(SEGPTR,SEGPTR,INT16); +SEGPTR lstrcatn16(SEGPTR,LPCSTR,INT16); LPSTR lstrcatn32A(LPSTR,LPCSTR,INT32); LPWSTR lstrcatn32W(LPWSTR,LPCWSTR,INT32); #define lstrcatn WINELIB_NAME_AW(lstrcatn) @@ -7429,11 +7429,11 @@ INT16 lstrcmpi16(LPCSTR,LPCSTR); INT32 lstrcmpi32A(LPCSTR,LPCSTR); INT32 lstrcmpi32W(LPCWSTR,LPCWSTR); #define lstrcmpi WINELIB_NAME_AW(lstrcmpi) -SEGPTR lstrcpy16(SEGPTR,SEGPTR); +SEGPTR lstrcpy16(SEGPTR,LPCSTR); LPSTR lstrcpy32A(LPSTR,LPCSTR); LPWSTR lstrcpy32W(LPWSTR,LPCWSTR); #define lstrcpy WINELIB_NAME_AW(lstrcpy) -SEGPTR lstrcpyn16(SEGPTR,SEGPTR,INT16); +SEGPTR lstrcpyn16(SEGPTR,LPCSTR,INT16); LPSTR lstrcpyn32A(LPSTR,LPCSTR,INT32); LPWSTR lstrcpyn32W(LPWSTR,LPCWSTR,INT32); #define lstrcpyn WINELIB_NAME_AW(lstrcpyn) diff --git a/loader/resource.c b/loader/resource.c index 37dc9c1a58d..a569850298b 100644 --- a/loader/resource.c +++ b/loader/resource.c @@ -748,12 +748,14 @@ INT32 LoadMessage32W( HINSTANCE32 instance, UINT32 id, WORD lang, * SetResourceHandler (KERNEL.43) */ FARPROC16 -SetResourceHandler(HINSTANCE16 instance,LPSTR s,FARPROC16 farproc) +SetResourceHandler(HINSTANCE16 instance,SEGPTR s,FARPROC16 farproc) { if (HIWORD(s)) - fprintf(stderr,"SetResourceHandler(%04x,%s,%p), empty STUB!\n",instance,s,farproc); + fprintf(stderr,"SetResourceHandler(%04x,%s,%p), empty STUB!\n", + instance,(char*)PTR_SEG_TO_LIN(s),farproc); else - fprintf(stderr,"SetResourceHandler(%04x,0x%04x,%p), empty STUB!\n",instance,LOWORD(s),farproc); + fprintf(stderr,"SetResourceHandler(%04x,0x%04x,%p), empty STUB!\n", + instance,LOWORD(s),farproc); return NULL; } diff --git a/memory/string.c b/memory/string.c index 4df0d004001..05beae1a526 100644 --- a/memory/string.c +++ b/memory/string.c @@ -64,9 +64,9 @@ void hmemcpy( LPVOID dst, LPCVOID src, LONG count ) /*********************************************************************** * lstrcat16 (KERNEL.89) */ -SEGPTR lstrcat16( SEGPTR dst, SEGPTR src ) +SEGPTR lstrcat16( SEGPTR dst, LPCSTR src ) { - lstrcat32A( (LPSTR)PTR_SEG_TO_LIN(dst), (LPCSTR)PTR_SEG_TO_LIN(src) ); + lstrcat32A( (LPSTR)PTR_SEG_TO_LIN(dst), src ); return dst; } @@ -98,9 +98,9 @@ LPWSTR lstrcat32W( LPWSTR dst, LPCWSTR src ) /*********************************************************************** * lstrcatn16 (KERNEL.352) */ -SEGPTR lstrcatn16( SEGPTR dst, SEGPTR src, INT16 n ) +SEGPTR lstrcatn16( SEGPTR dst, LPCSTR src, INT16 n ) { - lstrcatn32A( (LPSTR)PTR_SEG_TO_LIN(dst), (LPCSTR)PTR_SEG_TO_LIN(src), n ); + lstrcatn32A( (LPSTR)PTR_SEG_TO_LIN(dst), src, n ); return dst; } @@ -212,9 +212,9 @@ INT32 lstrcmpi32W( LPCWSTR str1, LPCWSTR str2 ) /*********************************************************************** * lstrcpy16 (KERNEL.88) */ -SEGPTR lstrcpy16( SEGPTR dst, SEGPTR src ) +SEGPTR lstrcpy16( SEGPTR dst, LPCSTR src ) { - lstrcpy32A( (LPSTR)PTR_SEG_TO_LIN(dst), (LPCSTR)PTR_SEG_TO_LIN(src) ); + lstrcpy32A( (LPSTR)PTR_SEG_TO_LIN(dst), src ); return dst; } @@ -246,9 +246,9 @@ LPWSTR lstrcpy32W( LPWSTR dst, LPCWSTR src ) /*********************************************************************** * lstrcpyn16 (KERNEL.353) */ -SEGPTR lstrcpyn16( SEGPTR dst, SEGPTR src, INT16 n ) +SEGPTR lstrcpyn16( SEGPTR dst, LPCSTR src, INT16 n ) { - lstrcpyn32A( (LPSTR)PTR_SEG_TO_LIN(dst), (LPCSTR)PTR_SEG_TO_LIN(src), n ); + lstrcpyn32A( (LPSTR)PTR_SEG_TO_LIN(dst), src, n ); return dst; } diff --git a/misc/comm.c b/misc/comm.c index 9572070141d..df5b7c483c9 100644 --- a/misc/comm.c +++ b/misc/comm.c @@ -22,10 +22,9 @@ #include #include #if defined(__NetBSD__) || defined(__FreeBSD__) -#include -#else -#include +#include #endif +#include #include #include "windows.h" @@ -36,6 +35,10 @@ #include "debug.h" #include "handle32.h" +#ifndef TIOCINQ +#define TIOCINQ FIONREAD +#endif + /* * [RER] These are globals are wrong. They should be in DosDeviceStruct * on a per port basis. diff --git a/misc/commdlg.c b/misc/commdlg.c index 2f053daa020..4a4af0b63c1 100644 --- a/misc/commdlg.c +++ b/misc/commdlg.c @@ -56,44 +56,71 @@ static BOOL32 FileDlg_Init() /*********************************************************************** * GetOpenFileName (COMMDLG.1) */ -BOOL16 GetOpenFileName( SEGPTR ofn ) +BOOL16 GetOpenFileName16( SEGPTR ofn ) { HINSTANCE16 hInst; - HANDLE16 hDlgTmpl = 0, hResInfo; + HANDLE32 hDlgTmpl = 0, hResInfo; BOOL32 bRet = FALSE, win32Format = FALSE; HWND32 hwndDialog; - LPOPENFILENAME lpofn = (LPOPENFILENAME)PTR_SEG_TO_LIN(ofn); + LPOPENFILENAME16 lpofn = (LPOPENFILENAME16)PTR_SEG_TO_LIN(ofn); LPCVOID template; if (!lpofn || !FileDlg_Init()) return FALSE; - if (lpofn->Flags & OFN_ENABLETEMPLATEHANDLE) - { - if (!(template = LockResource16( lpofn->hInstance ))) - { - CommDlgLastError = CDERR_LOADRESFAILURE; - return FALSE; - } - } - else if (lpofn->Flags & OFN_ENABLETEMPLATE) - { - if (!(hResInfo = FindResource16(lpofn->hInstance, - lpofn->lpTemplateName, RT_DIALOG))) - { - CommDlgLastError = CDERR_FINDRESFAILURE; - return FALSE; - } - if (!(hDlgTmpl = LoadResource16( lpofn->hInstance, hResInfo )) || - !(template = LockResource16( hDlgTmpl ))) - { - CommDlgLastError = CDERR_LOADRESFAILURE; - return FALSE; - } - } - else - { - template = SYSRES_GetResPtr( SYSRES_DIALOG_OPEN_FILE ); - win32Format = TRUE; + if (lpofn->Flags & OFN_WINE32) { + if (lpofn->Flags & OFN_ENABLETEMPLATEHANDLE) + { + if (!(template = LockResource32( lpofn->hInstance ))) + { + CommDlgLastError = CDERR_LOADRESFAILURE; + return FALSE; + } + } + else if (lpofn->Flags & OFN_ENABLETEMPLATE) + { + if (!(hResInfo = FindResource32A(lpofn->hInstance, + PTR_SEG_TO_LIN(lpofn->lpTemplateName), (LPSTR)RT_DIALOG))) + { + CommDlgLastError = CDERR_FINDRESFAILURE; + return FALSE; + } + if (!(hDlgTmpl = LoadResource32( lpofn->hInstance, hResInfo )) || + !(template = LockResource32( hDlgTmpl ))) + { + CommDlgLastError = CDERR_LOADRESFAILURE; + return FALSE; + } + } else { + template = SYSRES_GetResPtr( SYSRES_DIALOG_OPEN_FILE ); + } + win32Format = TRUE; + } else { + if (lpofn->Flags & OFN_ENABLETEMPLATEHANDLE) + { + if (!(template = LockResource16( lpofn->hInstance ))) + { + CommDlgLastError = CDERR_LOADRESFAILURE; + return FALSE; + } + } + else if (lpofn->Flags & OFN_ENABLETEMPLATE) + { + if (!(hResInfo = FindResource16(lpofn->hInstance, + lpofn->lpTemplateName, RT_DIALOG))) + { + CommDlgLastError = CDERR_FINDRESFAILURE; + return FALSE; + } + if (!(hDlgTmpl = LoadResource16( lpofn->hInstance, hResInfo )) || + !(template = LockResource16( hDlgTmpl ))) + { + CommDlgLastError = CDERR_LOADRESFAILURE; + return FALSE; + } + } else { + template = SYSRES_GetResPtr( SYSRES_DIALOG_OPEN_FILE ); + win32Format = TRUE; + } } hInst = WIN_GetWindowInstance( lpofn->hwndOwner ); @@ -103,7 +130,12 @@ BOOL16 GetOpenFileName( SEGPTR ofn ) ofn, WIN_PROC_16 ); if (hwndDialog) bRet = DIALOG_DoDialogBox( hwndDialog, lpofn->hwndOwner ); - if (hDlgTmpl) FreeResource16( hDlgTmpl ); + if (hDlgTmpl) { + if (lpofn->Flags & OFN_WINE32) + FreeResource32( hDlgTmpl ); + else + FreeResource16( hDlgTmpl ); + } dprintf_commdlg(stddeb,"GetOpenFileName // return lpstrFile='%s' !\n", (LPSTR)PTR_SEG_TO_LIN(lpofn->lpstrFile)); @@ -114,45 +146,74 @@ BOOL16 GetOpenFileName( SEGPTR ofn ) /*********************************************************************** * GetSaveFileName (COMMDLG.2) */ -BOOL16 GetSaveFileName( SEGPTR ofn) +BOOL16 GetSaveFileName16( SEGPTR ofn) { HINSTANCE16 hInst; - HANDLE16 hDlgTmpl = 0; + HANDLE32 hDlgTmpl = 0; BOOL32 bRet = FALSE, win32Format = FALSE; - LPOPENFILENAME lpofn = (LPOPENFILENAME)PTR_SEG_TO_LIN(ofn); + LPOPENFILENAME16 lpofn = (LPOPENFILENAME16)PTR_SEG_TO_LIN(ofn); LPCVOID template; HWND32 hwndDialog; if (!lpofn || !FileDlg_Init()) return FALSE; - if (lpofn->Flags & OFN_ENABLETEMPLATEHANDLE) - { - if (!(template = LockResource16( lpofn->hInstance ))) - { - CommDlgLastError = CDERR_LOADRESFAILURE; - return FALSE; - } - } - else if (lpofn->Flags & OFN_ENABLETEMPLATE) - { - HANDLE16 hResInfo; - if (!(hResInfo = FindResource16(lpofn->hInstance, - lpofn->lpTemplateName, RT_DIALOG))) - { - CommDlgLastError = CDERR_FINDRESFAILURE; - return FALSE; - } - if (!(hDlgTmpl = LoadResource16( lpofn->hInstance, hResInfo )) || - !(template = LockResource16( hDlgTmpl ))) - { - CommDlgLastError = CDERR_LOADRESFAILURE; - return FALSE; - } - } - else - { - template = SYSRES_GetResPtr( SYSRES_DIALOG_SAVE_FILE ); - win32Format = TRUE; + if (lpofn->Flags & OFN_WINE32) { + if (lpofn->Flags & OFN_ENABLETEMPLATEHANDLE) + { + if (!(template = LockResource32( lpofn->hInstance ))) + { + CommDlgLastError = CDERR_LOADRESFAILURE; + return FALSE; + } + } + else if (lpofn->Flags & OFN_ENABLETEMPLATE) + { + HANDLE32 hResInfo; + if (!(hResInfo = FindResource32A(lpofn->hInstance, + PTR_SEG_TO_LIN(lpofn->lpTemplateName), (LPSTR)RT_DIALOG))) + { + CommDlgLastError = CDERR_FINDRESFAILURE; + return FALSE; + } + if (!(hDlgTmpl = LoadResource32(lpofn->hInstance,hResInfo)) || + !(template = LockResource32(hDlgTmpl))) + { + CommDlgLastError = CDERR_LOADRESFAILURE; + return FALSE; + } + win32Format= TRUE; + } else { + template = SYSRES_GetResPtr( SYSRES_DIALOG_SAVE_FILE ); + win32Format = TRUE; + } + } else { + if (lpofn->Flags & OFN_ENABLETEMPLATEHANDLE) + { + if (!(template = LockResource16( lpofn->hInstance ))) + { + CommDlgLastError = CDERR_LOADRESFAILURE; + return FALSE; + } + } + else if (lpofn->Flags & OFN_ENABLETEMPLATE) + { + HANDLE16 hResInfo; + if (!(hResInfo = FindResource16(lpofn->hInstance, + lpofn->lpTemplateName, RT_DIALOG))) + { + CommDlgLastError = CDERR_FINDRESFAILURE; + return FALSE; + } + if (!(hDlgTmpl = LoadResource16( lpofn->hInstance, hResInfo )) || + !(template = LockResource16( hDlgTmpl ))) + { + CommDlgLastError = CDERR_LOADRESFAILURE; + return FALSE; + } + } else { + template = SYSRES_GetResPtr( SYSRES_DIALOG_SAVE_FILE ); + win32Format = TRUE; + } } hInst = WIN_GetWindowInstance( lpofn->hwndOwner ); @@ -163,7 +224,12 @@ BOOL16 GetSaveFileName( SEGPTR ofn) ofn, WIN_PROC_16 ); if (hwndDialog) bRet = DIALOG_DoDialogBox( hwndDialog, lpofn->hwndOwner ); - if (hDlgTmpl) FreeResource16( hDlgTmpl ); + if (hDlgTmpl) { + if (lpofn->Flags & OFN_WINE32) + FreeResource32( hDlgTmpl ); + else + FreeResource16( hDlgTmpl ); + } dprintf_commdlg(stddeb, "GetSaveFileName // return lpstrFile='%s' !\n", (LPSTR)PTR_SEG_TO_LIN(lpofn->lpstrFile)); @@ -342,7 +408,7 @@ static LONG FILEDLG_WMMeasureItem(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam) /*********************************************************************** * FILEDLG_HookCallChk [internal] */ -static int FILEDLG_HookCallChk(LPOPENFILENAME lpofn) +static int FILEDLG_HookCallChk(LPOPENFILENAME16 lpofn) { if (lpofn) if (lpofn->Flags & OFN_ENABLEHOOK) @@ -351,6 +417,25 @@ static int FILEDLG_HookCallChk(LPOPENFILENAME lpofn) return 0; } +static BOOL32 FILEDLG_CallWindowProc(LPOPENFILENAME16 lpofn,HWND32 hwnd, + UINT32 wMsg,WPARAM32 wParam,LPARAM lParam +) { + if (!(lpofn->Flags & OFN_WINE32)) + return (BOOL32)CallWindowProc16( + lpofn->lpfnHook,hwnd,(UINT16)wMsg,(WPARAM16)wParam,lParam + ); + /* |OFN_WINE32 */ + if (lpofn->Flags & OFN_UNICODE) + return (BOOL32)CallWindowProc32W( + (WNDPROC32)lpofn->lpfnHook,hwnd,wMsg,wParam,lParam + ); + /* ! |OFN_UNICODE */ + return (BOOL32)CallWindowProc32A( + (WNDPROC32)lpofn->lpfnHook,hwnd,wMsg,wParam,lParam + ); + +} + /*********************************************************************** * FILEDLG_WMInitDialog [internal] */ @@ -358,11 +443,11 @@ static int FILEDLG_HookCallChk(LPOPENFILENAME lpofn) static LONG FILEDLG_WMInitDialog(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam) { int i, n; - LPOPENFILENAME lpofn; + LPOPENFILENAME16 lpofn; char tmpstr[512]; LPSTR pstr; SetWindowLong32A(hWnd, DWL_USER, lParam); - lpofn = (LPOPENFILENAME)PTR_SEG_TO_LIN(lParam); + lpofn = (LPOPENFILENAME16)PTR_SEG_TO_LIN(lParam); if (lpofn->lpstrTitle) SetWindowText16( hWnd, lpofn->lpstrTitle ); /* read custom filter information */ if (lpofn->lpstrCustomFilter) @@ -433,8 +518,7 @@ static LONG FILEDLG_WMInitDialog(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam) if (lpofn->Flags & OFN_HIDEREADONLY) ShowWindow32(GetDlgItem32(hWnd, chx1), SW_HIDE); if (FILEDLG_HookCallChk(lpofn)) - return (BOOL16)CallWindowProc16(lpofn->lpfnHook, - hWnd, WM_INITDIALOG, wParam, lParam ); + return (BOOL16)FILEDLG_CallWindowProc(lpofn,hWnd,WM_INITDIALOG,wParam,lParam ); else return TRUE; } @@ -445,8 +529,8 @@ static LONG FILEDLG_WMInitDialog(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam) static LRESULT FILEDLG_WMCommand(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam) { LONG lRet; - LPOPENFILENAME lpofn; - OPENFILENAME ofn2; + LPOPENFILENAME16 lpofn; + OPENFILENAME16 ofn2; char tmpstr[512], tmpstr2[512]; LPSTR pstr, pstr2; UINT16 control,notification; @@ -455,7 +539,7 @@ static LRESULT FILEDLG_WMCommand(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam) control = wParam; notification = HIWORD(lParam); - lpofn = (LPOPENFILENAME)PTR_SEG_TO_LIN(GetWindowLong32A(hWnd, DWL_USER)); + lpofn = (LPOPENFILENAME16)PTR_SEG_TO_LIN(GetWindowLong32A(hWnd, DWL_USER)); switch (control) { case lst1: /* file list */ @@ -472,7 +556,7 @@ static LRESULT FILEDLG_WMCommand(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam) SEGPTR_FREE(pstr); } if (FILEDLG_HookCallChk(lpofn)) - CallWindowProc16(lpofn->lpfnHook, hWnd, + FILEDLG_CallWindowProc(lpofn,hWnd, RegisterWindowMessage32A( LBSELCHSTRING ), control, MAKELONG(lRet,CD_LBSELCHANGE)); /* FIXME: for OFN_ALLOWMULTISELECT we need CD_LBSELSUB, CD_SELADD, CD_LBSELNOITEMS */ @@ -610,7 +694,7 @@ static LRESULT FILEDLG_WMCommand(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam) } if (FILEDLG_HookCallChk(lpofn)) { - lRet= (BOOL16)CallWindowProc16(lpofn->lpfnHook, + lRet= (BOOL16)FILEDLG_CallWindowProc(lpofn, hWnd, RegisterWindowMessage32A( FILEOKSTRING ), 0, lParam ); if (lRet) { @@ -636,12 +720,12 @@ static LRESULT FILEDLG_WMCommand(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam) */ LRESULT FileOpenDlgProc(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPARAM lParam) { - LPOPENFILENAME lpofn = (LPOPENFILENAME)PTR_SEG_TO_LIN(GetWindowLong32A(hWnd, DWL_USER)); + LPOPENFILENAME16 lpofn = (LPOPENFILENAME16)PTR_SEG_TO_LIN(GetWindowLong32A(hWnd, DWL_USER)); if (wMsg!=WM_INITDIALOG) if (FILEDLG_HookCallChk(lpofn)) { - LRESULT lRet=(BOOL16)CallWindowProc16(lpofn->lpfnHook, hWnd, wMsg, wParam, lParam); + LRESULT lRet=(BOOL16)FILEDLG_CallWindowProc(lpofn,hWnd,wMsg,wParam,lParam); if (lRet) return lRet; /* else continue message processing */ } @@ -679,12 +763,12 @@ LRESULT FileOpenDlgProc(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPARAM lParam */ LRESULT FileSaveDlgProc(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPARAM lParam) { - LPOPENFILENAME lpofn = (LPOPENFILENAME)PTR_SEG_TO_LIN(GetWindowLong32A(hWnd, DWL_USER)); + LPOPENFILENAME16 lpofn = (LPOPENFILENAME16)PTR_SEG_TO_LIN(GetWindowLong32A(hWnd, DWL_USER)); if (wMsg!=WM_INITDIALOG) if (FILEDLG_HookCallChk(lpofn)) { - LRESULT lRet=(BOOL16)CallWindowProc16(lpofn->lpfnHook, hWnd, wMsg, wParam, lParam); + LRESULT lRet=(BOOL16)FILEDLG_CallWindowProc(lpofn,hWnd,wMsg,wParam,lParam); if (lRet) return lRet; /* else continue message processing */ } @@ -1089,11 +1173,10 @@ DWORD CommDlgExtendedError(void) return CommDlgLastError; } - /*********************************************************************** - * GetFileTitle (COMMDLG.27) + * GetFileTitleA (COMDLG32.8) */ -short GetFileTitle(LPCSTR lpFile, LPSTR lpTitle, UINT16 cbBuf) +short GetFileTitle32A(LPCSTR lpFile, LPSTR lpTitle, UINT32 cbBuf) { int i, len; dprintf_commdlg(stddeb,"GetFileTitle(%p %p %d); \n", lpFile, lpTitle, cbBuf); @@ -1124,6 +1207,30 @@ short GetFileTitle(LPCSTR lpFile, LPSTR lpTitle, UINT16 cbBuf) } +/*********************************************************************** + * GetFileTitleA (COMDLG32.8) + */ +short GetFileTitle32W(LPCWSTR lpFile, LPWSTR lpTitle, UINT32 cbBuf) +{ + LPSTR file = HEAP_strdupWtoA(GetProcessHeap(),0,lpFile); + LPSTR title = HeapAlloc(GetProcessHeap(),0,cbBuf); + short ret; + + ret = GetFileTitle32A(file,title,cbBuf); + + lstrcpynAtoW(lpTitle,title,cbBuf); + HeapFree(GetProcessHeap(),0,file); + HeapFree(GetProcessHeap(),0,title); + return ret; +} +/*********************************************************************** + * GetFileTitle (COMMDLG.27) + */ +short GetFileTitle16(LPCSTR lpFile, LPSTR lpTitle, UINT16 cbBuf) { + return GetFileTitle32A(lpFile,lpTitle,cbBuf); +} + + /* ------------------------ Choose Color Dialog --------------------------- */ /*********************************************************************** @@ -2873,3 +2980,183 @@ LRESULT FormatCharDlgProc(HWND16 hDlg, UINT16 message, WPARAM16 wParam, LPARAM l } return FALSE; } + + +#define GET_XXX_FILENAME(xxx) \ +BOOL32 xxx##32A( LPOPENFILENAME32A ofn ) \ +{ \ + BOOL16 ret; \ + LPOPENFILENAME16 ofn16 = SEGPTR_ALLOC(sizeof(OPENFILENAME16)); \ + \ + memset(ofn16,'\0',sizeof(*ofn16)); \ + ofn16->lStructSize = sizeof(*ofn16); \ + ofn16->hwndOwner = ofn->hwndOwner; \ + ofn16->hInstance = ofn->hInstance; \ + if (ofn->lpstrFilter) { \ + LPSTR s,x; \ + \ + /* filter is a list... title\0ext\0......\0\0 */ \ + s = (LPSTR)ofn->lpstrFilter; \ + while (*s) \ + s = s+strlen(s)+1; \ + s++; \ + x = (LPSTR)SEGPTR_ALLOC(s-ofn->lpstrFilter); \ + memcpy(x,ofn->lpstrFilter,s-ofn->lpstrFilter); \ + ofn16->lpstrFilter = SEGPTR_GET(x); \ + } \ + if (ofn->lpstrCustomFilter) { \ + LPSTR s,x; \ + \ + /* filter is a list... title\0ext\0......\0\0 */ \ + s = (LPSTR)ofn->lpstrCustomFilter; \ + while (*s) \ + s = s+strlen(s)+1; \ + x = SEGPTR_ALLOC(s-ofn->lpstrCustomFilter); \ + s++; \ + memcpy(x,ofn->lpstrCustomFilter,s-ofn->lpstrCustomFilter);\ + ofn16->lpstrCustomFilter = SEGPTR_GET(x); \ + } \ + ofn16->nMaxCustFilter = ofn->nMaxCustFilter; \ + ofn16->nFilterIndex = ofn->nFilterIndex; \ + ofn16->lpstrFile = SEGPTR_GET(SEGPTR_ALLOC(ofn->nMaxFile)); \ + ofn16->nMaxFile = ofn->nMaxFile; \ + if (ofn->lpstrFileTitle) \ + ofn16->lpstrFileTitle= SEGPTR_GET(SEGPTR_STRDUP(ofn->lpstrFileTitle));\ + ofn16->nMaxFileTitle = ofn->nMaxFileTitle; \ + if (ofn->lpstrInitialDir) \ + ofn16->lpstrInitialDir = SEGPTR_GET(SEGPTR_STRDUP(ofn->lpstrInitialDir));\ + if (ofn->lpstrTitle) \ + ofn16->lpstrTitle = SEGPTR_GET(SEGPTR_STRDUP(ofn->lpstrTitle));\ + ofn16->Flags = ofn->Flags|OFN_WINE32; \ + ofn16->nFileOffset = ofn->nFileOffset; \ + ofn16->nFileExtension = ofn->nFileExtension; \ + if (ofn->lpstrDefExt) \ + ofn16->lpstrDefExt = SEGPTR_GET(SEGPTR_STRDUP(ofn->lpstrDefExt));\ + ofn16->lCustData = ofn->lCustData; \ + ofn16->lpfnHook = (WNDPROC16)ofn->lpfnHook; \ + \ + if (ofn->lpTemplateName) \ + ofn16->lpTemplateName = SEGPTR_GET(SEGPTR_STRDUP(ofn->lpTemplateName));\ + \ + ret = xxx##16(SEGPTR_GET(ofn16)); \ + \ + if (ofn16->lpstrFilter) \ + SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpstrFilter)); \ + if (ofn16->lpTemplateName) \ + SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpTemplateName)); \ + if (ofn16->lpstrDefExt) \ + SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpstrDefExt)); \ + if (ofn16->lpstrTitle) \ + SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpstrTitle)); \ + if (ofn16->lpstrInitialDir) \ + SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpstrInitialDir)); \ + if (ofn16->lpstrCustomFilter) \ + SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpstrCustomFilter)); \ + \ + strcpy(ofn->lpstrFile,PTR_SEG_TO_LIN(ofn16->lpstrFile)); \ + SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpstrFile)); \ + \ + if (ofn16->lpstrFileTitle) \ + SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpstrFileTitle)); \ + SEGPTR_FREE(ofn16); \ + return ret; \ +} \ + \ +BOOL32 xxx##32W( LPOPENFILENAME32W ofn ) \ +{ \ + BOOL16 ret; \ + LPOPENFILENAME16 ofn16 = SEGPTR_ALLOC(sizeof(OPENFILENAME16)); \ + \ + memset(ofn16,'\0',sizeof(*ofn16)); \ + ofn16->lStructSize = sizeof(*ofn16); \ + ofn16->hwndOwner = ofn->hwndOwner; \ + ofn16->hInstance = ofn->hInstance; \ + if (ofn->lpstrFilter) { \ + LPWSTR s; \ + LPSTR x,y; \ + int n; \ + \ + /* filter is a list... title\0ext\0......\0\0 */ \ + s = (LPWSTR)ofn->lpstrFilter; \ + while (*s) \ + s = s+lstrlen32W(s)+1; \ + s++; \ + n = s - ofn->lpstrFilter; /* already divides by 2. ptr magic */\ + x = y = (LPSTR)SEGPTR_ALLOC(n); \ + s = (LPWSTR)ofn->lpstrFilter; \ + while (*s) { \ + lstrcpyWtoA(x,s); \ + x+=lstrlen32A(x)+1; \ + s+=lstrlen32W(s)+1; \ + } \ + *x=0; \ + ofn16->lpstrFilter = SEGPTR_GET(y); \ + } \ + if (ofn->lpstrCustomFilter) { \ + LPWSTR s; \ + LPSTR x,y; \ + int n; \ + \ + /* filter is a list... title\0ext\0......\0\0 */ \ + s = (LPWSTR)ofn->lpstrCustomFilter; \ + while (*s) \ + s = s+lstrlen32W(s)+1; \ + s++; \ + n = s - ofn->lpstrCustomFilter; \ + x = y = (LPSTR)SEGPTR_ALLOC(n); \ + s = (LPWSTR)ofn->lpstrCustomFilter; \ + while (*s) { \ + lstrcpyWtoA(x,s); \ + x+=lstrlen32A(x)+1; \ + s+=lstrlen32W(s)+1; \ + } \ + *x=0; \ + ofn16->lpstrCustomFilter = SEGPTR_GET(y); \ + } \ + ofn16->nMaxCustFilter = ofn->nMaxCustFilter; \ + ofn16->nFilterIndex = ofn->nFilterIndex; \ + ofn16->lpstrFile = SEGPTR_GET(SEGPTR_ALLOC(ofn->nMaxFile)); \ + ofn16->nMaxFile = ofn->nMaxFile; \ + if (ofn->lpstrFileTitle) \ + ofn16->lpstrFileTitle= SEGPTR_GET(SEGPTR_STRDUP_WtoA(ofn->lpstrFileTitle));\ + ofn16->nMaxFileTitle = ofn->nMaxFileTitle; \ + if (ofn->lpstrInitialDir) \ + ofn16->lpstrInitialDir = SEGPTR_GET(SEGPTR_STRDUP_WtoA(ofn->lpstrInitialDir));\ + if (ofn->lpstrTitle) \ + ofn16->lpstrTitle = SEGPTR_GET(SEGPTR_STRDUP_WtoA(ofn->lpstrTitle));\ + ofn16->Flags = ofn->Flags|OFN_WINE32|OFN_UNICODE; \ + ofn16->nFileOffset = ofn->nFileOffset; \ + ofn16->nFileExtension = ofn->nFileExtension; \ + if (ofn->lpstrDefExt) \ + ofn16->lpstrDefExt = SEGPTR_GET(SEGPTR_STRDUP_WtoA(ofn->lpstrDefExt));\ + ofn16->lCustData = ofn->lCustData; \ + ofn16->lpfnHook = (WNDPROC16)ofn->lpfnHook; \ + if (ofn->lpTemplateName) { \ + ofn16->lpTemplateName = SEGPTR_GET(SEGPTR_STRDUP_WtoA(ofn->lpTemplateName));\ + } \ + ret = xxx##16(SEGPTR_GET(ofn16)); \ + \ + if (ofn16->lpstrFilter) \ + SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpstrFilter)); \ + if (ofn16->lpTemplateName) \ + SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpTemplateName)); \ + if (ofn16->lpstrDefExt) \ + SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpstrDefExt)); \ + if (ofn16->lpstrTitle) \ + SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpstrTitle)); \ + if (ofn16->lpstrInitialDir) \ + SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpstrInitialDir)); \ + if (ofn16->lpstrCustomFilter) \ + SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpstrCustomFilter)); \ + \ + lstrcpyAtoW(ofn->lpstrFile,PTR_SEG_TO_LIN(ofn16->lpstrFile)); \ + SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpstrFile)); \ + \ + if (ofn16->lpstrFileTitle) \ + SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpstrFileTitle)); \ + SEGPTR_FREE(ofn16); \ + return ret; \ +} + +GET_XXX_FILENAME(GetOpenFileName) +GET_XXX_FILENAME(GetSaveFileName) diff --git a/misc/crtdll.c b/misc/crtdll.c index 60d3aebb59f..0015d92dc88 100644 --- a/misc/crtdll.c +++ b/misc/crtdll.c @@ -912,6 +912,19 @@ CRTDLL_atexit(LPVOID x) { return 0; /* successful */ } +/********************************************************************* + * mbstowcs (CRTDLL.429) + * FIXME: check multibyte support + */ +INT32 +CRTDLL_mbstowcs(LPWSTR a,LPSTR b,INT32 nr) { + int i; + for (i=0;(i