From 77b9918e0ea450b51ec0bdae48eef4d603bacc15 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sun, 14 Sep 1997 17:17:23 +0000 Subject: [PATCH] Release 970914 Thu Sep 11 18:24:56 1997 Philippe De Muyter * [objects/dc.c] In DC_SetupGCForPatBlt, replace R2_NOT by GXxor with (black xor white). Tue Sep 9 23:04:02 1997 U. Bonnes * [memory/virtual.c] Do not write debugging info unconditionally to stderr. * [files/profile.c] Call PROFILE_GetSection in PROFILE_GetString for key_name "" too. * [misc/crtdll.c] Many new functions. * [include/windows.h] [windows/winpos.c] ClientToScreen16 doesn't have a return value. Sun Sep 7 10:06:39 1997 Alexandre Julliard * [misc/main.c] [AUTHORS] Update the list of contributors. Please let me know if I forgot someone. * [if1632/*.spec] [if1632/builtin.c] [tools/build.c] Ordinal base for Win32 DLLs is now computed automatically from the lowest ordinal found. * [include/wintypes.h] WINAPI is now defined as attribute((stdcall)). This will require gcc to compile. * [if1632/thunk.c] Removed Win32 thunks (no longer needed with stdcall). * [if1632/crtdll.spec] [misc/crtdll.c] Make sure we only reference cdecl functions in the spec file. * [objects/dc.c] Use CapNotLast drawing style for 1-pixel wide lines. * [tools/build.c] Added 'double' argument type. Added 'varargs' function type for Win32. Made CallTo16_xxx functions stdcall. Fri Sep 5 14:50:49 1997 Alex Korobka * [tools/build.c] [windows/win.c] [windows/event.c] [windows/message.c] More fixes to get message exchange closer to the original. * [misc/spy.c] Message logs now contain window names. * [loader/resource.c] [loader/ne_resource.c] [loader/task.c] [objects/cursoricon.c] [windows/user.c] Added some obscure features to fix memory leaks. Fri Sep 5 00:46:28 1997 Jan Willamowius * [if1632/kernel32.spec] [win32/newfns.c] Added stub for UTRegister() and UTUnRegister(). Thu Sep 4 12:03:12 1997 Frans van Dorsselaer * [controls/edit.c] Allow ASCII codes > 127 in WM_CHAR. Mon Sep 1 17:23:24 1997 Dimitrie O. Paun * [controls/widgets.c] In InitCommonControls, remember the name of the class because lpszClassName was made to point to a local array Added the ProgressBar to the list of implemented controls. Call InitCommonControls from WIDGETS_Init to register all implemented Common Controls. * [include/commctrl.h] Added misc decl for the Progress Bar. * [controls/progress.c] [include/progress.h] First attempt at implementiong the Progress Bar class. * [objects/brush.h] Implementation for GetSysColorBrush[16|32] * [controls/status.c] Use DrawEdge to draw the borders and fill the background * [controls/uitools.c] Added DrawDiagEdge32 and DrawRectEdge32 * [graphics/painting.c] Implement DrawEdge[16|32] Started DrawFrameControl32 Mon Sep 1 10:07:09 1997 Lawson Whitney * [misc/comm.c] [include/windows.h] SetCommEventMask returns a SEGPTR. Sun Aug 31 23:28:32 1997 Marcus Meissner * [loader/pe_image.c][loader/module.c][include/pe_image.h] [include/module.h] Cleaned up the whole Win32 library mess (a bit). * [debugger/stabs.c] If 'wine' has no absolute path and isn't found, check $PATH too. * [misc/ole2nls.c] Some fixes. * [misc/ver.c] Added support for PE style version resources. * [memory/string.c] Check for NULL pointers to _lstr* functions, just as Windows95 does. * [multimedia/time.c] Made list of timers a simple linked list. * [loader/resource.c] Netscape 3 seems to pass NEGATIVE resource Ids (in an unsigned int, yes). Don't know why, fixed it anyway. * [objects/bitmap.c] LoadImageW added. * [include/win.h][windows/win.c] Change wIDmenu from UINT16 to UINT32 and changed the SetWindow(Long|Word) accordingly. Thu Aug 28 19:30:08 1997 Morten Welinder * [include/windows.h] Add a few more colors defined for Win95. Add a few more brush styles. * [windows/syscolor.c] Add error checks for SYSCOLOR_SetColor, SYSCOLOR_Init, GetSysColor16, GetSysColor32. Add support for above colors. Sun Aug 24 16:22:57 1997 Andrew Taylor * [multimedia/mmsystem.c] Changed mmioDescend to use mmio functions for file I/O, neccessary for memory files. --- ANNOUNCE | 20 +- AUTHORS | 143 +++- BUGS | 18 +- ChangeLog | 150 ++++ controls/Makefile.in | 2 + controls/edit.c | 16 +- controls/listbox.c | 2 +- controls/menu.c | 58 +- controls/progress.c | 208 +++++ controls/status.c | 43 +- controls/uitools.c | 390 +++++++++ controls/updown.c | 120 +-- controls/widgets.c | 11 +- debugger/dbg.y | 4 +- debugger/msc.c | 8 +- debugger/registers.c | 4 +- debugger/stabs.c | 19 + files/profile.c | 20 +- graphics/fontengine.c | 4 +- graphics/painting.c | 129 +-- graphics/win16drv/prtdrv.c | 10 +- graphics/x11drv/xfont.c | 6 +- if1632/advapi32.spec | 1 - if1632/builtin.c | 24 +- if1632/comctl32.spec | 129 ++- if1632/comdlg32.spec | 49 +- if1632/compobj.spec | 6 +- if1632/crtdll.spec | 367 ++++---- if1632/gdi.spec | 4 +- if1632/gdi32.spec | 779 +++++++++-------- if1632/kernel.spec | 10 +- if1632/kernel32.spec | 1639 ++++++++++++++++++------------------ if1632/keyboard.spec | 4 +- if1632/mpr.spec | 2 +- if1632/ntdll.spec | 99 ++- if1632/ole2.spec | 2 +- if1632/ole32.spec | 325 ++++--- if1632/relay.c | 32 +- if1632/shell32.spec | 273 +++--- if1632/signal.c | 122 ++- if1632/thunk.c | 460 +++------- if1632/user.spec | 30 +- if1632/user32.spec | 1207 +++++++++++++------------- if1632/ver.spec | 14 +- if1632/winmm.spec | 2 +- if1632/winspool.spec | 247 +++--- if1632/wprocs.spec | 1 + if1632/wsock32.spec | 1 - include/bitmap.h | 10 +- include/callback.h | 96 +-- include/class.h | 2 +- include/commctrl.h | 38 +- include/compobj.h | 14 +- include/debug.h | 121 +-- include/debugger.h | 2 +- include/handle32.h | 19 + include/module.h | 27 +- include/neexe.h | 9 +- include/pe_image.h | 37 +- include/peexe.h | 2 +- include/process.h | 7 +- include/progress.h | 23 + include/resource.h | 11 +- include/spy.h | 3 + include/stackframe.h | 5 +- include/stddebug.h | 2 + include/struct32.h | 41 - include/syscolor.h | 4 + include/task.h | 14 +- include/thread.h | 2 + include/updown.h | 11 +- include/user.h | 2 + include/win.h | 8 +- include/windows.h | 74 +- include/winnls.h | 17 + include/winnt.h | 2 +- include/winproc.h | 2 - include/wintypes.h | 17 +- library/Makefile.in | 3 +- library/miscstubs.c | 1 - library/sup.c | 104 --- loader/module.c | 351 +++++--- loader/ne_image.c | 21 +- loader/ne_resource.c | 308 +++++-- loader/pe_image.c | 502 +++++++---- loader/pe_resource.c | 104 +-- loader/resource.c | 113 ++- loader/task.c | 67 +- memory/global.c | 26 +- memory/local.c | 4 +- memory/string.c | 19 + memory/virtual.c | 12 +- misc/comm.c | 79 +- misc/commdlg.c | 12 +- misc/compobj.c | 8 + misc/crtdll.c | 1300 ++++++++++++++++++---------- misc/lstr.c | 90 +- misc/main.c | 142 +++- misc/network.c | 13 +- misc/ntdll.c | 24 + misc/ole2.c | 15 +- misc/ole2nls.c | 77 +- misc/printdrv.c | 2 +- misc/registry.c | 35 +- misc/shell.c | 46 +- misc/spy.c | 128 ++- misc/ver.c | 434 +++++++--- misc/winsock.c | 6 +- misc/wsprintf.c | 97 ++- miscemu/instr.c | 4 +- msdos/int21.c | 93 +- multimedia/mmsystem.c | 54 +- multimedia/time.c | 34 +- objects/bitmap.c | 168 ++-- objects/brush.c | 75 +- objects/cursoricon.c | 530 +++++++++--- objects/dc.c | 12 +- objects/dib.c | 16 +- objects/font.c | 9 +- objects/metafile.c | 10 +- objects/text.c | 27 +- scheduler/process.c | 16 +- scheduler/thread.c | 91 +- tools/build-spec.txt | 14 +- tools/build.c | 304 ++++--- win32/Makefile.in | 1 - win32/cursoricon32.c | 514 ----------- win32/environment.c | 3 +- win32/file.c | 4 +- win32/init.c | 29 - win32/k32obj.c | 74 ++ win32/newfns.c | 35 +- win32/process.c | 54 +- windows/class.c | 47 +- windows/defwnd.c | 4 +- windows/dialog.c | 32 +- windows/event.c | 19 + windows/hook.c | 45 +- windows/keyboard.c | 16 +- windows/mdi.c | 484 ++++++----- windows/message.c | 29 +- windows/nonclient.c | 14 +- windows/queue.c | 4 +- windows/syscolor.c | 32 +- windows/user.c | 88 +- windows/win.c | 163 ++-- windows/winhelp.c | 3 +- windows/winpos.c | 27 +- windows/winproc.c | 77 +- 149 files changed, 8838 insertions(+), 6396 deletions(-) create mode 100644 controls/progress.c create mode 100644 controls/uitools.c create mode 100644 include/progress.h delete mode 100644 library/sup.c delete mode 100644 win32/cursoricon32.c diff --git a/ANNOUNCE b/ANNOUNCE index b22dffabc66..e22d15315cb 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,15 +1,15 @@ -This is release 970824 of Wine, the MS Windows emulator. This is still a +This is release 970914 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-970824: (see ChangeLog for details) - - Better Win32 menu support. - - Improved Winsock. - - UpDown control. - - More undocumented Win95 hacks. +WHAT'S NEW with Wine-970914: (see ChangeLog for details) + - Better resource handling. + - New Progress control. + - Improved PE module support. + - Many relay code changes. - Lots of bug fixes. See the README file in the distribution for installation instructions. @@ -18,10 +18,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-970824.tar.gz - ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-970824.tar.gz - ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970824.tar.gz - ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-970824.tar.gz + ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-970914.tar.gz + ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-970914.tar.gz + ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970914.tar.gz + ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-970914.tar.gz It should also be available from any site that mirrors tsx-11 or sunsite. diff --git a/AUTHORS b/AUTHORS index 16236869bb0..e26d62a47d8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -4,28 +4,121 @@ @c This is a list of the Wine authors and copyright holders. -Wine is available thanks to the work of Bob Amstadt, Dag Asheim, -Martin Ayotte, Peter Bajusz, Ross Biro, Uwe Bonnes, Erik Bos, Fons -Botman, John Brezak, Andrew Bulhak, John Burton, Niels de Carpentier, -Jimen Ching, Huw D. M. Davies, Roman Dolejsi, Frans van Dorsselaer, -Paul Falstad, David Faure, Claus Fischer, Olaf Flebbe, Peter Galbavy, -Ramon Garcia, Matthew Ghio, Hans de Graaff, Charles M. Hannum, John -Harvey, Cameron Heide, Jochen Hoenicke, Onno Hovers, Jeffrey Hsu, -Miguel de Icaza, Jukka Iivonen, Lee Jaekil, Alexandre Julliard, Bang -Jun-Young, Pavel Kankovsky, Jochen Karrer, Andreas Kirschbaum, -Albrecht Kleine, Jon Konrath, Alex Korobka, Greg Kreider, Anand -Kumria, Scott A. Laird, Andrew Lewycky, Martin von Loewis, Kenneth -MacDonald, Peter MacDonald, William Magro, Juergen Marquardt, Ricardo -Massaro, Marcus Meissner, Graham Menhennitt, David Metcalfe, Bruce -Milner, Steffen Moeller, Andreas Mohr, Philippe De Muyter, Itai -Nahshon, Michael Patra, Jim Peterson, Robert Pouliot, Keith Reynolds, -Slaven Rezic, John Richardson, Johannes Ruscheinski, Thomas Sandford, -Constantine Sapuntzakis, Pablo Saratxaga, Daniel Schepler, Ulrich -Schmid, Bernd Schmidt, Yngvi Sigurjonsson, Stephen Simmons, Rick -Sladkey, William Smith, Dominik Strasser, Vadim Strizhevsky, Erik -Svendsen, Tristan Tarrant, Andrew Taylor, Duncan C Thomson, Goran -Thyni, Jimmy Tirtawangsa, Jon Tombs, Linus Torvalds, Gregory -Trubetskoy, Petri Tuomola, Michael Veksler, Sven Verdoolaege, Ronan -Waide, Eric Warnke, Manfred Weichel, Morten Welinder, Jan Willamowius, -Carl Williams, Karl Guenter Wuensch, Eric Youngdale, James Youngman, -Mikolaj Zalewski, and John Zero. +Wine is available thanks to the work of: +Bob Amstadt, +Dag Asheim, +Martin Ayotte, +Peter Bajusz, +Georg Beyerle, +Ross Biro, +Uwe Bonnes, +Erik Bos, +Fons Botman, +John Brezak, +Andrew Bulhak, +John Burton, +Niels de Carpentier, +Jimen Ching, +David A. Cuthbert, +Huw D. M. Davies, +Roman Dolejsi, +Frans van Dorsselaer, +Chris Faherty, +Paul Falstad, +David Faure, +Claus Fischer, +Olaf Flebbe, +Chad Fraleigh, +Peter Galbavy, +Ramon Garcia, +Matthew Ghio, +Jody Goldberg, +Hans de Graaff, +Charles M. Hannum, +Adrian Harvey, +John Harvey, +Cameron Heide, +Jochen Hoenicke, +Onno Hovers, +Jeffrey Hsu, +Miguel de Icaza, +Jukka Iivonen, +Lee Jaekil, +Alexandre Julliard, +Bang Jun-Young, +Pavel Kankovsky, +Jochen Karrer, +Andreas Kirschbaum, +Albrecht Kleine, +Jon Konrath, +Alex Korobka, +Greg Kreider, +Anand Kumria, +Scott A. Laird, +Andrew Lewycky, +Martin von Loewis, +Michiel van Loon, +Kenneth MacDonald, +Peter MacDonald, +William Magro, +Juergen Marquardt, +Ricardo Massaro, +Marcus Meissner, +Graham Menhennitt, +David Metcalfe, +Bruce Milner, +Steffen Moeller, +Andreas Mohr, +Philippe De Muyter, +Itai Nahshon, +Henrik Olsen, +Michael Patra, +Dimitrie O. Paun, +Jim Peterson, +Robert Pouliot, +Keith Reynolds, +Slaven Rezic, +John Richardson, +Rick Richardson, +Doug Ridgway, +Bernhard Rosenkraenzer, +Johannes Ruscheinski, +Thomas Sandford, +Constantine Sapuntzakis, +Pablo Saratxaga, +Daniel Schepler, +Peter Schlaile, +Ulrich Schmid, +Bernd Schmidt, +Ingo Schneider, +Victor Schneider, +Yngvi Sigurjonsson, +Stephen Simmons, +Rick Sladkey, +William Smith, +Dominik Strasser, +Vadim Strizhevsky, +Erik Svendsen, +Tristan Tarrant, +Andrew Taylor, +Duncan C Thomson, +Goran Thyni, +Jimmy Tirtawangsa, +Jon Tombs, +Linus Torvalds, +Gregory Trubetskoy, +Petri Tuomola, +Michael Veksler, +Sven Verdoolaege, +Ronan Waide, +Eric Warnke, +Manfred Weichel, +Morten Welinder, +Lawson Whitney, +Jan Willamowius, +Carl Williams, +Karl Guenter Wuensch, +Eric Youngdale, +James Youngman, +Mikolaj Zalewski, +and John Zero. diff --git a/BUGS b/BUGS index 05f5253629b..13a5ffd3e17 100644 --- a/BUGS +++ b/BUGS @@ -5,10 +5,15 @@ done something for one of the problems. You are encouraged to add new entries and, more importantly, remove those for the bugs you fixed ;-) ------------------------------------------------------------ -As of June 1997 - +As of Sept 1997 - General: + * LoadAccelerators() must not create any objects apart + from loading the resource. + + * Catch/Throw() do not save SI and DI registers (quite fatal). + * We need to do InsertMenuItem32[AW] and then code most of the other inserting function in terms of this. Without this, we cannot support all the new extended menus. Not hard, but slightly big. @@ -36,6 +41,17 @@ General: Miscellaneous: + * nBytesWidth in CURSORICONINFO is bogus for some bpp + (doesn't reflect the fact that bits are packed and 16-bit aligned). + + * Progman and AOL complain about being unable to convert bitmaps + (probably because of bytes width stuff). + + * Netscape displays partially downloaded inline graphics with + wrong offsets. Bitmap is missing in the splash-window. + + * BCW 4.5 crashes after SwitchStackBack(). + * Text alignment problems in Word and Write (variable pitch fonts). * Font mapper weights diff --git a/ChangeLog b/ChangeLog index 94d3fd9acfc..b9e775ebca0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,153 @@ +---------------------------------------------------------------------- +Thu Sep 11 18:24:56 1997 Philippe De Muyter + + * [objects/dc.c] + In DC_SetupGCForPatBlt, replace R2_NOT by GXxor with (black xor white). + +Tue Sep 9 23:04:02 1997 U. Bonnes + + * [memory/virtual.c] + Do not write debugging info unconditionally to stderr. + + * [files/profile.c] + Call PROFILE_GetSection in PROFILE_GetString for key_name "" too. + + * [misc/crtdll.c] + Many new functions. + + * [include/windows.h] [windows/winpos.c] + ClientToScreen16 doesn't have a return value. + +Sun Sep 7 10:06:39 1997 Alexandre Julliard + + * [misc/main.c] [AUTHORS] + Update the list of contributors. Please let me know if I forgot + someone. + + * [if1632/*.spec] [if1632/builtin.c] [tools/build.c] + Ordinal base for Win32 DLLs is now computed automatically from the + lowest ordinal found. + + * [include/wintypes.h] + WINAPI is now defined as attribute((stdcall)). This will require + gcc to compile. + + * [if1632/thunk.c] + Removed Win32 thunks (no longer needed with stdcall). + + * [if1632/crtdll.spec] [misc/crtdll.c] + Make sure we only reference cdecl functions in the spec file. + + * [objects/dc.c] + Use CapNotLast drawing style for 1-pixel wide lines. + + * [tools/build.c] + Added 'double' argument type. + Added 'varargs' function type for Win32. + Made CallTo16_xxx functions stdcall. + +Fri Sep 5 14:50:49 1997 Alex Korobka + + * [tools/build.c] [windows/win.c] [windows/event.c] [windows/message.c] + More fixes to get message exchange closer to the original. + + * [misc/spy.c] + Message logs now contain window names. + + * [loader/resource.c] [loader/ne_resource.c] [loader/task.c] + [objects/cursoricon.c] [windows/user.c] + Added some obscure features to fix memory leaks. + +Fri Sep 5 00:46:28 1997 Jan Willamowius + + * [if1632/kernel32.spec] [win32/newfns.c] + Added stub for UTRegister() and UTUnRegister(). + +Thu Sep 4 12:03:12 1997 Frans van Dorsselaer + * [controls/edit.c] + Allow ASCII codes > 127 in WM_CHAR. + +Mon Sep 1 17:23:24 1997 Dimitrie O. Paun + + * [controls/widgets.c] + In InitCommonControls, remember the name of the class + because lpszClassName was made to point to a local array + Added the ProgressBar to the list of implemented controls. + Call InitCommonControls from WIDGETS_Init to register all + implemented Common Controls. + + * [include/commctrl.h] + Added misc decl for the Progress Bar. + + * [controls/progress.c] [include/progress.h] + First attempt at implementiong the Progress Bar class. + + * [objects/brush.h] + Implementation for GetSysColorBrush[16|32] + + * [controls/status.c] + Use DrawEdge to draw the borders and fill the background + + * [controls/uitools.c] + Added DrawDiagEdge32 and DrawRectEdge32 + + * [graphics/painting.c] + Implement DrawEdge[16|32] + Started DrawFrameControl32 + +Mon Sep 1 10:07:09 1997 Lawson Whitney + + * [misc/comm.c] [include/windows.h] + SetCommEventMask returns a SEGPTR. + +Sun Aug 31 23:28:32 1997 Marcus Meissner + + * [loader/pe_image.c][loader/module.c][include/pe_image.h] + [include/module.h] + Cleaned up the whole Win32 library mess (a bit). + + * [debugger/stabs.c] + If 'wine' has no absolute path and isn't found, check $PATH too. + + * [misc/ole2nls.c] + Some fixes. + + * [misc/ver.c] + Added support for PE style version resources. + + * [memory/string.c] + Check for NULL pointers to _lstr* functions, just as Windows95 does. + + * [multimedia/time.c] + Made list of timers a simple linked list. + + * [loader/resource.c] + Netscape 3 seems to pass NEGATIVE resource Ids (in an + unsigned int, yes). Don't know why, fixed it anyway. + + * [objects/bitmap.c] + LoadImageW added. + + * [include/win.h][windows/win.c] + Change wIDmenu from UINT16 to UINT32 and changed the + SetWindow(Long|Word) accordingly. + +Thu Aug 28 19:30:08 1997 Morten Welinder + + * [include/windows.h] + Add a few more colors defined for Win95. + Add a few more brush styles. + + * [windows/syscolor.c] + Add error checks for SYSCOLOR_SetColor, SYSCOLOR_Init, + GetSysColor16, GetSysColor32. Add support for above colors. + +Sun Aug 24 16:22:57 1997 Andrew Taylor + + * [multimedia/mmsystem.c] + Changed mmioDescend to use mmio functions for file I/O, neccessary + for memory files. + ---------------------------------------------------------------------- Sat Aug 23 00:05:23 1997 Andreas Mohr <100.30936@germany.net> diff --git a/controls/Makefile.in b/controls/Makefile.in index 9d243459a59..9be08482dcf 100644 --- a/controls/Makefile.in +++ b/controls/Makefile.in @@ -13,9 +13,11 @@ C_SRCS = \ icontitle.c \ listbox.c \ menu.c \ + progress.c \ scroll.c \ static.c \ status.c \ + uitools.c \ updown.c \ widgets.c diff --git a/controls/edit.c b/controls/edit.c index 28373cd659f..7e32b57890d 100644 --- a/controls/edit.c +++ b/controls/edit.c @@ -982,11 +982,17 @@ static INT32 EDIT_CallWordBreakProc(WND *wnd, EDITSTATE *es, INT32 start, INT32 segptr + start, index, count, action); LocalUnlock16(hloc16); return ret; - } else if (es->word_break_proc32A) - return (INT32)CallWordBreakProc32A((FARPROC32)es->word_break_proc32A, - es->text + start, index, count, action); + } + else if (es->word_break_proc32A) + { + dprintf_relay( stddeb, "CallTo32(wordbrk=%p,str='%s',idx=%d,cnt=%d,act=%d)\n", + es->word_break_proc32A, es->text + start, index, + count, action ); + return (INT32)es->word_break_proc32A( es->text + start, index, + count, action ); + } else - return EDIT_WordBreakProc(es->text + start, index, count, action); + return EDIT_WordBreakProc(es->text + start, index, count, action); } @@ -2819,7 +2825,7 @@ static void EDIT_WM_Char(WND *wnd, EDITSTATE *es, CHAR c, DWORD key_data) EDIT_EM_ReplaceSel(wnd, es, TRUE, "\t"); break; default: - if (!(es->style & ES_READONLY) && (c >= ' ') && (c != 127)) { + if (!(es->style & ES_READONLY) && ((BYTE)c >= ' ') && (c != 127)) { char str[2]; str[0] = c; str[1] = '\0'; diff --git a/controls/listbox.c b/controls/listbox.c index 5466abeff80..1308e818246 100644 --- a/controls/listbox.c +++ b/controls/listbox.c @@ -2462,7 +2462,7 @@ LRESULT WINAPI ListBoxWndProc( HWND32 hwnd, UINT32 msg, default: if ((msg >= WM_USER) && (msg < 0xc000)) - fprintf(stderr,"Listbox %04x: unknown msg %04x wp %08x lp %08lx\n", + dprintf_listbox(stddeb,"Listbox %04x: unknown msg %04x wp %08x lp %08lx\n", hwnd, msg, wParam, lParam ); return DefWindowProc32A( hwnd, msg, wParam, lParam ); } diff --git a/controls/menu.c b/controls/menu.c index 5a1e28cea6b..9e08d310078 100644 --- a/controls/menu.c +++ b/controls/menu.c @@ -1141,48 +1141,44 @@ UINT32 MENU_DrawMenuBar( HDC32 hDC, LPRECT32 lprect, HWND32 hwnd, /*********************************************************************** * MENU_PatchResidentPopup */ -BOOL32 MENU_PatchResidentPopup( HQUEUE16 checkQueue, WND* wndOwner ) +BOOL32 MENU_PatchResidentPopup( HQUEUE16 checkQueue, WND* checkWnd ) { - /* checkQueue tells us whether we have to disconnect top - * popup from the wndOwner or (if the latter is NULL) from - * the checkQueue. If checkQueue is 0 then we need to set - * popup owner to the wndOwner. - * - * This is supposed to be called when top popup is hidden. */ - if( pTopPopupWnd ) { HTASK16 hTask = 0; - dprintf_menu(stddeb,"patching resident popup: %04x, %08x\n", - checkQueue, (unsigned) wndOwner); - if( wndOwner ) - { - if( pTopPopupWnd->owner == wndOwner ) - { - if( checkQueue ) pTopPopupWnd->owner = NULL; - return TRUE; - } - - /* switch to the new owner */ + dprintf_menu(stddeb,"patching resident popup: %04x %04x [%04x %04x]\n", + checkQueue, checkWnd ? checkWnd->hwndSelf : 0, pTopPopupWnd->hmemTaskQ, + pTopPopupWnd->owner ? pTopPopupWnd->owner->hwndSelf : 0); - if( wndOwner->hmemTaskQ == pTopPopupWnd->hmemTaskQ ) - return TRUE; - hTask = QUEUE_GetQueueTask( wndOwner->hmemTaskQ ); - } - else if( pTopPopupWnd->hmemTaskQ == checkQueue ) + switch( checkQueue ) { - /* switch to the different task */ + case 0: /* checkWnd is the new popup owner */ + if( checkWnd ) + { + pTopPopupWnd->owner = checkWnd; + if( pTopPopupWnd->hmemTaskQ != checkWnd->hmemTaskQ ) + hTask = QUEUE_GetQueueTask( checkWnd->hmemTaskQ ); + } + break; - hTask = QUEUE_GetQueueTask( pTopPopupWnd->hmemTaskQ ); - hTask = TASK_GetNextTask( hTask ); + case 0xFFFF: /* checkWnd is destroyed */ + if( pTopPopupWnd->owner == checkWnd ) + pTopPopupWnd->owner = NULL; + return TRUE; + + default: /* checkQueue is exiting */ + if( pTopPopupWnd->hmemTaskQ == checkQueue ) + { + hTask = QUEUE_GetQueueTask( pTopPopupWnd->hmemTaskQ ); + hTask = TASK_GetNextTask( hTask ); + } + break; } if( hTask ) { TDB* task = (TDB*)GlobalLock16( hTask ); - - pTopPopupWnd->owner = wndOwner; if( task ) { pTopPopupWnd->hInstance = task->hInstance; @@ -3537,7 +3533,7 @@ HMENU16 WINAPI LoadMenu16( HINSTANCE16 instance, SEGPTR name ) if (!name) return 0; /* check for Win32 module */ - instance = GetExePtr( instance ); + instance = MODULE_HANDLEtoHMODULE16( instance ); if (MODULE_GetPtr(instance)->flags & NE_FFLAGS_WIN32) return LoadMenu32A(instance,PTR_SEG_TO_LIN(name)); @@ -3837,7 +3833,7 @@ BOOL16 WINAPI InsertMenuItem16( HMENU16 hmenu, UINT16 pos, BOOL16 byposition, miia.cbSize = sizeof(miia); miia.fMask = mii->fMask; - miia.dwTypeData = miia.dwTypeData; + miia.dwTypeData = mii->dwTypeData; miia.fType = mii->fType; miia.fState = mii->fState; miia.wID = mii->wID; diff --git a/controls/progress.c b/controls/progress.c new file mode 100644 index 00000000000..c0311e29a03 --- /dev/null +++ b/controls/progress.c @@ -0,0 +1,208 @@ +/* + * Progress control + * + * Copyright 1997 Dimitrie O. Paun + * + * TODO: + * - I do not know what to to on WM_[SG]ET_FONT + * Problems: + * - I think I do not compute correctly the numer of leds to be drawn + */ + +#include +#include +#include "windows.h" +#include "syscolor.h" +#include "sysmetrics.h" +#include "progress.h" +#include "graphics.h" +#include "heap.h" +#include "win.h" +#include "stddebug.h" +#include "debug.h" + +/* Control configuration constants */ + +#define LED_WIDTH 8 +#define LED_GAP 2 + +/* Work constants */ + +#define UNKNOWN_PARAM(msg, wParam, lParam) dprintf_progress(stddeb, \ + "Progress Ctrl: Unknown parameter(s) for message " #msg \ + "(%04x): wp=%04x lp=%08lx\n", msg, wParam, lParam); + +#define PROGRESS_GetInfoPtr(wndPtr) ((PROGRESS_INFO *)wndPtr->wExtra) + + +/*********************************************************************** + * PROGRESS_Paint + * Draw the arrows. The background need not be erased. + * If dc!=0, it draws on it + */ +static void PROGRESS_Paint(WND *wndPtr, HDC32 dc) +{ + PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(wndPtr); + HBRUSH32 ledBrush; + int rightBar, rightMost; + PAINTSTRUCT32 ps; + RECT32 rect; + HDC32 hdc; + + dprintf_progress(stddeb, "Progress Bar: paint pos=%d min=%d, max=%d\n", + infoPtr->CurVal, infoPtr->MinVal, infoPtr->MaxVal); + + /* get a dc */ + hdc = dc==0 ? BeginPaint32(wndPtr->hwndSelf, &ps) : dc; + + /* get the required brush */ + ledBrush = GetSysColorBrush32(COLOR_HIGHLIGHT); + + /* get rect for the bar, adjusted for the border */ + GetClientRect32(wndPtr->hwndSelf, &rect); + + /* draw the border */ + DrawEdge32(hdc, &rect, BDR_SUNKENOUTER, BF_RECT|BF_ADJUST|BF_MIDDLE); + rect.left++; rect.right--; rect.top++; rect.bottom--; + rightMost = rect.right; + + /* compute extent of progress bar */ + rightBar = rect.left + + MulDiv32(infoPtr->CurVal-infoPtr->MinVal, + rect.right - rect.left, + infoPtr->MaxVal-infoPtr->MinVal); + + /* now draw the bar */ + while(rect.left < rightBar) { + rect.right = rect.left+LED_WIDTH; + FillRect32(hdc, &rect, ledBrush); + rect.left = rect.right+LED_GAP; + } + + /* clean-up */ + if(!dc) + EndPaint32(wndPtr->hwndSelf, &ps); +} + +/*********************************************************************** + * PROGRESS_CoercePos + * Makes sure the current position (CUrVal) is within bounds. + */ +static void PROGRESS_CoercePos(WND *wndPtr) +{ + PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(wndPtr); + + if(infoPtr->CurVal < infoPtr->MinVal) + infoPtr->CurVal = infoPtr->MinVal; + if(infoPtr->CurVal > infoPtr->MaxVal) + infoPtr->CurVal = infoPtr->MaxVal; +} + +/*********************************************************************** + * ProgressWindowProc + */ +LRESULT WINAPI ProgressWindowProc(HWND32 hwnd, UINT32 message, + WPARAM32 wParam, LPARAM lParam) +{ + WND *wndPtr = WIN_FindWndPtr(hwnd); + PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(wndPtr); + UINT32 temp; + + switch(message) + { + case WM_CREATE: + /* initialize the info struct */ + infoPtr->MinVal=0; + infoPtr->MaxVal=100; + infoPtr->CurVal=0; + infoPtr->Step=10; + dprintf_updown(stddeb, "Progress Ctrl creation, hwnd=%04x\n", hwnd); + break; + + case WM_DESTROY: + dprintf_updown(stddeb, "Progress Ctrl destruction, hwnd=%04x\n", hwnd); + break; + + case WM_ERASEBKGND: + /* pretend to erase it here, but we will do it in the paint + function to avoid flicker */ + return 1; + + case WM_GETFONT: + /* FIXME: What do we need to do? */ + break; + + case WM_SETFONT: + /* FIXME: What do we need to do? */ + break; + + case WM_PAINT: + PROGRESS_Paint(wndPtr, wParam); + break; + + case PBM_DELTAPOS: + if(lParam) + UNKNOWN_PARAM(PBM_DELTAPOS, wParam, lParam); + temp = infoPtr->CurVal; + if(wParam != 0){ + infoPtr->CurVal += (UINT16)wParam; + PROGRESS_CoercePos(wndPtr); + PROGRESS_Paint(wndPtr, 0); + } + return temp; + + case PBM_SETPOS: + if (lParam) + UNKNOWN_PARAM(PBM_SETPOS, wParam, lParam); + temp = infoPtr->CurVal; + if(temp != wParam){ + infoPtr->CurVal = (UINT16)wParam; + PROGRESS_CoercePos(wndPtr); + PROGRESS_Paint(wndPtr, 0); + } + return temp; + + case PBM_SETRANGE: + if (wParam) + UNKNOWN_PARAM(PBM_SETRANGE, wParam, lParam); + temp = MAKELONG(infoPtr->MinVal, infoPtr->MaxVal); + if(temp != lParam){ + infoPtr->MinVal = LOWORD(lParam); + infoPtr->MaxVal = HIWORD(lParam); + if(infoPtr->MaxVal <= infoPtr->MinVal) + infoPtr->MaxVal = infoPtr->MinVal+1; + PROGRESS_CoercePos(wndPtr); + PROGRESS_Paint(wndPtr, 0); + } + return temp; + + case PBM_SETSTEP: + if (lParam) + UNKNOWN_PARAM(PBM_SETSTEP, wParam, lParam); + temp = infoPtr->Step; + infoPtr->Step = (UINT16)wParam; + return temp; + + case PBM_STEPIT: + if (wParam || lParam) + UNKNOWN_PARAM(PBM_STEPIT, wParam, lParam); + temp = infoPtr->CurVal; + infoPtr->CurVal += infoPtr->Step; + if(infoPtr->CurVal > infoPtr->MaxVal) + infoPtr->CurVal = infoPtr->MinVal; + if(temp != infoPtr->CurVal) + PROGRESS_Paint(wndPtr, 0); + return temp; + + default: + if (message >= WM_USER) + fprintf( stderr, "Progress Ctrl: unknown msg %04x wp=%04x lp=%08lx\n", + message, wParam, lParam ); + return DefWindowProc32A( hwnd, message, wParam, lParam ); + } + + return 0; +} + + + diff --git a/controls/status.c b/controls/status.c index 0732664b95c..df14c5379dd 100644 --- a/controls/status.c +++ b/controls/status.c @@ -41,34 +41,29 @@ static STATUSWINDOWINFO *GetStatusInfo(HWND32 hwnd) void WINAPI DrawStatusText32A( HDC32 hdc, LPRECT32 lprc, LPCSTR text, UINT32 style ) { - RECT32 r, rt; + RECT32 r, rt; int oldbkmode; + UINT32 border; r = *lprc; - if (style == 0 || - style == SBT_POPOUT) { - InflateRect32(&r, -1, -1); - SelectObject32(hdc, sysColorObjects.hbrushScrollbar); - Rectangle32(hdc, r.left, r.top, r.right, r.bottom); + if(style == SBT_OWNERDRAW){ + /* FIXME for SBT_OWNERDRAW, SBT_RTLREADING */ + } + else{ + DrawEdge32(hdc, &r, BDR_RAISEDINNER, BF_RECT|BF_ADJUST|BF_FLAT); - /* draw border */ - SelectObject32(hdc, sysColorObjects.hpenWindowFrame); - if (style == 0) - DrawEdge32(hdc, &r, EDGE_SUNKEN, BF_RECT); - else - DrawEdge32(hdc, &r, EDGE_RAISED, BF_RECT); - } - else if (style == SBT_NOBORDERS) { - SelectObject32(hdc, sysColorObjects.hbrushScrollbar); - Rectangle32(hdc, r.left, r.top, r.right, r.bottom); - } - else { /* fixme for SBT_OWNERDRAW, SBT_RTLREADING */ - - } + if(style==SBT_POPOUT) + border = BDR_RAISEDOUTER; + else if(style==SBT_NOBORDERS) + border = 0; + else + border = BDR_SUNKENOUTER; - /* now draw text */ - if ((style != SBT_OWNERDRAW) && text) { + DrawEdge32(hdc, &r, border, BF_RECT | BF_ADJUST | BF_MIDDLE); + + /* now draw text */ + if (text) { SelectObject32(hdc, sysColorObjects.hpenWindowText); oldbkmode = SetBkMode32(hdc, TRANSPARENT); rt = r; @@ -77,8 +72,10 @@ void WINAPI DrawStatusText32A( HDC32 hdc, LPRECT32 lprc, LPCSTR text, &rt, DT_LEFT | DT_VCENTER | DT_SINGLELINE); if (oldbkmode != TRANSPARENT) - SetBkMode32(hdc, oldbkmode); + SetBkMode32(hdc, oldbkmode); + } } + } static BOOL32 SW_Refresh( HWND32 hwnd, HDC32 hdc, STATUSWINDOWINFO *self ) diff --git a/controls/uitools.c b/controls/uitools.c new file mode 100644 index 00000000000..b245ebc810c --- /dev/null +++ b/controls/uitools.c @@ -0,0 +1,390 @@ +/* + * User Interface Functions + * + * Copyright 1997 Dimitrie O. Paun + */ + +#include +#include "windows.h" +#include "debug.h" + +/*********************************************************************** + * UITOOLS_DrawDiagEdge + * + * Same as DrawEdge, but with BF_DIAGONAL + * I tested it extensively and as far as I can tell it is identical to the + * implementaion in Win95. + * I do not like that I create and + * use the 3 Pens to draw the diagonals. It would be better to draw them + * using the brushes returned by GetSysColorBrush func, but I did not have + * the patience to implement that yet. + */ +static BOOL32 UITOOLS_DrawDiagEdge(HDC32 hdc, RECT32 *rect, UINT32 edge, + UINT32 flags) +{ + HPEN32 facePen, shadowPen, lightPen, blackPen, grayPen, nullPen; + HPEN32 iPen, oPen, oldPen; + HBRUSH32 oldBrush, faceBrush; + int cl, cr, ct, cb; + BOOL32 mainDiag; + POINT32 tp; + RECT32 r; + + /* If both rasied and sunken is specified, they anihilate one another */ + if( !((flags & BF_MONO) || (flags & BF_FLAT)) ){ + if( (edge & BDR_RAISEDOUTER) && (edge & BDR_SUNKENOUTER) ) + return FALSE; + if( (edge & BDR_RAISEDINNER) && (edge & BDR_SUNKENINNER) ) + return FALSE; + } + + /* Create/get the tools of the trade... */ + facePen = CreatePen32(PS_SOLID, 0, GetSysColor32(COLOR_BTNFACE)); + shadowPen = CreatePen32(PS_SOLID, 0, GetSysColor32(COLOR_BTNSHADOW)); + lightPen = CreatePen32(PS_SOLID, 0, GetSysColor32(COLOR_BTNHILIGHT)); + grayPen = CreatePen32(PS_SOLID, 0, RGB(168, 152, 144)); + blackPen = GetStockObject32(BLACK_PEN); + nullPen = GetStockObject32(NULL_PEN); + faceBrush = GetSysColorBrush32(COLOR_BTNFACE); + oldPen = SelectObject32(hdc, nullPen); + oldBrush = SelectObject32(hdc, faceBrush); + + /* this is my working rectangle */ + r = *rect; + + if(flags & BF_MONO){ + oPen = blackPen; + iPen = nullPen; + }else if(flags & BF_FLAT){ + oPen = shadowPen; + iPen = facePen; + }else { + if(flags & BF_SOFT){ + if(flags & BF_BOTTOM){ + oPen = (edge & BDR_RAISEDOUTER) ? blackPen : lightPen; + iPen = (edge & BDR_RAISEDINNER) ? shadowPen : grayPen; + } + else{ + oPen = (edge & BDR_RAISEDOUTER) ? lightPen : blackPen; + iPen = (edge & BDR_RAISEDINNER) ? grayPen : shadowPen; + } + } + else{ + if(flags & BF_BOTTOM){ + oPen = (edge & BDR_RAISEDOUTER) ? blackPen : lightPen; + iPen = (edge & BDR_RAISEDINNER) ? shadowPen : grayPen; + } + else{ + oPen = (edge & BDR_RAISEDOUTER) ? grayPen : shadowPen; + iPen = (edge & BDR_RAISEDINNER) ? lightPen : blackPen; + } + } + } + + if(flags & BF_BOTTOM){ + if(flags & BF_LEFT){ + cr = -1; cl = 0; + ct = 0; cb = -1; + mainDiag = TRUE; + tp.x = r.left; tp.y = r.top; + } + else{ /* RIGHT */ + cr = -1; cl = 0; + ct = 1; cb = 0; + tp.x = r.left; tp.y = r.bottom-1; + mainDiag = FALSE; + } + } + else{ /* TOP */ + if(flags & BF_LEFT){ + cr = 0; cl = 1; + ct = 0; cb = -1; + mainDiag = FALSE; + tp.x = r.right; tp.y = r.top; + } + else{ /* RIGHT */ + cr = 0; cl = 1; + ct = 1; cb = 0; + tp.x = r.right; tp.y = r.bottom-1; + mainDiag = TRUE; + } + } + + /* if it has external edge, draw it */ + if(edge & BDR_OUTER){ + SelectObject32(hdc, oPen); + MoveToEx32(hdc, r.left, mainDiag ? r.bottom-1 : r.top, 0); + LineTo32(hdc, r.right, mainDiag ? r.top-1 : r.bottom); + r.left += cl; r.right += cr; r.top += ct; r.bottom += cb; + } + + /* if it has internal edge, draw it */ + if(edge & BDR_INNER){ + SelectObject32(hdc, iPen); + MoveToEx32(hdc, r.left, mainDiag ? r.bottom-1 : r.top, 0); + LineTo32(hdc, r.right, mainDiag ? r.top-1 : r.bottom); + r.left += cl; r.right += cr; r.top += ct; r.bottom += cb; + } + + if((flags & BF_MIDDLE) && !(flags & BF_MONO)){ + POINT32 p[3]; + p[0].x = mainDiag ? r.right: r.left; + p[0].y = r.top; + p[1].x = mainDiag ? r.left : r.right; + p[1].y = r.bottom; + p[2].x = tp.x; + p[2].y = tp.y; + SelectObject32(hdc, nullPen); + SelectObject32(hdc, faceBrush); + Polygon32(hdc, p, 3); + } + + if(flags & BF_ADJUST) + *rect = r; + + /* Restore the DC */ + SelectObject32(hdc, oldPen); + SelectObject32(hdc, oldBrush); + + /* Clean-up */ + DeleteObject32(facePen); + DeleteObject32(shadowPen); + DeleteObject32(lightPen); + DeleteObject32(grayPen); + + return TRUE; +} + + +/*********************************************************************** + * UITOOLS_DrawRectEdge + * + * Same as DrawEdge, but without BF_DIAGONAL + * I tested this function and it works very well. You should not change it + * unless you find a bug. If you don't like the colors, it it not its + * fault - the system colors are not OK. + * Again, I tested this function on Win95 and I compared the output with the + * one generated by the native DrawEdge and it is identical on all cases that + * I tried, and I tried quite a few. + */ +static BOOL32 UITOOLS_DrawRectEdge(HDC32 hdc, RECT32 *rect, + UINT32 edge, UINT32 flags) +{ + HBRUSH32 faceBrush, shadowBrush, lightBrush, blackBrush, grayBrush, nullBrush; + HBRUSH32 iNBrush, iSBrush, iEBrush, iWBrush; + HBRUSH32 oNBrush, oSBrush, oEBrush, oWBrush; + HBRUSH32 oldBrush; + RECT32 r; + + /* If both rasied and sunken is specified, they anihilate one another */ + if( !((flags & BF_MONO) || (flags & BF_FLAT)) ){ + if( (edge & BDR_RAISEDOUTER) && (edge & BDR_SUNKENOUTER) ) + return FALSE; + if( (edge & BDR_RAISEDINNER) && (edge & BDR_SUNKENINNER) ) + return FALSE; + } + + faceBrush = GetSysColorBrush32(COLOR_BTNFACE); + shadowBrush = GetSysColorBrush32(COLOR_BTNSHADOW); + lightBrush = GetSysColorBrush32(COLOR_BTNHILIGHT); + blackBrush = GetStockObject32(BLACK_BRUSH); + grayBrush = GetStockObject32(LTGRAY_BRUSH); + nullBrush = GetStockObject32(NULL_BRUSH); + oldBrush = SelectObject32(hdc, nullBrush); + + /* this is my working rectangle */ + r = *rect; + + if(flags & BF_MONO){ + oNBrush = oSBrush = oEBrush = oWBrush = blackBrush; + iNBrush = iSBrush = iEBrush = iWBrush = nullBrush; + }else if(flags & BF_FLAT){ + oNBrush = oSBrush = oEBrush = oWBrush = shadowBrush; + iNBrush = iSBrush = iEBrush = iWBrush = faceBrush; + }else { + if(flags & BF_SOFT){ + oNBrush = oWBrush = (edge & BDR_RAISEDOUTER) ? lightBrush : blackBrush; + oSBrush = oEBrush = (edge & BDR_RAISEDOUTER) ? blackBrush : lightBrush; + iNBrush = iWBrush = (edge & BDR_RAISEDINNER) ? grayBrush : shadowBrush; + iSBrush = iEBrush = (edge & BDR_RAISEDINNER) ? shadowBrush : grayBrush; + } + else{ + oNBrush = oWBrush = (edge & BDR_RAISEDOUTER) ? grayBrush : shadowBrush; + oSBrush = oEBrush = (edge & BDR_RAISEDOUTER) ? blackBrush : lightBrush; + iNBrush = iWBrush = (edge & BDR_RAISEDINNER) ? lightBrush : blackBrush; + iSBrush = iEBrush = (edge & BDR_RAISEDINNER) ? shadowBrush : grayBrush; + } + } + + /* if it has external edge, draw it */ + if(edge & BDR_OUTER){ + if(flags & BF_RIGHT){ + SelectObject32(hdc, oEBrush); + PatBlt32(hdc, r.right-1, r.top, 1, r.bottom - r.top, PATCOPY); + r.right--; + } + if(flags & BF_BOTTOM){ + SelectObject32(hdc, oSBrush); + PatBlt32(hdc, r.left, r.bottom-1, r.right-r.left, 1, PATCOPY); + r.bottom--; + } + if(flags & BF_LEFT){ + SelectObject32(hdc, oWBrush); + PatBlt32(hdc, r.left, r.top, 1, r.bottom - r.top, PATCOPY); + r.left++; + } + if(flags & BF_TOP){ + SelectObject32(hdc, oNBrush); + PatBlt32(hdc, r.left, r.top, r.right-r.left, 1, PATCOPY); + r.top++; + } + } + + /* if it has internal edge, draw it */ + if(edge & BDR_INNER){ + if(flags & BF_RIGHT){ + SelectObject32(hdc, iEBrush); + PatBlt32(hdc, r.right-1, r.top, 1, r.bottom - r.top, PATCOPY); + r.right--; + } + if(flags & BF_BOTTOM){ + SelectObject32(hdc, iSBrush); + PatBlt32(hdc, r.left, r.bottom-1, r.right-r.left, 1, PATCOPY); + r.bottom--; + } + if(flags & BF_LEFT){ + SelectObject32(hdc, iWBrush); + PatBlt32(hdc, r.left, r.top, 1, r.bottom - r.top, PATCOPY); + r.left++; + } + if(flags & BF_TOP){ + SelectObject32(hdc, iNBrush); + PatBlt32(hdc, r.left, r.top, r.right-r.left, 1, PATCOPY); + r.top++; + } + } + + /* if we got to fill the middle, to it now */ + if((flags & BF_MIDDLE) && !(flags & BF_MONO)) + FillRect32(hdc, &r, faceBrush); + + /* adjust the rectangle if required */ + if(flags & BF_ADJUST) + *rect = r; + + /* Restore the DC */ + SelectObject32(hdc, oldBrush); + + return TRUE; +} + + +/********************************************************************** + * DrawEdge16 (USER.659) + */ +BOOL16 WINAPI DrawEdge16( HDC16 hdc, LPRECT16 rc, UINT16 edge, UINT16 flags ) +{ + RECT32 rect32; + BOOL32 ret; + + CONV_RECT16TO32( rc, &rect32 ); + ret = DrawEdge32( hdc, &rect32, edge, flags ); + CONV_RECT32TO16( &rect32, rc ); + return ret; +} + +/********************************************************************** + * DrawEdge32 (USER32.154) + */ +BOOL32 WINAPI DrawEdge32( HDC32 hdc, LPRECT32 rc, UINT32 edge, UINT32 flags ) +{ + dprintf_graphics( stddeb, "DrawEdge: %04x %d,%d-%d,%d %04x %04x\n", + hdc, rc->left, rc->top, rc->right, rc->bottom, + edge, flags ); + + if(flags & BF_DIAGONAL) + return UITOOLS_DrawDiagEdge(hdc, rc, edge, flags); + else + return UITOOLS_DrawRectEdge(hdc, rc, edge, flags); +} + + +/*********************************************************************** + * UITOOLS_DrawFrameButton + */ +static BOOL32 UITOOLS_DrawFrameButton(HDC32 hdc, LPRECT32 rc, UINT32 uState) +{ + fprintf( stdnimp,"DrawFrameButton(%x,%p,%x), empty stub!\n", + hdc,rc,uState ); + return FALSE; +} + +/*********************************************************************** + * UITOOLS_DrawFrameCaption + */ +static BOOL32 UITOOLS_DrawFrameCaption(HDC32 hdc, LPRECT32 rc, UINT32 uState) +{ + fprintf( stdnimp,"DrawFrameCaption(%x,%p,%x), empty stub!\n", + hdc,rc,uState ); + return FALSE; +} + +/*********************************************************************** + * UITOOLS_DrawFrameMenu + */ +static BOOL32 UITOOLS_DrawFrameMenu(HDC32 hdc, LPRECT32 rc, UINT32 uState) +{ + fprintf( stdnimp,"DrawFrameMenu32(%x,%p,%x), empty stub!\n", + hdc,rc,uState ); + return FALSE; +} + +/*********************************************************************** + * UITOOLS_DrawFrameScroll + */ +static BOOL32 UITOOLS_DrawFrameScroll(HDC32 hdc, LPRECT32 rc, UINT32 uState) +{ + fprintf( stdnimp,"DrawFrameScroll32(%x,%p,%x), empty stub!\n", + hdc,rc,uState ); + return FALSE; +} + + +/********************************************************************** + * DrawFrameControl16 (USER.656) + */ +BOOL16 WINAPI DrawFrameControl16( HDC16 hdc, LPRECT16 rc, UINT16 uType, + UINT16 uState ) +{ + RECT32 rect32; + BOOL32 ret; + + CONV_RECT16TO32( rc, &rect32 ); + ret = DrawFrameControl32( hdc, &rect32, uType, uState ); + CONV_RECT32TO16( &rect32, rc ); + return ret; +} + + +/********************************************************************** + * DrawFrameControl32 (USER32.157) + */ +BOOL32 WINAPI DrawFrameControl32( HDC32 hdc, LPRECT32 rc, UINT32 uType, + UINT32 uState ) +{ + switch(uType) + { + case DFC_BUTTON: + return UITOOLS_DrawFrameButton(hdc, rc, uState); + case DFC_CAPTION: + return UITOOLS_DrawFrameCaption(hdc, rc, uState); + case DFC_MENU: + return UITOOLS_DrawFrameMenu(hdc, rc, uState); + case DFC_SCROLL: + return UITOOLS_DrawFrameScroll(hdc, rc, uState); + default: + fprintf( stdnimp,"DrawFrameControl32(%x,%p,%d,%x), bad type!\n", + hdc,rc,uType,uState ); + } + return FALSE; +} diff --git a/controls/updown.c b/controls/updown.c index a3a75ef2c0f..4282300f355 100644 --- a/controls/updown.c +++ b/controls/updown.c @@ -8,6 +8,7 @@ * arrow keys * - I am not sure about the default values for the Min, Max, Pos * (in the UPDOWN_INFO the fields: MinVal, MaxVal, CurVal) + * - I think I do not handle correctly the WS_BORDER style. * Testing: * Not much. The following have not been tested at all: * - horizontal arrows @@ -20,10 +21,7 @@ * behave very well so I am confident it does work in most (all) of the * untested cases. * Problems: - * At the moment, the control will no draw itself very well because it - * uses some features in DrawEdge that are not yet implemented. - * In other words, there is no known problem, exempt for the things in - * the TODO list above. + * I do not like the arrows yet, I'll work more on them later on. */ #include @@ -47,10 +45,10 @@ #define INITIAL_DELAY 500 /* initial timer until auto-increment kicks in */ #define REPEAT_DELAY 50 /* delay between auto-increments */ -#define DEFAULT_WIDTH 10 /* default width of the ctrl */ -#define DEFAULT_XSEP 0 /* default separation between buddy and crtl */ -#define DEFAULT_ADDTOP 1 /* amount to extend above the buddy window */ -#define DEFAULT_ADDBOT 1 /* amount to extend below the buddy window */ +#define DEFAULT_WIDTH 14 /* default width of the ctrl */ +#define DEFAULT_XSEP 0 /* default separation between buddy and crtl */ +#define DEFAULT_ADDTOP 0 /* amount to extend above the buddy window */ +#define DEFAULT_ADDBOT 0 /* amount to extend below the buddy window */ /* Work constants */ @@ -65,9 +63,6 @@ static int accelIndex = -1; -#define max(a,b) ((a)>(b)?(a):(b)) -#define min(a,b) ((a)<(b)?(a):(b)) - #define UNKNOWN_PARAM(msg, wParam, lParam) dprintf_updown(stddeb, \ "UpDown Ctrl: Unknown parameter(s) for message " #msg \ "(%04x): wp=%04x lp=%08lx\n", msg, wParam, lParam); @@ -129,7 +124,7 @@ static void UPDOWN_GetArrowRect(WND *wndPtr, RECT32 *rect, BOOL32 incr) if (wndPtr->dwStyle & UDS_HORZ) { len = rect->right - rect->left; /* compute the width */ if (incr) - rect->left = len/2; + rect->left = len/2+1; else rect->right = len/2; } @@ -138,7 +133,7 @@ static void UPDOWN_GetArrowRect(WND *wndPtr, RECT32 *rect, BOOL32 incr) if (incr) rect->bottom = len/2; else - rect->top = len/2; + rect->top = len/2+1; } } @@ -290,48 +285,57 @@ static BOOL32 UPDOWN_SetBuddyInt(WND *wndPtr) static void UPDOWN_DrawArrow(HDC32 hdc, RECT32 *rect, BOOL32 incr, BOOL32 pressed, BOOL32 horz) { - const int w = rect->right - rect->left; - const int h = rect->bottom - rect->top; - int offset = pressed ? 1 : 0, tmp; - POINT32 pts[3]; + const int rw = rect->right - rect->left; + const int rh = rect->bottom - rect->top; + int offset = pressed ? 1 : 0; + int th, x, y, len; + /* compute max extents of the triangle */ if(horz){ /* horizontal arrows */ - pts[0].x = rect->right - max(2, w/3) + offset; - pts[0].y = rect->top + max(2, h/4) + offset; - pts[1].x = pts[0].x; - pts[1].y = rect->bottom - max(2, h/4) + offset; - pts[2].x = rect->left + w/3 + offset; - pts[2].y = (pts[0].y + pts[1].y)/2; - if(pts[2].x-2left) - pts[2].x = rect->left + 2; - if(pts[2].x <= pts[0].x) - pts[2].x = pts[0].x - 1; + th = (3*rh)/5-2*4; + if(th > rw/2) + th = rw/2; + if(th < 2) + th = 2; - if(incr){ - tmp = pts[2].x; - pts[2].x = pts[0].x; - pts[0].x = pts[1].x = tmp; - } + /* compute the position of the tip */ + y = (rect->top+rect->bottom+1)/2 + offset; + if(incr) + x = (rect->left+rect->right+1)/2 + (2*th)/3 + offset; + else + x = (rect->left+rect->right)/2 + th/3 + offset; + + for(len=1; th>0; th--, len+=2){ + MoveToEx32(hdc, x, y, 0); + LineTo32(hdc, x, y+len); + if(incr) x--; + else x++; + y++; + } } else{ /* vertical arrows */ - pts[0].x = rect->left + max(2, w/4) + offset; - pts[0].y = rect->top + max(2, h/3) + offset; - pts[1].x = rect->right- max(2, w/4) + offset; - pts[1].y = pts[0].y; - pts[2].x = (pts[0].x + pts[1].x)/2; - pts[2].y = pts[0].y + h/3 + offset; - if(pts[2].y+2>rect->bottom) - pts[2].y = rect->bottom - 2; - if(pts[2].y <= pts[0].y) - pts[2].y = pts[0].y + 1; + th = (3*rw)/5-2*4; + if(th > rh/2) + th = rh/2; + if(th < 2) + th = 2; - if(incr){ - tmp = pts[2].y; - pts[2].y = pts[0].y; - pts[0].y = pts[1].y = tmp; + /* compute the position of the tip */ + x = (rect->left+rect->right+1)/2 + offset; + if(incr) + y = (rect->top+rect->bottom+1)/2 - th/3 + offset; + else + y = (rect->top+rect->bottom)/2 + (2*th)/3 + offset; + + for(len=1; th>0; th--, len+=2){ + MoveToEx32(hdc, x, y, 0); + LineTo32(hdc, x+len, y); + if(incr) y++; + else y--; + x--; } + } - Polygon32(hdc, pts, 3); } @@ -350,14 +354,6 @@ static void UPDOWN_Paint(WND *wndPtr) hdc = BeginPaint32( wndPtr->hwndSelf, &ps ); - /*FIXME - this is just for test */ - /* - when DrawEdge works properly, this should dissapear - as DrawEdge will erase the background */ -/*oldBrush = SelectObject32(hdc, GetStockObject32(GRAY_BRUSH)); - GetClientRect32(wndPtr->hwndSelf, &rect); - Rectangle32(hdc, rect.left, rect.top, rect.right, rect.bottom); - SelectObject32(hdc, oldBrush);*/ - /* First select the proper brush */ oldBrush = wndPtr->dwStyle & WS_DISABLED ? GRAY_BRUSH : BLACK_BRUSH; oldBrush = SelectObject32(hdc, GetStockObject32(oldBrush)); @@ -365,9 +361,12 @@ static void UPDOWN_Paint(WND *wndPtr) /* Draw the incr button */ UPDOWN_GetArrowRect(wndPtr, &rect, TRUE); prssed = (infoPtr->Flags & FLAG_INCR) && (infoPtr->Flags & FLAG_MOUSEIN); - DrawEdge32(hdc, &rect, prssed ? EDGE_SUNKEN : EDGE_RAISED, - BF_RECT | BF_SOFT | BF_MIDDLE); + DrawEdge32(hdc, &rect, prssed?EDGE_SUNKEN:EDGE_RAISED, BF_RECT|BF_MIDDLE); UPDOWN_DrawArrow(hdc, &rect, TRUE, prssed, wndPtr->dwStyle & UDS_HORZ); + + /* Draw the space between the buttons */ + rect.top = rect.bottom; rect.bottom++; + DrawEdge32(hdc, &rect, 0, BF_MIDDLE); /* Draw the decr button */ UPDOWN_GetArrowRect(wndPtr, &rect, FALSE); @@ -634,7 +633,7 @@ static void UPDOWN_HandleMouseEvent(WND *wndPtr, UINT32 msg, POINT32 pt) * UpDownWndProc */ LRESULT WINAPI UpDownWindowProc(HWND32 hwnd, UINT32 message, WPARAM32 wParam, - LPARAM lParam) + LPARAM lParam) { WND *wndPtr = WIN_FindWndPtr(hwnd); UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr(wndPtr); @@ -643,6 +642,9 @@ LRESULT WINAPI UpDownWindowProc(HWND32 hwnd, UINT32 message, WPARAM32 wParam, switch(message) { case WM_CREATE: + /* get rid of border, if any */ + wndPtr->dwStyle &= ~WS_BORDER; + /* initialize the info struct */ infoPtr->AccelCount=0; infoPtr->AccelVect=0; infoPtr->CurVal=0; infoPtr->MinVal=0; infoPtr->MaxVal=100; /*FIXME*/ @@ -745,7 +747,7 @@ LRESULT WINAPI UpDownWindowProc(HWND32 hwnd, UINT32 message, WPARAM32 wParam, UNKNOWN_PARAM(UDM_GETACCEL, wParam, lParam); return 0; } - temp = min(infoPtr->AccelCount, wParam); + temp = MIN(infoPtr->AccelCount, wParam); memcpy((void *)lParam, infoPtr->AccelVect, temp*sizeof(UDACCEL)); return temp; diff --git a/controls/widgets.c b/controls/widgets.c index c8b9990e603..9c1d4a3de60 100644 --- a/controls/widgets.c +++ b/controls/widgets.c @@ -9,8 +9,10 @@ #include "win.h" #include "commctrl.h" #include "button.h" +#include "progress.h" #include "static.h" #include "status.h" +#include "updown.h" #include "scroll.h" #include "updown.h" #include "desktop.h" @@ -104,7 +106,9 @@ static WNDCLASS32A WIDGETS_CommonControls32[] = { CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW, StatusWindowProc, 0, sizeof(STATUSWINDOWINFO), 0, 0, 0, 0, 0, STATUSCLASSNAME32A }, { CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW, UpDownWindowProc, 0, - sizeof(UPDOWN_INFO), 0, 0, 0, 0, 0, UPDOWN_CLASS32A } + sizeof(UPDOWN_INFO), 0, 0, 0, 0, 0, UPDOWN_CLASS32A }, + { CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW, ProgressWindowProc, 0, + sizeof(PROGRESS_INFO), 0, 0, 0, 0, 0, PROGRESS_CLASS32A } }; #define NB_COMMON_CONTROLS32 \ @@ -155,6 +159,8 @@ BOOL32 WIDGETS_Init(void) if (!(bicAtomTable[i] = RegisterClass32A( class32 ))) return FALSE; } + /* FIXME: hack to enable using built-in controls with Windows COMCTL32 */ + InitCommonControls(); SEGPTR_FREE(name); return TRUE; } @@ -167,15 +173,18 @@ void WINAPI InitCommonControls(void) { int i; char name[30]; + const char *old_name; WNDCLASS32A *class32 = WIDGETS_CommonControls32; for (i = 0; i < NB_COMMON_CONTROLS32; i++, class32++) { /* Just to make sure the string is > 0x10000 */ + old_name = class32->lpszClassName; strcpy( name, (char *)class32->lpszClassName ); class32->lpszClassName = name; class32->hCursor = LoadCursor16( 0, IDC_ARROW ); RegisterClass32A( class32 ); + class32->lpszClassName = old_name; } } diff --git a/debugger/dbg.y b/debugger/dbg.y index 39541c15196..cd84c903b9f 100644 --- a/debugger/dbg.y +++ b/debugger/dbg.y @@ -553,7 +553,7 @@ static void DEBUG_Main( int signal ) */ void DebugBreak32( CONTEXT *regs ) { - const char *module = MODULE_GetModuleName( GetExePtr(GetCurrentTask()) ); + const char *module = MODULE_GetModuleName( GetCurrentTask() ); fprintf( stderr, "%s called DebugBreak\n", module ? module : "???" ); DEBUG_context = *regs; DEBUG_Main( SIGTRAP ); @@ -564,7 +564,7 @@ void DebugBreak32( CONTEXT *regs ) */ void DebugBreak16( CONTEXT *regs ) { - const char *module = MODULE_GetModuleName( GetExePtr(GetCurrentTask()) ); + const char *module = MODULE_GetModuleName( GetCurrentTask() ); fprintf( stderr, "%s called DebugBreak\n", module ? module : "???" ); DEBUG_context = *regs; DEBUG_Main( SIGTRAP ); diff --git a/debugger/msc.c b/debugger/msc.c index 61bab5a6a97..3bc69afacec 100644 --- a/debugger/msc.c +++ b/debugger/msc.c @@ -886,8 +886,7 @@ DEBUG_InitCVDataTypes() * We don't fully process it here for performance reasons. */ int -DEBUG_RegisterDebugInfo(int fd, struct pe_data * pe, - int load_addr, u_long v_addr, u_long size) +DEBUG_RegisterDebugInfo(struct pe_data * pe,int load_addr, u_long v_addr, u_long size) { int has_codeview = FALSE; int rtn = FALSE; @@ -957,10 +956,7 @@ DEBUG_RegisterDebugInfo(int fd, struct pe_data * pe, * to proceed if we know what we need to do next. */ deefer->dbg_size = dbgptr->SizeOfData; - deefer->dbg_info = (char *) xmalloc(dbgptr->SizeOfData); - lseek(fd, dbgptr->PointerToRawData, SEEK_SET); - read(fd, deefer->dbg_info, deefer->dbg_size); - + deefer->dbg_info = pe->mappeddll+dbgptr->PointerToRawData; deefer->load_addr = (char *) load_addr; deefer->dbgdir = dbgptr; deefer->next = dbglist; diff --git a/debugger/registers.c b/debugger/registers.c index 5ed74ddb880..c280bb77b29 100644 --- a/debugger/registers.c +++ b/debugger/registers.c @@ -128,7 +128,7 @@ int DEBUG_GetRegister( enum debug_regs reg ) * * Set the register values from a sigcontext. */ -extern void DEBUG_SetSigContext( const SIGCONTEXT *sigcontext ) +void DEBUG_SetSigContext( const SIGCONTEXT *sigcontext ) { EAX_reg(&DEBUG_context) = EAX_sig(sigcontext); EBX_reg(&DEBUG_context) = EBX_sig(sigcontext); @@ -164,7 +164,7 @@ extern void DEBUG_SetSigContext( const SIGCONTEXT *sigcontext ) * * Build a sigcontext from the register values. */ -extern void DEBUG_GetSigContext( SIGCONTEXT *sigcontext ) +void DEBUG_GetSigContext( SIGCONTEXT *sigcontext ) { EAX_sig(sigcontext) = EAX_reg(&DEBUG_context); EBX_sig(sigcontext) = EBX_reg(&DEBUG_context); diff --git a/debugger/stabs.c b/debugger/stabs.c index dcdeaeb6d2f..0fe8e41611b 100644 --- a/debugger/stabs.c +++ b/debugger/stabs.c @@ -1085,6 +1085,25 @@ DEBUG_ProcessElfObject(char * filename, unsigned int load_offset) status = stat(filename, &statbuf); if( status == -1 ) { + char *s,*t,*fn,*paths; + if (strchr(filename,'/')) + goto leave; + paths = xstrdup(getenv("PATH")); + s = paths; + while (s && *s) { + t = strchr(s,':'); + if (t) *t='\0'; + fn = (char*)xmalloc(strlen(filename)+1+strlen(s)+1); + strcpy(fn,s); + strcat(fn,"/"); + strcat(fn,filename); + if ((rtn = DEBUG_ProcessElfObject(fn,load_offset))) { + free(paths); + goto leave; + } + s = t+1; + } + free(paths); goto leave; } diff --git a/files/profile.c b/files/profile.c index eb15ace9fef..a034d863d76 100644 --- a/files/profile.c +++ b/files/profile.c @@ -501,7 +501,7 @@ static INT32 PROFILE_GetString( LPCSTR section, LPCSTR key_name, PROFILEKEY *key = NULL; if (!def_val) def_val = ""; - if (key_name) + if (key_name && key_name[0]) { key = PROFILE_Find( &CurProfile.section, section, key_name, FALSE ); PROFILE_CopyEntry( buffer, (key && key->value) ? key->value : def_val, @@ -839,6 +839,14 @@ INT32 WINAPI GetProfileString32W( LPCWSTR section, LPCWSTR entry, buffer, len, wininiW ); } +/*********************************************************************** + * GetProfileSection32A (KERNEL32.268) + */ +INT32 WINAPI GetProfileSection32A( LPCSTR section, LPSTR buffer, INT32 len ) +{ + return GetPrivateProfileSection32A( section, buffer, len, "win.ini" ); +} + /*********************************************************************** * WriteProfileString16 (KERNEL.59) @@ -963,6 +971,16 @@ INT32 WINAPI GetPrivateProfileString32W( LPCWSTR section, LPCWSTR entry, return ret; } +/*********************************************************************** + * GetPrivateProfileSection32A (KERNEL32.255) + */ +INT32 WINAPI GetPrivateProfileSection32A( LPCSTR section, LPSTR buffer, + INT32 len, LPCSTR filename ) +{ + if (PROFILE_Open( filename )) + return PROFILE_GetString( section, NULL, NULL, buffer, len ); + return 0; +} /*********************************************************************** diff --git a/graphics/fontengine.c b/graphics/fontengine.c index 4dd6e1fc7e2..1676836aafe 100644 --- a/graphics/fontengine.c +++ b/graphics/fontengine.c @@ -10,7 +10,7 @@ /* GDI 300 */ WORD WINAPI EngineEnumerateFont(LPSTR fontname, FARPROC16 proc, DWORD data ) { - printf("In engineEnumerateFont for %s\n",(fontname)?fontname:"NULL"); + fprintf(stderr,"EngineEnumerateFont(%s,%p,%d),stub\n",fontname,proc,data); return 0; } #ifdef NOTDEF @@ -23,7 +23,7 @@ WORD WINAPI EngineDeleteFont(LPFONTINFO16 lpFontInfo) /* GDI 302 */ WORD WINAPI EngineRealizeFont(LPLOGFONT16 lplogFont, LPTEXTXFORM16 lptextxform, LPFONTINFO16 lpfontInfo) { - printf("In EngineRealizeFont\n"); + fprintf(stderr,"EngineRealizeFont(%p,%p,%p),stub\n",lplogFont,lptextxform,lpfontInfo); return 0; } diff --git a/graphics/painting.c b/graphics/painting.c index efd785ab18b..5fef3304a85 100644 --- a/graphics/painting.c +++ b/graphics/painting.c @@ -25,6 +25,12 @@ #include "debug.h" #include "xmalloc.h" +BOOL32 DrawDiagEdge32(HDC32 hdc, RECT32 *rect, UINT32 edge, UINT32 flags); +BOOL32 DrawRectEdge32(HDC32 hdc, RECT32 *rect, UINT32 edge, UINT32 flags); +BOOL32 DrawFrameButton32(HDC32 hdc, LPRECT32 rc, UINT32 uState); +BOOL32 DrawFrameCaption32(HDC32 hdc, LPRECT32 rc, UINT32 uState); +BOOL32 DrawFrameMenu32(HDC32 hdc, LPRECT32 rc, UINT32 uState); +BOOL32 DrawFrameScroll32(HDC32 hdc, LPRECT32 rc, UINT32 uState); /*********************************************************************** * LineTo16 (GDI.19) @@ -658,127 +664,6 @@ BOOL32 WINAPI FloodFill32( HDC32 hdc, INT32 x, INT32 y, COLORREF color ) } -/********************************************************************** - * DrawEdge16 (USER.659) - */ -BOOL16 WINAPI DrawEdge16( HDC16 hdc, LPRECT16 rc, UINT16 edge, UINT16 flags ) -{ - RECT32 rect32; - BOOL32 ret; - - CONV_RECT16TO32( rc, &rect32 ); - ret = DrawEdge32( hdc, &rect32, edge, flags ); - CONV_RECT32TO16( &rect32, rc ); - return ret; -} - - -/********************************************************************** - * DrawEdge32 (USER32.154) - */ -BOOL32 WINAPI DrawEdge32( HDC32 hdc, LPRECT32 rc, UINT32 edge, UINT32 flags ) -{ - HBRUSH32 hbrushOld; - - if (flags >= BF_DIAGONAL) - fprintf( stderr, "DrawEdge: unsupported flags %04x\n", flags ); - - dprintf_graphics( stddeb, "DrawEdge: %04x %d,%d-%d,%d %04x %04x\n", - hdc, rc->left, rc->top, rc->right, rc->bottom, - edge, flags ); - - /* First do all the raised edges */ - - hbrushOld = SelectObject32( hdc, sysColorObjects.hbrushBtnHighlight ); - if (edge & BDR_RAISEDOUTER) - { - if (flags & BF_LEFT) PatBlt32( hdc, rc->left, rc->top, - 1, rc->bottom - rc->top - 1, PATCOPY ); - if (flags & BF_TOP) PatBlt32( hdc, rc->left, rc->top, - rc->right - rc->left - 1, 1, PATCOPY ); - } - if (edge & BDR_SUNKENOUTER) - { - if (flags & BF_RIGHT) PatBlt32( hdc, rc->right - 1, rc->top, - 1, rc->bottom - rc->top, PATCOPY ); - if (flags & BF_BOTTOM) PatBlt32( hdc, rc->left, rc->bottom - 1, - rc->right - rc->left, 1, PATCOPY ); - } - if (edge & BDR_RAISEDINNER) - { - if (flags & BF_LEFT) PatBlt32( hdc, rc->left + 1, rc->top + 1, - 1, rc->bottom - rc->top - 2, PATCOPY ); - if (flags & BF_TOP) PatBlt32( hdc, rc->left + 1, rc->top + 1, - rc->right - rc->left - 2, 1, PATCOPY ); - } - if (edge & BDR_SUNKENINNER) - { - if (flags & BF_RIGHT) PatBlt32( hdc, rc->right - 2, rc->top + 1, - 1, rc->bottom - rc->top - 2, PATCOPY ); - if (flags & BF_BOTTOM) PatBlt32( hdc, rc->left + 1, rc->bottom - 2, - rc->right - rc->left - 2, 1, PATCOPY ); - } - - /* Then do all the sunken edges */ - - SelectObject32( hdc, sysColorObjects.hbrushBtnShadow ); - if (edge & BDR_SUNKENOUTER) - { - if (flags & BF_LEFT) PatBlt32( hdc, rc->left, rc->top, - 1, rc->bottom - rc->top - 1, PATCOPY ); - if (flags & BF_TOP) PatBlt32( hdc, rc->left, rc->top, - rc->right - rc->left - 1, 1, PATCOPY ); - } - if (edge & BDR_RAISEDOUTER) - { - if (flags & BF_RIGHT) PatBlt32( hdc, rc->right - 1, rc->top, - 1, rc->bottom - rc->top, PATCOPY ); - if (flags & BF_BOTTOM) PatBlt32( hdc, rc->left, rc->bottom - 1, - rc->right - rc->left, 1, PATCOPY ); - } - if (edge & BDR_SUNKENINNER) - { - if (flags & BF_LEFT) PatBlt32( hdc, rc->left + 1, rc->top + 1, - 1, rc->bottom - rc->top - 2, PATCOPY ); - if (flags & BF_TOP) PatBlt32( hdc, rc->left + 1, rc->top + 1, - rc->right - rc->left - 2, 1, PATCOPY ); - } - if (edge & BDR_RAISEDINNER) - { - if (flags & BF_RIGHT) PatBlt32( hdc, rc->right - 2, rc->top + 1, - 1, rc->bottom - rc->top - 2, PATCOPY ); - if (flags & BF_BOTTOM) PatBlt32( hdc, rc->left + 1, rc->bottom - 2, - rc->right - rc->left - 2, 1, PATCOPY ); - } - - SelectObject32( hdc, hbrushOld ); - return TRUE; -} - - -/********************************************************************** - * DrawFrameControl16 (USER.656) - */ -BOOL16 WINAPI DrawFrameControl16( HDC16 hdc, LPRECT16 rc, UINT16 uType, - UINT16 uState ) -{ - fprintf( stdnimp,"DrawFrameControl16(%x,%p,%d,%x), empty stub!\n", - hdc,rc,uType,uState ); - return TRUE; -} - - -/********************************************************************** - * DrawFrameControl32 (USER32.157) - */ -BOOL32 WINAPI DrawFrameControl32( HDC32 hdc, LPRECT32 rc, UINT32 uType, - UINT32 uState ) -{ - fprintf( stdnimp,"DrawFrameControl32(%x,%p,%d,%x), empty stub!\n", - hdc,rc,uType,uState ); - return TRUE; -} - /********************************************************************** * DrawFrameControl32 (USER32.152) */ @@ -795,7 +680,7 @@ BOOL32 WINAPI DrawState32A( HDC32 hdc,HBRUSH32 hbrush,DRAWSTATEPROC drawstateproc, LPARAM lparam,WPARAM32 wparam,INT32 x,INT32 y,INT32 z,INT32 a,UINT32 b ) { - fprintf(stderr,"DrawStateA(%x,%x,%p,0x%08lx,0x%08lx,%d,%d,%d,%d,%d),stub\n", + fprintf(stderr,"DrawStateA(%x,%x,%p,0x%08lx,0x%08x,%d,%d,%d,%d,%d),stub\n", hdc,hbrush,drawstateproc,lparam,wparam,x,y,z,a,b ); return TRUE; diff --git a/graphics/win16drv/prtdrv.c b/graphics/win16drv/prtdrv.c index 672dc89e948..086c41bb10f 100644 --- a/graphics/win16drv/prtdrv.c +++ b/graphics/win16drv/prtdrv.c @@ -82,7 +82,7 @@ static LOADED_PRINTER_DRIVER *FindPrinterDriverFromName(const char *pszDriver) pLPD = ptmpLPD; } } - if (pLPD == NULL) printf("Couldn't find driver %s\n", pszDriver); + if (pLPD == NULL) fprintf(stderr,"Couldn't find driver %s\n", pszDriver); return pLPD; } @@ -132,7 +132,7 @@ LOADED_PRINTER_DRIVER *LoadPrinterDriver(const char *pszDriver) } if (!bSlotFound) { - printf("Too many printers drivers loaded\n"); + fprintf(stderr,"Too many printers drivers loaded\n"); return NULL; } @@ -381,7 +381,7 @@ WORD PRTDRV_EnumDFonts(LPPDEVICE lpDestDev, LPSTR lpFaceName, lP1, lP2, lP3, lP4); } else - printf("Failed to find device\n"); + fprintf(stderr,"Failed to find device\n"); dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts: return %x\n", wRet); return wRet; @@ -423,7 +423,7 @@ BOOL16 PRTDRV_EnumObj(LPPDEVICE lpDestDev, WORD iStyle, lP1, wP2, lP3, lP4); } else - printf("Failed to find device\n"); + fprintf(stderr,"Failed to find device\n"); dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts: return %x\n", wRet); return wRet; @@ -465,7 +465,7 @@ DWORD PRTDRV_RealizeObject(LPPDEVICE lpDestDev, WORD wStyle, nSize = sizeof(LOGFONT16); break; default: - printf("PRTDRV_RealizeObject: Object type %d not supported\n", wStyle); + fprintf(stderr,"PRTDRV_RealizeObject: Object type %d not supported\n", wStyle); nSize = 0; } diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c index 4b112e27c24..7118cbe6ed7 100644 --- a/graphics/x11drv/xfont.c +++ b/graphics/x11drv/xfont.c @@ -2033,15 +2033,15 @@ LPIFONTINFO16 XFONT_GetFontInfo( X_PHYSFONT pFont ) HFONT32 X11DRV_FONT_SelectObject( DC* dc, HFONT32 hfont, FONTOBJ* font ) { HFONT32 hPrevFont = 0; - LOGFONT16 lf; + LOGFONT16 lf; if( CHECK_PFONT(dc->u.x.font) ) XFONT_ReleaseCacheEntry( __PFONT(dc->u.x.font) ); /* FIXME: do we need to pass anything back from here? */ memcpy(&lf,&font->logfont,sizeof(lf)); - lf.lfWidth = font->logfont.lfWidth * dc->vportExtX/dc->wndExtX; - lf.lfHeight = font->logfont.lfHeight* dc->vportExtY/dc->wndExtY; + lf.lfWidth = font->logfont.lfWidth * dc->vportExtX/dc->wndExtX; + lf.lfHeight = font->logfont.lfHeight* dc->vportExtY/dc->wndExtY; dc->u.x.font = XFONT_RealizeFont( &lf ); hPrevFont = dc->w.hFont; diff --git a/if1632/advapi32.spec b/if1632/advapi32.spec index 792099541bd..c776a658f60 100644 --- a/if1632/advapi32.spec +++ b/if1632/advapi32.spec @@ -1,6 +1,5 @@ name advapi32 type win32 -base 0 0000 stub AbortSystemShutdownA 0001 stub AbortSystemShutdownW diff --git a/if1632/builtin.c b/if1632/builtin.c index 6cc452718cf..0f2e4b97d69 100644 --- a/if1632/builtin.c +++ b/if1632/builtin.c @@ -33,6 +33,7 @@ typedef struct int size; /* Number of functions */ const void *code_start; /* Start of DLL code */ const void **functions; /* Pointer to functions table */ + const void **nodbg_functions; /* Pointer to funcs without debug */ const char * const *names; /* Pointer to names table */ } WIN32_DESCRIPTOR; @@ -395,8 +396,8 @@ LPCSTR BUILTIN_GetEntryPoint32( void *relay ) relay = (BYTE *)relay - 11; /* The relay entry point is 11 bytes long */ funcs = dll->descr->u.win32.functions; for (i = 0; i < dll->descr->u.win32.size;i++) if (*funcs++ == relay) break; - sprintf( buffer, "%s.%d: %s", - dll->descr->name, i, dll->descr->u.win32.names[i] ); + sprintf( buffer, "%s.%d: %s", dll->descr->name, + dll->descr->u.win32.base + i, dll->descr->u.win32.names[i] ); return buffer; } @@ -411,6 +412,7 @@ FARPROC32 BUILTIN_GetProcAddress32( NE_MODULE *pModule, LPCSTR function ) { BUILTIN_DLL *dll = (BUILTIN_DLL *)pModule->pe_module; const WIN32_DESCRIPTOR *info = &dll->descr->u.win32; + WORD ordinal = 0; if (!dll) return NULL; @@ -422,17 +424,25 @@ FARPROC32 BUILTIN_GetProcAddress32( NE_MODULE *pModule, LPCSTR function ) function, dll->descr->name ); for (i = 0; i < info->size; i++) if (info->names[i] && !strcmp( function, info->names[i] )) - return (FARPROC32)info->functions[i]; + { + ordinal = info->base + i; + break; + } + if (i >= info->size) return NULL; /* not found */ } else /* Find function by ordinal */ { - WORD ordinal = LOWORD(function); + ordinal = LOWORD(function); dprintf_module( stddeb, "Looking for ordinal %d in %s\n", ordinal, dll->descr->name ); - if (ordinal && ordinal < info->size) - return (FARPROC32)info->functions[ordinal - info->base]; + if ((ordinal < info->base) || (ordinal >= info->base + info->size)) + return NULL; /* not found */ } - return NULL; +#if testing + if (!debugging_relay) + return (FARPROC32)info->nodbg_functions[ordinal - info->base]; +#endif + return (FARPROC32)info->functions[ordinal - info->base]; } diff --git a/if1632/comctl32.spec b/if1632/comctl32.spec index d2f1efa1110..197247fa489 100644 --- a/if1632/comctl32.spec +++ b/if1632/comctl32.spec @@ -1,72 +1,71 @@ name comctl32 type win32 -base 2 # Functions exported by the Win95 comctl32.dll # (these need to have these exact ordinals, because some win95 dlls # import comctl32.dll by ordinal) -00 stub MenuHelp -01 stub ShowHideMenuCtl -02 stub GetEffectiveClientRect -03 stdcall DrawStatusTextA(long ptr ptr long) DrawStatusText32A -04 stdcall CreateStatusWindowA(long ptr long long) CreateStatusWindow32A -05 stub CreateToolbar -06 stub CreateMappedBitmap -07 stub Cctl1632_ThunkData32 -08 stub CreatePropertySheetPage -09 stub CreatePropertySheetPageA -10 stub CreatePropertySheetPageW -11 stub MakeDragList -12 stub LBItemFromPt -13 stub DrawInsert -14 stdcall CreateUpDownControl(long long long long long long long long long long long long) CreateUpDownControl -15 stdcall InitCommonControls() InitCommonControls -16 stub CreateStatusWindow -17 stub CreateStatusWindowW -18 stub CreateToolbarEx -19 stub DestroyPropertySheetPage -20 stub DllGetVersion -21 stub DrawStatusText -22 stub DrawStatusTextW -23 stub ImageList_Add -24 stub ImageList_AddIcon -25 stub ImageList_AddMasked -26 stub ImageList_BeginDrag -27 stub ImageList_Copy -28 stub ImageList_Create -29 stub ImageList_Destroy -30 stub ImageList_DragEnter -31 stub ImageList_DragLeave -32 stub ImageList_DragMove -33 stub ImageList_DragShowNolock -34 stub ImageList_Draw -35 stub ImageList_DrawEx -36 stub ImageList_EndDrag -37 stub ImageList_GetBkColor -38 stub ImageList_GetDragImage -39 stub ImageList_GetIcon -40 stub ImageList_GetIconSize -41 stub ImageList_GetImageCount -42 stub ImageList_GetImageInfo -43 stub ImageList_GetImageRect -44 stub ImageList_LoadImage -45 stub ImageList_LoadImageA -46 stub ImageList_LoadImageW -47 stub ImageList_Merge -48 stub ImageList_Read -49 stub ImageList_Remove -50 stub ImageList_Replace -51 stub ImageList_ReplaceIcon -52 stub ImageList_SetBkColor -53 stub ImageList_SetDragCursorImage -54 stub ImageList_SetFilter -55 stub ImageList_SetIconSize -56 stub ImageList_SetImageCount -57 stub ImageList_SetOverlayImage -58 stub ImageList_Write -59 stub InitCommonControlsEx -60 stub PropertySheet -61 stub PropertySheetA -62 stub PropertySheetW -63 stub _TrackMouseEvent + 2 stub MenuHelp + 3 stub ShowHideMenuCtl + 4 stub GetEffectiveClientRect + 5 stdcall DrawStatusTextA(long ptr ptr long) DrawStatusText32A + 6 stdcall CreateStatusWindowA(long ptr long long) CreateStatusWindow32A + 7 stub CreateToolbar + 8 stub CreateMappedBitmap + 9 stub Cctl1632_ThunkData32 + 10 stub CreatePropertySheetPage + 11 stub CreatePropertySheetPageA + 12 stub CreatePropertySheetPageW + 13 stub MakeDragList + 14 stub LBItemFromPt + 15 stub DrawInsert + 16 stdcall CreateUpDownControl(long long long long long long long long long long long long) CreateUpDownControl + 17 stdcall InitCommonControls() InitCommonControls + 18 stub CreateStatusWindow + 19 stub CreateStatusWindowW + 20 stub CreateToolbarEx + 21 stub DestroyPropertySheetPage + 22 stub DllGetVersion + 23 stub DrawStatusText + 24 stub DrawStatusTextW + 25 stub ImageList_Add + 26 stub ImageList_AddIcon + 27 stub ImageList_AddMasked + 28 stub ImageList_BeginDrag + 29 stub ImageList_Copy + 30 stub ImageList_Create + 31 stub ImageList_Destroy + 32 stub ImageList_DragEnter + 33 stub ImageList_DragLeave + 34 stub ImageList_DragMove + 35 stub ImageList_DragShowNolock + 36 stub ImageList_Draw + 37 stub ImageList_DrawEx + 38 stub ImageList_EndDrag + 39 stub ImageList_GetBkColor + 40 stub ImageList_GetDragImage + 41 stub ImageList_GetIcon + 42 stub ImageList_GetIconSize + 43 stub ImageList_GetImageCount + 44 stub ImageList_GetImageInfo + 45 stub ImageList_GetImageRect + 46 stub ImageList_LoadImage + 47 stub ImageList_LoadImageA + 48 stub ImageList_LoadImageW + 49 stub ImageList_Merge + 50 stub ImageList_Read + 51 stub ImageList_Remove + 52 stub ImageList_Replace + 53 stub ImageList_ReplaceIcon + 54 stub ImageList_SetBkColor + 55 stub ImageList_SetDragCursorImage + 56 stub ImageList_SetFilter + 57 stub ImageList_SetIconSize + 58 stub ImageList_SetImageCount + 59 stub ImageList_SetOverlayImage + 60 stub ImageList_Write + 61 stub InitCommonControlsEx + 62 stub PropertySheet + 63 stub PropertySheetA + 64 stub PropertySheetW + 65 stub _TrackMouseEvent diff --git a/if1632/comdlg32.spec b/if1632/comdlg32.spec index a42e1a142d6..e7136ab79ee 100644 --- a/if1632/comdlg32.spec +++ b/if1632/comdlg32.spec @@ -1,29 +1,28 @@ name comdlg32 type win32 -base 1 -0000 stub ArrowBtnWndProc -0001 stub ChooseColorA -0002 stub ChooseColorW -0003 stub ChooseFontA -0004 stub ChooseFontW -0005 stdcall CommDlgExtendedError() CommDlgExtendedError -0006 stub FindTextA -0007 stub FindTextW -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 -0017 return PrintDlgA 4 0 -0018 return PrintDlgW 4 0 -0019 stub ReplaceTextA -0020 stub ReplaceTextW -0021 stub WantArrows -0022 stub dwLBSubclass -0023 stub dwOKSubclass + 0 stub ArrowBtnWndProc + 1 stub ChooseColorA + 2 stub ChooseColorW + 3 stub ChooseFontA + 4 stub ChooseFontW + 5 stdcall CommDlgExtendedError() CommDlgExtendedError + 6 stub FindTextA + 7 stub FindTextW + 8 stdcall GetFileTitleA(ptr ptr long) GetFileTitle32A + 9 stdcall GetFileTitleW(ptr ptr long) GetFileTitle32W +10 stdcall GetOpenFileNameA(ptr) GetOpenFileName32A +11 stdcall GetOpenFileNameW(ptr) GetOpenFileName32W +12 stdcall GetSaveFileNameA(ptr) GetSaveFileName32A +13 stdcall GetSaveFileNameW(ptr) GetSaveFileName32A +14 stub LoadAlterBitmap +15 stub PageSetupDlgA +16 stub PageSetupDlgW +17 return PrintDlgA 4 0 +18 return PrintDlgW 4 0 +19 stub ReplaceTextA +20 stub ReplaceTextW +21 stub WantArrows +22 stub dwLBSubclass +23 stub dwOKSubclass diff --git a/if1632/compobj.spec b/if1632/compobj.spec index 3f81756072c..1969f38f49d 100644 --- a/if1632/compobj.spec +++ b/if1632/compobj.spec @@ -18,9 +18,9 @@ type win16 15 pascal CoDisconnectObject(ptr long) CoDisconnectObject 16 stub CORELEASEMARSHALDATA 17 stub COFREEUNUSEDLIBRARIES -18 stub ISEQUALGUID -19 pascal STRINGFROMCLSID(ptr ptr) StringFromCLSID -20 pascal CLSIDFROMSTRING(str ptr) CLSIDFromString +18 pascal16 IsEqualGUID(ptr ptr) IsEqualGUID +19 pascal StringFromCLSID(ptr ptr) StringFromCLSID +20 pascal CLSIDFromString(str ptr) CLSIDFromString 21 stub ISVALIDPTRIN 22 stub ISVALIDPTROUT 23 stub ISVALIDINTERFACE diff --git a/if1632/crtdll.spec b/if1632/crtdll.spec index 5a61f9765a9..993bb1d99f8 100644 --- a/if1632/crtdll.spec +++ b/if1632/crtdll.spec @@ -1,107 +1,106 @@ # C RunTime DLL. All functions use cdecl! name crtdll type win32 -base 1 -001 cdecl ??2@YAPAXI@Z(long) CRTDLL_new -002 cdecl ??3@YAXPAX@Z(long) CRTDLL_delete -003 cdecl ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z(ptr) CRTDLL_set_new_handler -004 stub _CIacos -005 stub _CIasin -006 stub _CIatan -007 stub _CIatan2 -008 stub _CIcos -009 stub _CIcosh -010 stub _CIexp -011 stub _CIfmod -012 stub _CIlog -013 stub _CIlog10 -014 stub _CIpow -015 stub _CIsin -016 stub _CIsinh -017 stub _CIsqrt -018 stub _CItan -019 stub _CItanh -020 stub _HUGE_dll -021 stub _XcptFilter -022 cdecl __GetMainArgs(ptr ptr ptr long) CRTDLL__GetMainArgs -023 extern __argc_dll CRTDLL_argc_dll -024 extern __argv_dll CRTDLL_argv_dll -025 stub __dllonexit -026 stub __doserrno -027 stub __fpecode -028 stub __isascii -029 stub __iscsym -030 stub __iscsymf -031 stub __mb_cur_max_dll -032 stub __pxcptinfoptrs -033 stub __threadhandle -034 stub __threadid -035 stub __toascii -036 stub _abnormal_termination -037 stub _access -038 extern _acmdln_dll CRTDLL_acmdln_dll -039 stub _aexit_rtn_dll -040 stub _amsg_exit -041 stub _assert -042 extern _basemajor_dll CRTDLL_basemajor_dll -043 extern _baseminor_dll CRTDLL_baseminor_dll -044 extern _baseversion_dll CRTDLL_baseversion_dll -045 stub _beep -046 stub _beginthread -047 stub _c_exit -048 stub _cabs -049 stub _cexit -050 stub _cgets -051 cdecl _chdir(ptr) CRTDLL__chdir -052 cdecl _chdrive(long) CRTDLL__chdrive -053 stub _chgsign -054 stub _chmod -055 stub _chsize -056 stub _clearfp -057 stub _close -058 stub _commit -059 long _commode_dll(0) -060 stub _control87 -061 stub _controlfp -062 stub _copysign -063 stub _cprintf -064 stub _cpumode_dll -065 stub _cputs -066 stub _creat -067 stub _cscanf -068 stub _ctype -069 stub _cwait -070 stub _daylight_dll -071 stub _dup -072 stub _dup2 -073 stub _ecvt -074 stub _endthread -075 extern _environ_dll CRTDLL_environ_dll -076 stub _eof -077 cdecl _errno() CRTDLL__errno -078 stub _except_handler2 -079 stub _execl -080 stub _execle -081 stub _execlp -082 stub _execlpe -083 stub _execv -084 stub _execve -085 stub _execvp -086 stub _execvpe -087 stub _exit -088 stub _expand -089 stub _fcloseall -090 stub _fcvt -091 stub _fdopen -092 stub _fgetchar -093 stub _fgetwchar -094 stub _filbuf -095 stub _fileinfo_dll -096 stub _filelength -097 stub _fileno -098 stub _findclose -099 stub _findfirst + 1 cdecl ??2@YAPAXI@Z(long) CRTDLL_new + 2 cdecl ??3@YAXPAX@Z(long) CRTDLL_delete + 3 cdecl ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z(ptr) CRTDLL_set_new_handler + 4 stub _CIacos + 5 stub _CIasin + 6 stub _CIatan + 7 stub _CIatan2 + 8 stub _CIcos + 9 stub _CIcosh + 10 stub _CIexp + 11 stub _CIfmod + 12 stub _CIlog + 13 stub _CIlog10 + 14 stub _CIpow + 15 stub _CIsin + 16 stub _CIsinh + 17 stub _CIsqrt + 18 stub _CItan + 19 stub _CItanh + 20 stub _HUGE_dll + 21 stub _XcptFilter + 22 cdecl __GetMainArgs(ptr ptr ptr long) CRTDLL__GetMainArgs + 23 extern __argc_dll CRTDLL_argc_dll + 24 extern __argv_dll CRTDLL_argv_dll + 25 stub __dllonexit + 26 stub __doserrno + 27 stub __fpecode + 28 stub __isascii + 29 stub __iscsym + 30 stub __iscsymf + 31 stub __mb_cur_max_dll + 32 stub __pxcptinfoptrs + 33 stub __threadhandle + 34 stub __threadid + 35 stub __toascii + 36 stub _abnormal_termination + 37 stub _access + 38 extern _acmdln_dll CRTDLL_acmdln_dll + 39 stub _aexit_rtn_dll + 40 stub _amsg_exit + 41 stub _assert + 42 extern _basemajor_dll CRTDLL_basemajor_dll + 43 extern _baseminor_dll CRTDLL_baseminor_dll + 44 extern _baseversion_dll CRTDLL_baseversion_dll + 45 stub _beep + 46 stub _beginthread + 47 stub _c_exit + 48 stub _cabs + 49 cdecl _cexit(long) CRTDLL__cexit + 50 stub _cgets + 51 cdecl _chdir(ptr) CRTDLL__chdir + 52 cdecl _chdrive(long) CRTDLL__chdrive + 53 stub _chgsign + 54 stub _chmod + 55 stub _chsize + 56 stub _clearfp + 57 cdecl _close(long) CRTDLL__close + 58 stub _commit + 59 long _commode_dll(0) + 60 stub _control87 + 61 stub _controlfp + 62 stub _copysign + 63 stub _cprintf + 64 stub _cpumode_dll + 65 stub _cputs + 66 stub _creat + 67 stub _cscanf + 68 stub _ctype + 69 stub _cwait + 70 stub _daylight_dll + 71 stub _dup + 72 stub _dup2 + 73 stub _ecvt + 74 stub _endthread + 75 extern _environ_dll CRTDLL_environ_dll + 76 stub _eof + 77 cdecl _errno() CRTDLL__errno + 78 stub _except_handler2 + 79 stub _execl + 80 stub _execle + 81 stub _execlp + 82 stub _execlpe + 83 stub _execv + 84 stub _execve + 85 stub _execvp + 86 stub _execvpe + 87 stub _exit + 88 stub _expand + 89 stub _fcloseall + 90 stub _fcvt + 91 cdecl _fdopen(long ptr) CRTDLL__fdopen + 92 stub _fgetchar + 93 stub _fgetwchar + 94 stub _filbuf + 95 stub _fileinfo_dll + 96 stub _filelength + 97 stub _fileno + 98 stub _findclose + 99 stub _findfirst 100 stub _findnext 101 stub _finite 102 stub _flsbuf @@ -122,7 +121,7 @@ base 1 117 stub _get_osfhandle 118 stub _getch 119 stub _getche -120 stub _getcwd +120 cdecl _getcwd(ptr long) CRTDLL__getcwd 121 stub _getdcwd 122 stub _getdiskfree 123 stub _getdllprocaddr @@ -167,7 +166,7 @@ base 1 162 stub _ismbslead 163 stub _ismbstrail 164 stub _isnan -165 stub _itoa +165 cdecl _itoa(long ptr long) CRTDLL__itoa 166 stub _itow 167 stub _j0 168 stub _j1 @@ -178,7 +177,7 @@ base 1 173 register _local_unwind2(ptr long) CRTDLL__local_unwind2 174 stub _locking 175 stub _logb -176 stub _lrotl +176 cdecl _lrotl (long long) CRTDLL__lrotl 177 stub _lrotr 178 stub _lsearch 179 stub _lseek @@ -241,8 +240,8 @@ base 1 236 stub _msize 237 stub _nextafter 238 stub _onexit -239 stub _open -240 stub _open_osfhandle +239 cdecl _open(ptr long) CRTDLL__open +240 cdecl _open_osfhandle(long long) CRTDLL__open_osfhandle 241 extern _osmajor_dll CRTDLL_osmajor_dll 242 extern _osminor_dll CRTDLL_osminor_dll 243 long _osmode_dll(0) @@ -269,7 +268,7 @@ base 1 264 stub _setjmp 265 cdecl _setmode(long long) CRTDLL__setmode 266 stub _setsystime -267 stub _sleep +267 cdecl _sleep(long) sleep 268 stub _snprintf 269 stub _snwprintf 270 stub _sopen @@ -284,18 +283,18 @@ base 1 279 stub _splitpath 280 stub _stat 281 stub _statusfp -282 cdecl _strcmpi(ptr ptr) lstrcmpi32A +282 cdecl _strcmpi(ptr ptr) CRTDLL__strcmpi 283 stub _strdate 284 stub _strdec 285 cdecl _strdup(ptr) CRTDLL__strdup 286 stub _strerror -287 cdecl _stricmp(ptr ptr) lstrcmpi32A +287 cdecl _stricmp(ptr ptr) CRTDLL__strcmpi 288 stub _stricoll 289 stub _strinc -290 stub _strlwr +290 cdecl _strlwr(ptr) CRTDLL__strlwr 291 stub _strncnt 292 stub _strnextc -293 cdecl _strnicmp(ptr ptr long) lstrncmpi32A +293 cdecl _strnicmp(ptr ptr long) CRTDLL__strnicmp 294 stub _strninc 295 stub _strnset 296 stub _strrev @@ -307,7 +306,7 @@ base 1 302 stub _sys_errlist 303 stub _sys_nerr_dll 304 stub _tell -305 stub _tempnam +305 cdecl _tempnam(ptr ptr) CRTDLL__tempnam 306 stub _timezone_dll 307 stub _tolower 308 stub _toupper @@ -317,16 +316,16 @@ base 1 312 stub _ultow 313 stub _umask 314 stub _ungetch -315 stub _unlink +315 cdecl _unlink(ptr) CRTDLL__unlink 316 stub _unloaddll 317 stub _utime 318 stub _vsnprintf 319 stub _vsnwprintf 320 stub _wcsdup -321 cdecl _wcsicmp(ptr ptr) lstrcmpi32W +321 cdecl _wcsicmp(ptr ptr) CRTDLL__wcsicmp 322 cdecl _wcsicoll(ptr ptr) CRTDLL__wcsicoll 323 cdecl _wcslwr(ptr) CRTDLL__wcslwr -324 stub _wcsnicmp +324 cdecl _wcsnicmp(ptr ptr long) CRTDLL__wcsnicmp 325 stub _wcsnset 326 cdecl _wcsrev(ptr) CRTDLL__wcsrev 327 stub _wcsset @@ -341,72 +340,72 @@ base 1 336 stub _y1 337 stub _yn 338 stub abort -339 cdecl abs(long) CRTDLL_abs -340 cdecl acos(long) CRTDLL_acos +339 cdecl abs(long) abs +340 cdecl acos(double) acos 341 cdecl asctime(ptr) asctime -342 cdecl asin(long) CRTDLL_asin -343 cdecl atan(long) CRTDLL_atan -344 cdecl atan2(long long) CRTDLL_atan2 +342 cdecl asin(double) asin +343 cdecl atan(double) atan +344 cdecl atan2(double double) atan2 345 cdecl atexit(ptr) CRTDLL_atexit -346 cdecl atof(ptr) CRTDLL_atof -347 cdecl atoi(ptr) CRTDLL_atoi -348 cdecl atol(ptr) CRTDLL_atol +346 cdecl atof(ptr) atof +347 cdecl atoi(ptr) atoi +348 cdecl atol(ptr) atol 349 stub bsearch 350 cdecl calloc(long long) CRTDLL_calloc 351 stub ceil 352 stub clearerr 353 cdecl clock() clock -354 cdecl cos(long) CRTDLL_cos -355 cdecl cosh(long) CRTDLL_cosh +354 cdecl cos(double) cos +355 cdecl cosh(double) cosh 356 cdecl ctime(ptr) ctime 357 stub difftime 358 cdecl div(long long) div 359 cdecl exit(long) CRTDLL_exit -360 cdecl exp(long) CRTDLL_exp -361 cdecl fabs(long) CRTDLL_fabs +360 cdecl exp(double) exp +361 cdecl fabs(double) fabs 362 cdecl fclose(ptr) CRTDLL_fclose -363 stub feof +363 cdecl feof(ptr) CRTDLL_feof 364 stub ferror 365 cdecl fflush(ptr) CRTDLL_fflush -366 stub fgetc +366 cdecl fgetc(ptr) CRTDLL_fgetc 367 stub fgetpos -368 stub fgets +368 cdecl fgets(ptr long ptr) CRTDLL_fgets 369 stub fgetwc 370 stub floor -371 stub fmod -372 stub fopen -373 cdecl fprintf() CRTDLL_fprintf -374 stub fputc -375 stub fputs +371 cdecl fmod(double double) fmod +372 cdecl fopen(ptr ptr) CRTDLL_fopen +373 varargs fprintf() CRTDLL_fprintf +374 cdecl fputc(long ptr) CRTDLL_fputc +375 cdecl fputs(ptr ptr) CRTDLL_fputs 376 stub fputwc -377 stub fread +377 cdecl fread(ptr long long ptr) CRTDLL_fread 378 cdecl free(ptr) CRTDLL_free 379 stub freopen 380 stub frexp 381 stub fscanf -382 stub fseek +382 cdecl fseek(ptr long long) CRTDLL_fseek 383 stub fsetpos -384 stub ftell +384 cdecl ftell(ptr) CRTDLL_ftell 385 stub fwprintf -386 stub fwrite +386 cdecl fwrite(ptr long long ptr) CRTDLL_fwrite 387 stub fwscanf -388 stub getc +388 cdecl getc(ptr) CRTDLL_getc 389 stub getchar 390 stub getenv 391 cdecl gets(ptr) CRTDLL_gets 392 cdecl gmtime(ptr) gmtime 393 stub is_wctype -394 cdecl isalnum(long) CRTDLL_isalnum -395 cdecl isalpha(long) CRTDLL_isalpha -396 cdecl iscntrl(long) CRTDLL_iscntrl -397 cdecl isdigit(long) CRTDLL_isdigit -398 cdecl isgraph(long) CRTDLL_isgraph +394 cdecl isalnum(long) isalnum +395 cdecl isalpha(long) isalpha +396 cdecl iscntrl(long) iscntrl +397 cdecl isdigit(long) isdigit +398 cdecl isgraph(long) isgraph 399 stub isleadbyte -400 cdecl islower(long) CRTDLL_islower -401 cdecl isprint(long) CRTDLL_isprint -402 cdecl ispunct(long) CRTDLL_ispunct -403 cdecl isspace(long) CRTDLL_isspace -404 cdecl isupper(long) CRTDLL_isupper +400 cdecl islower(long) islower +401 cdecl isprint(long) isprint +402 cdecl ispunct(long) ispunct +403 cdecl isspace(long) isspace +404 cdecl isupper(long) isupper 405 stub iswalnum 406 stub iswalpha 407 stub iswascii @@ -420,19 +419,19 @@ base 1 415 stub iswspace 416 stub iswupper 417 stub iswxdigit -418 cdecl isxdigit(long) CRTDLL_isxdigit -419 cdecl labs(long) CRTDLL_labs +418 cdecl isxdigit(long) isxdigit +419 cdecl labs(long) labs 420 stub ldexp 421 cdecl ldiv(long long) ldiv 422 stub localeconv 423 cdecl localtime(ptr) localtime -424 cdecl log(long) CRTDLL_log -425 cdecl log10(long) CRTDLL_log10 +424 cdecl log(double) log +425 cdecl log10(double) log10 426 stub longjmp 427 cdecl malloc(ptr) CRTDLL_malloc -428 stub mblen +428 cdecl mblen(ptr long) CRTDLL_mblen 429 cdecl mbstowcs(ptr ptr long) CRTDLL_mbstowcs -430 cdecl mbtowc(long) CRTDLL_mbtowc +430 cdecl mbtowc(ptr ptr long) CRTDLL_mbtowc 431 cdecl memchr(ptr long long) memchr 432 cdecl memcmp(ptr ptr long) memcmp 433 cdecl memcpy(ptr ptr long) memcpy @@ -441,11 +440,11 @@ base 1 436 cdecl mktime(ptr) mktime 437 stub modf 438 stub perror -439 cdecl pow(long long) CRTDLL_pow -440 cdecl printf() CRTDLL_printf -441 stub putc +439 cdecl pow(double double) pow +440 varargs printf() printf +441 cdecl putc(long ptr) CRTDLL_putc 442 cdecl putchar(long) CRTDLL_putchar -443 stub puts +443 cdecl puts(ptr) CRTDLL_puts 444 cdecl qsort(ptr long long ptr) qsort 445 stub raise 446 cdecl rand() CRTDLL_rand @@ -454,16 +453,16 @@ base 1 449 stub rename 450 stub rewind 451 stub scanf -452 stub setbuf +452 cdecl setbuf(ptr ptr) CRTDLL_setbuf 453 cdecl setlocale(long ptr) CRTDLL_setlocale 454 stub setvbuf 455 stub signal -456 cdecl sin(long) CRTDLL_sin -457 cdecl sinh(long) CRTDLL_sinh -458 cdecl sprintf() CRTDLL_sprintf -459 cdecl sqrt(long long) CRTDLL_sqrt +456 cdecl sin(double) sin +457 cdecl sinh(double) sinh +458 varargs sprintf() wsprintf32A +459 cdecl sqrt(double) sqrt 460 cdecl srand(long) CRTDLL_srand -461 cdecl sscanf() CRTDLL_sscanf +461 varargs sscanf() sscanf 462 cdecl strcat(ptr ptr) strcat 463 cdecl strchr(ptr long) strchr 464 cdecl strcmp(ptr ptr) strcmp @@ -480,42 +479,42 @@ base 1 475 cdecl strrchr(ptr long) strrchr 476 cdecl strspn(ptr ptr) strspn 477 cdecl strstr(ptr ptr) strstr -478 stub strtod +478 cdecl strtod(ptr ptr) strtod 479 cdecl strtok(ptr ptr) strtok 480 cdecl strtol(ptr ptr long) strtol 481 cdecl strtoul(ptr ptr long) strtoul 482 cdecl strxfrm(ptr ptr long) strxfrm -483 cdecl swprintf() CRTDLL_swprintf +483 varargs swprintf() wsprintf32W 484 stub swscanf -485 stub system -486 cdecl tan(long) CRTDLL_tan -487 cdecl tanh(long) CRTDLL_tanh +485 cdecl system(ptr) CRTDLL_system +486 cdecl tan(double) tan +487 cdecl tanh(double) tanh 488 cdecl time(ptr) CRTDLL_time 489 stub tmpfile -490 stub tmpnam -491 cdecl tolower(long) CRTDLL_tolower -492 cdecl toupper(long) CRTDLL_toupper +490 cdecl tmpnam(ptr) CRTDLL_tmpnam +491 cdecl tolower(long) tolower +492 cdecl toupper(long) toupper 493 stub towlower 494 cdecl towupper(long) CRTDLL_towupper 495 stub ungetc 496 stub ungetwc -497 stub vfprintf +497 cdecl vfprintf(ptr ptr ptr) CRTDLL_vfprintf 498 stub vfwprintf 499 stub vprintf -500 cdecl vsprintf() CRTDLL_vsprintf -501 stub vswprintf +500 cdecl vsprintf(ptr ptr ptr) CRTDLL_vsprintf +501 cdecl vswprintf(ptr ptr ptr) CRTDLL_vswprintf 502 stub vwprintf -503 cdecl wcscat(ptr ptr) lstrcat32W +503 cdecl wcscat(ptr ptr) CRTDLL_wcscat 504 cdecl wcschr(ptr long) CRTDLL_wcschr -505 stub wcscmp +505 cdecl wcscmp(ptr ptr) CRTDLL_wcscmp 506 cdecl wcscoll(ptr ptr) CRTDLL_wcscoll -507 cdecl wcscpy(ptr ptr) lstrcpy32W +507 cdecl wcscpy(ptr ptr) CRTDLL_wcscpy 508 cdecl wcscspn(ptr ptr) CRTDLL_wcscspn 509 stub wcsftime -510 cdecl wcslen(ptr) lstrlen32W -511 cdecl wcsncat(ptr ptr long) lstrcatn32W -512 cdecl wcsncmp(ptr ptr long) lstrncmp32W -513 cdecl wcsncpy(ptr ptr long) lstrcpyn32W +510 cdecl wcslen(ptr) CRTDLL_wcslen +511 cdecl wcsncat(ptr ptr long) CRTDLL_wcsncat +512 cdecl wcsncmp(ptr ptr long) CRTDLL_wcsncmp +513 cdecl wcsncpy(ptr ptr long) CRTDLL_wcsncpy 514 stub wcspbrk 515 cdecl wcsrchr(ptr long) CRTDLL_wcsrchr 516 cdecl wcsspn(ptr ptr) CRTDLL_wcsspn @@ -523,7 +522,7 @@ base 1 518 stub wcstod 519 stub wcstok 520 stub wcstol -521 stub wcstombs +521 cdecl wcstombs(ptr ptr long) CRTDLL_wcstombs 522 stub wcstoul 523 stub wcsxfrm 524 stub wctomb diff --git a/if1632/gdi.spec b/if1632/gdi.spec index 1b0f157d7f7..eedf981e4cc 100644 --- a/if1632/gdi.spec +++ b/if1632/gdi.spec @@ -38,7 +38,7 @@ file gdi.exe 30 pascal16 SaveDC(word) SaveDC16 31 pascal SetPixel(word s_word s_word long) SetPixel16 32 pascal16 OffsetClipRgn(word s_word s_word) OffsetClipRgn16 -33 pascal16 TextOut(word s_word s_word ptr word) TextOut16 +33 pascal16 TextOut(word s_word s_word str word) TextOut16 34 pascal16 BitBlt( word s_word s_word s_word s_word word s_word s_word long) BitBlt16 35 pascal16 StretchBlt(word s_word s_word s_word s_word word s_word s_word @@ -236,7 +236,7 @@ file gdi.exe s_word s_word) Chord16 349 pascal SetMapperFlags(word long) SetMapperFlags16 350 pascal16 GetCharWidth(word word word ptr) GetCharWidth16 -351 pascal16 ExtTextOut(word s_word s_word word ptr ptr word ptr) ExtTextOut16 +351 pascal16 ExtTextOut(word s_word s_word word ptr str word ptr) ExtTextOut16 352 stub GetPhysicalFontHandle 353 stub GetAspectRatioFilter 354 stub ShrinkGDIHeap diff --git a/if1632/gdi32.spec b/if1632/gdi32.spec index fd5c5432f13..2baeae2878e 100644 --- a/if1632/gdi32.spec +++ b/if1632/gdi32.spec @@ -1,398 +1,397 @@ name gdi32 type win32 -base 1 -0000 stub AbortDoc -0001 stub AbortPath -0002 stdcall AddFontResourceA(ptr) AddFontResource32A -0003 stub AddFontResourceTracking -0004 stdcall AddFontResourceW(ptr) AddFontResource32W -0005 stub AngleArc -0006 stdcall AnimatePalette(long long long ptr) AnimatePalette32 -0007 stdcall Arc(long long long long long long long long long) Arc32 -0008 stub ArcTo -0009 stub BeginPath -0010 stdcall BitBlt(long long long long long long long long long) BitBlt32 -0011 stub CancelDC -0012 stub CheckColorsInGamut -0013 stub ChoosePixelFormat -0014 stdcall Chord(long long long long long long long long long) Chord32 -0015 stub CloseEnhMetaFile -0016 stub CloseFigure -0017 stub CloseMetaFile -0018 stub ColorMatchToTarget -0019 stdcall CombineRgn(long long long long) CombineRgn32 -0020 stub CombineTransform -0021 stub CopyEnhMetaFileA -0022 stub CopyEnhMetaFileW -0023 stdcall CopyMetaFileA(long ptr) CopyMetaFile32A -0024 stdcall CopyMetaFileW(long ptr) CopyMetaFile32W -0025 stdcall CreateBitmap(long long long long ptr) CreateBitmap32 -0026 stdcall CreateBitmapIndirect(ptr) CreateBitmapIndirect32 -0027 stdcall CreateBrushIndirect(ptr) CreateBrushIndirect32 -0028 stub CreateColorSpaceA -0029 stub CreateColorSpaceW -0030 stdcall CreateCompatibleBitmap(long long long) CreateCompatibleBitmap32 -0031 stdcall CreateCompatibleDC(long) CreateCompatibleDC32 -0032 stdcall CreateDCA(ptr ptr ptr ptr) CreateDC32A -0033 stdcall CreateDCW(ptr ptr ptr ptr) CreateDC32W -0034 stdcall CreateDIBPatternBrush(long long) CreateDIBPatternBrush32 -0035 stub CreateDIBPatternBrushPt -0036 stub CreateDIBSection -0037 stdcall CreateDIBitmap(long ptr long ptr ptr long) CreateDIBitmap32 -0038 stdcall CreateDiscardableBitmap(long long long) CreateDiscardableBitmap32 -0039 stdcall CreateEllipticRgn(long long long long) CreateEllipticRgn32 -0040 stdcall CreateEllipticRgnIndirect(ptr) CreateEllipticRgnIndirect32 -0041 stub CreateEnhMetaFileA -0042 stub CreateEnhMetaFileW -0043 stdcall CreateFontA(long long long long long long long long + 0 stub AbortDoc + 1 stub AbortPath + 2 stdcall AddFontResourceA(ptr) AddFontResource32A + 3 stub AddFontResourceTracking + 4 stdcall AddFontResourceW(ptr) AddFontResource32W + 5 stub AngleArc + 6 stdcall AnimatePalette(long long long ptr) AnimatePalette32 + 7 stdcall Arc(long long long long long long long long long) Arc32 + 8 stub ArcTo + 9 stub BeginPath + 10 stdcall BitBlt(long long long long long long long long long) BitBlt32 + 11 stub CancelDC + 12 stub CheckColorsInGamut + 13 stub ChoosePixelFormat + 14 stdcall Chord(long long long long long long long long long) Chord32 + 15 stub CloseEnhMetaFile + 16 stub CloseFigure + 17 stub CloseMetaFile + 18 stub ColorMatchToTarget + 19 stdcall CombineRgn(long long long long) CombineRgn32 + 20 stub CombineTransform + 21 stub CopyEnhMetaFileA + 22 stub CopyEnhMetaFileW + 23 stdcall CopyMetaFileA(long ptr) CopyMetaFile32A + 24 stdcall CopyMetaFileW(long ptr) CopyMetaFile32W + 25 stdcall CreateBitmap(long long long long ptr) CreateBitmap32 + 26 stdcall CreateBitmapIndirect(ptr) CreateBitmapIndirect32 + 27 stdcall CreateBrushIndirect(ptr) CreateBrushIndirect32 + 28 stub CreateColorSpaceA + 29 stub CreateColorSpaceW + 30 stdcall CreateCompatibleBitmap(long long long) CreateCompatibleBitmap32 + 31 stdcall CreateCompatibleDC(long) CreateCompatibleDC32 + 32 stdcall CreateDCA(ptr ptr ptr ptr) CreateDC32A + 33 stdcall CreateDCW(ptr ptr ptr ptr) CreateDC32W + 34 stdcall CreateDIBPatternBrush(long long) CreateDIBPatternBrush32 + 35 stub CreateDIBPatternBrushPt + 36 stdcall CreateDIBSection(long ptr long ptr long long) CreateDIBSection + 37 stdcall CreateDIBitmap(long ptr long ptr ptr long) CreateDIBitmap32 + 38 stdcall CreateDiscardableBitmap(long long long) CreateDiscardableBitmap32 + 39 stdcall CreateEllipticRgn(long long long long) CreateEllipticRgn32 + 40 stdcall CreateEllipticRgnIndirect(ptr) CreateEllipticRgnIndirect32 + 41 stub CreateEnhMetaFileA + 42 stub CreateEnhMetaFileW + 43 stdcall CreateFontA(long long long long long long long long long long long long long ptr) CreateFont32A -0044 stdcall CreateFontIndirectA(ptr) CreateFontIndirect32A -0045 stdcall CreateFontIndirectW(ptr) CreateFontIndirect32W -0046 stdcall CreateFontW(long long long long long long long long + 44 stdcall CreateFontIndirectA(ptr) CreateFontIndirect32A + 45 stdcall CreateFontIndirectW(ptr) CreateFontIndirect32W + 46 stdcall CreateFontW(long long long long long long long long long long long long long ptr) CreateFont32W -0047 stub CreateHalftonePalette -0048 stdcall CreateHatchBrush(long long) CreateHatchBrush32 -0049 stdcall CreateICA(ptr ptr ptr ptr) CreateIC32A -0050 stdcall CreateICW(ptr ptr ptr ptr) CreateIC32W -0051 stub CreateMetaFileA -0052 stub CreateMetaFileW -0053 stdcall CreatePalette(ptr) CreatePalette32 -0054 stdcall CreatePatternBrush(long) CreatePatternBrush32 -0055 stdcall CreatePen(long long long) CreatePen32 -0056 stdcall CreatePenIndirect(ptr) CreatePenIndirect32 -0057 stdcall CreatePolyPolygonRgn(ptr ptr long long) CreatePolyPolygonRgn32 -0058 stdcall CreatePolygonRgn(ptr long long) CreatePolygonRgn32 -0059 stdcall CreateRectRgn(long long long long) CreateRectRgn32 -0060 stdcall CreateRectRgnIndirect(ptr) CreateRectRgnIndirect32 -0061 stdcall CreateRoundRectRgn(long long long long long long) + 47 stub CreateHalftonePalette + 48 stdcall CreateHatchBrush(long long) CreateHatchBrush32 + 49 stdcall CreateICA(ptr ptr ptr ptr) CreateIC32A + 50 stdcall CreateICW(ptr ptr ptr ptr) CreateIC32W + 51 stub CreateMetaFileA + 52 stub CreateMetaFileW + 53 stdcall CreatePalette(ptr) CreatePalette32 + 54 stdcall CreatePatternBrush(long) CreatePatternBrush32 + 55 stdcall CreatePen(long long long) CreatePen32 + 56 stdcall CreatePenIndirect(ptr) CreatePenIndirect32 + 57 stdcall CreatePolyPolygonRgn(ptr ptr long long) CreatePolyPolygonRgn32 + 58 stdcall CreatePolygonRgn(ptr long long) CreatePolygonRgn32 + 59 stdcall CreateRectRgn(long long long long) CreateRectRgn32 + 60 stdcall CreateRectRgnIndirect(ptr) CreateRectRgnIndirect32 + 61 stdcall CreateRoundRectRgn(long long long long long long) CreateRoundRectRgn32 -0062 stdcall CreateScalableFontResourceA(long ptr ptr ptr) CreateScalableFontResource32A -0063 stdcall CreateScalableFontResourceW(long ptr ptr ptr) CreateScalableFontResource32W -0064 stdcall CreateSolidBrush(long) CreateSolidBrush32 -0065 stdcall DPtoLP(long ptr long) DPtoLP32 -0066 stub DeleteColorSpace -0067 stdcall DeleteDC(long) DeleteDC32 -0068 stub DeleteEnhMetaFile -0069 stub DeleteMetaFile -0070 stdcall DeleteObject(long) DeleteObject32 -0071 stub DescribePixelFormat -0072 stub DeviceCapabilitiesExA -0073 stub DeviceCapabilitiesExW -0074 stub DrawEscape -0075 stdcall Ellipse(long long long long long) Ellipse32 -0076 stub EndDoc -0077 stub EndPage -0078 stub EndPath -0079 stub EnumEnhMetaFile -0080 stdcall EnumFontFamiliesA(long ptr ptr long) THUNK_EnumFontFamilies32A -0081 stdcall EnumFontFamiliesExA(long ptr ptr long long) THUNK_EnumFontFamiliesEx32A -0082 stdcall EnumFontFamiliesExW(long ptr ptr long long) THUNK_EnumFontFamiliesEx32W -0083 stdcall EnumFontFamiliesW(long ptr ptr long) THUNK_EnumFontFamilies32W -0084 stdcall EnumFontsA(long ptr ptr long) THUNK_EnumFonts32A -0085 stdcall EnumFontsW(long ptr ptr long) THUNK_EnumFonts32W -0086 stub EnumICMProfilesA -0087 stub EnumICMProfilesW -0088 stub EnumMetaFile -0089 stdcall EnumObjects(long long ptr long) THUNK_EnumObjects32 -0090 stdcall EqualRgn(long long) EqualRgn32 -0091 stdcall Escape(long long long ptr ptr) Escape32 -0092 stdcall ExcludeClipRect(long long long long long) ExcludeClipRect32 -0093 stub ExtCreatePen -0094 stub ExtCreateRegion -0095 stub ExtEscape -0096 stdcall ExtFloodFill(long long long long long) ExtFloodFill32 -0097 stub ExtSelectClipRgn -0098 stdcall ExtTextOutA(long long long long ptr ptr long ptr) ExtTextOut32A -0099 stdcall ExtTextOutW(long long long long ptr ptr long ptr) ExtTextOut32W -0100 stub FillPath -0101 stdcall FillRgn(long long long) FillRgn32 -0102 stub FixBrushOrgEx -0103 stub FlattenPath -0104 stdcall FloodFill(long long long long) FloodFill32 -0105 stdcall FrameRgn(long long long long long) FrameRgn32 -0106 stub FreeImageColorMatcher -0107 stub GdiAssociateObject -0108 stub GdiCleanCacheDC -0109 stub GdiComment -0110 stub GdiConvertAndCheckDC -0111 stub GdiConvertBitmap -0112 stub GdiConvertBrush -0113 stub GdiConvertDC -0114 stub GdiConvertEnhMetaFile -0115 stub GdiConvertFont -0116 stub GdiConvertMetaFilePict -0117 stub GdiConvertPalette -0118 stub GdiConvertRegion -0119 stub GdiCreateLocalBitmap -0120 stub GdiCreateLocalBrush -0121 stub GdiCreateLocalEnhMetaFile -0122 stub GdiCreateLocalFont -0123 stub GdiCreateLocalMetaFilePict -0124 stub GdiCreateLocalPalette -0125 stub GdiCreateLocalRegion -0126 stub GdiDeleteLocalDC -0127 stub GdiDeleteLocalObject -0128 stub GdiFlush -0129 return GdiGetBatchLimit 0 1 -0130 stub GdiGetLocalBrush -0131 stub GdiGetLocalDC -0132 stub GdiGetLocalFont -0133 stub GdiIsMetaFileDC -0134 stub GdiPlayDCScript -0135 stub GdiPlayJournal -0136 stub GdiPlayScript -0137 stub GdiReleaseLocalDC -0138 stub GdiSetAttrs -0139 return GdiSetBatchLimit 4 1 -0140 stub GdiSetServerAttr -0141 stub GetArcDirection -0142 stub GetAspectRatioFilterEx -0143 stdcall GetBitmapBits(long long ptr) GetBitmapBits32 -0144 stdcall GetBitmapDimensionEx(long ptr) GetBitmapDimensionEx32 -0145 stdcall GetBkColor(long) GetBkColor32 -0146 stdcall GetBkMode(long) GetBkMode32 -0147 stub GetBoundsRect -0148 stdcall GetBrushOrgEx(long ptr) GetBrushOrgEx32 -0149 stdcall GetCharABCWidthsA(long long long ptr) GetCharABCWidths32A -0150 stub GetCharABCWidthsFloatA -0151 stub GetCharABCWidthsFloatW -0152 stdcall GetCharABCWidthsW(long long long ptr) GetCharABCWidths32W -0153 stdcall GetCharWidth32A(long long long long) GetCharWidth32A -0154 stdcall GetCharWidth32W(long long long long) GetCharWidth32W -0155 stdcall GetCharWidthA(long long long long) GetCharWidth32A -0156 stub GetCharWidthFloatA -0157 stub GetCharWidthFloatW -0158 stdcall GetCharWidthW(long long long long) GetCharWidth32W -0159 stub GetCharWidthWOW -0160 stub GetCharacterPlacementA -0161 stub GetCharacterPlacementW -0162 stdcall GetClipBox(long ptr) GetClipBox32 -0163 stdcall GetClipRgn(long long) GetClipRgn32 -0164 stub GetColorAdjustment -0165 stub GetColorSpace -0166 stub GetCurrentObject -0167 stdcall GetCurrentPositionEx(long ptr) GetCurrentPositionEx32 -0168 stdcall GetDCOrgEx(long ptr) GetDCOrgEx -0169 stub GetDIBColorTable -0170 stdcall GetDIBits(long long long long ptr ptr long) GetDIBits32 -0171 stdcall GetDeviceCaps(long long) GetDeviceCaps32 -0172 stub GetDeviceGammaRamp -0173 stub GetETM -0174 stub GetEnhMetaFileA -0175 stub GetEnhMetaFileBits -0176 stub GetEnhMetaFileDescriptionA -0177 stub GetEnhMetaFileDescriptionW -0178 stub GetEnhMetaFileHeader -0179 stub GetEnhMetaFilePaletteEntries -0180 stub GetEnhMetaFileW -0181 stub GetFontData -0182 stub GetFontLanguageInfo -0183 stub GetFontResourceInfo -0184 stub GetFontResourceInfoW -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 return GetGraphicsMode 4 1 # just return 1 -0189 stub GetICMProfileA -0190 stub GetICMProfileW -0191 stub GetKerningPairs -0192 stdcall GetKerningPairsA(long long ptr) GetKerningPairs32A -0193 stdcall GetKerningPairsW(long long ptr) GetKerningPairs32W -0194 stub GetLogColorSpaceA -0195 stub GetLogColorSpaceW -0196 stdcall GetMapMode(long) GetMapMode32 -0197 stdcall GetMetaFileA(ptr) GetMetaFile32A -0198 stub GetMetaFileBitsEx -0199 stdcall GetMetaFileW(ptr) GetMetaFile32W -0200 stub GetMetaRgn -0201 stub GetMiterLimit -0202 stdcall GetNearestColor(long long) GetNearestColor32 -0203 stdcall GetNearestPaletteIndex(long long) GetNearestPaletteIndex32 -0204 stdcall GetObjectA(long long ptr) GetObject32A -0205 stub GetObjectType -0206 stdcall GetObjectW(long long ptr) GetObject32W -0207 stub GetOutlineTextMetricsA -0208 stub GetOutlineTextMetricsW -0209 stdcall GetPaletteEntries(long long long ptr) GetPaletteEntries32 -0210 stub GetPath -0211 stdcall GetPixel(long long long) GetPixel32 -0212 stub GetPixelFormat -0213 stdcall GetPolyFillMode(long) GetPolyFillMode32 -0214 stdcall GetROP2(long) GetROP232 -0215 stub GetRandomRgn -0216 stdcall GetRasterizerCaps(ptr long) GetRasterizerCaps32 -0217 stub GetRegionData -0218 stdcall GetRelAbs(long) GetRelAbs32 -0219 stdcall GetRgnBox(long ptr) GetRgnBox32 -0220 stdcall GetStockObject(long) GetStockObject32 -0221 stdcall GetStretchBltMode(long) GetStretchBltMode32 -0222 stdcall GetSystemPaletteEntries(long long long ptr) GetSystemPaletteEntries32 -0223 stdcall GetSystemPaletteUse() GetSystemPaletteUse32 -0224 stdcall GetTextAlign(long) GetTextAlign32 -0225 stdcall GetTextCharacterExtra(long) GetTextCharacterExtra32 -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 -0230 stdcall GetTextExtentPoint32A(long ptr long ptr) GetTextExtentPoint32A -0231 stdcall GetTextExtentPoint32W(long ptr long ptr) GetTextExtentPoint32W -0232 stdcall GetTextExtentPointA(long ptr long ptr) GetTextExtentPoint32ABuggy -0233 stdcall GetTextExtentPointW(long ptr long ptr) GetTextExtentPoint32WBuggy -0234 stdcall GetTextFaceA(long long ptr) GetTextFace32A -0235 stdcall GetTextFaceW(long long ptr) GetTextFace32W -0236 stdcall GetTextMetricsA(long ptr) GetTextMetrics32A -0237 stdcall GetTextMetricsW(long ptr) GetTextMetrics32W -0238 stub GetTransform -0239 stdcall GetViewportExtEx(long ptr) GetViewportExtEx32 -0240 stdcall GetViewportOrgEx(long ptr) GetViewportOrgEx32 -0241 stub GetWinMetaFileBits -0242 stdcall GetWindowExtEx(long ptr) GetWindowExtEx32 -0243 stdcall GetWindowOrgEx(long ptr) GetWindowOrgEx32 -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 -0248 stdcall LineDDA(long long long long ptr long) THUNK_LineDDA32 -0249 stdcall LineTo(long long long) LineTo32 -0250 stub LoadImageColorMatcherA -0251 stub LoadImageColorMatcherW -0252 stub MaskBlt -0253 stub ModifyWorldTransform -0254 stdcall MoveToEx(long long long ptr) MoveToEx32 -0255 stdcall OffsetClipRgn(long long long) OffsetClipRgn32 -0256 stdcall OffsetRgn(long long long) OffsetRgn32 -0257 stdcall OffsetViewportOrgEx(long long long ptr) OffsetViewportOrgEx32 -0258 stdcall OffsetWindowOrgEx(long long long ptr) OffsetWindowOrgEx32 -0259 stdcall PaintRgn(long long) PaintRgn32 -0260 stdcall PatBlt(long long long long long long) PatBlt32 -0261 stub PathToRegion -0262 stdcall Pie(long long long long long long long long long) Pie32 -0263 stub PlayEnhMetaFile -0264 stub PlayEnhMetaFileRecord -0265 stdcall PlayMetaFile(long long) PlayMetaFile32 -0266 stub PlayMetaFileRecord -0267 stub PlgBlt -0268 stub PolyBezier -0269 stub PolyBezierTo -0270 stub PolyDraw -0271 stdcall PolyPolygon(long ptr ptr long) PolyPolygon32 -0272 stub PolyPolyline -0273 stub PolyTextOutA -0274 stub PolyTextOutW -0275 stdcall Polygon(long ptr long) Polygon32 -0276 stdcall Polyline(long ptr long) Polyline32 -0277 stub PolylineTo -0278 stdcall PtInRegion(long long long) PtInRegion32 -0279 stdcall PtVisible(long long long) PtVisible32 -0280 stdcall RealizePalette(long) RealizePalette32 -0281 stdcall RectInRegion(long ptr) RectInRegion32 -0282 stdcall RectVisible(long ptr) RectVisible32 -0283 stdcall Rectangle(long long long long long) Rectangle32 -0284 stdcall RemoveFontResourceA(ptr) RemoveFontResource32A -0285 stub RemoveFontResourceTracking -0286 stdcall RemoveFontResourceW(ptr) RemoveFontResource32W -0287 stdcall ResetDCA(long ptr) ResetDC32A -0288 stdcall ResetDCW(long ptr) ResetDC32W -0289 stdcall ResizePalette(long long) ResizePalette32 -0290 stdcall RestoreDC(long long) RestoreDC32 -0291 stdcall RoundRect(long long long long long long long) RoundRect32 -0292 stdcall SaveDC(long) SaveDC32 -0293 stdcall ScaleViewportExtEx(long long long long long ptr) ScaleViewportExtEx32 -0294 stdcall ScaleWindowExtEx(long long long long long ptr) ScaleWindowExtEx32 -0295 stub SelectBrushLocal -0296 stub SelectClipPath -0297 stdcall SelectClipRgn(long long) SelectClipRgn32 -0298 stub SelectFontLocal -0299 stdcall SelectObject(long long) SelectObject32 -0300 stdcall SelectPalette(long long long) SelectPalette32 -0301 stub SetAbortProc -0302 stub SetArcDirection -0303 stdcall SetBitmapBits(long long ptr) SetBitmapBits32 -0304 stdcall SetBitmapDimensionEx(long long long ptr) SetBitmapDimensionEx32 -0305 stdcall SetBkColor(long long) SetBkColor32 -0306 stdcall SetBkMode(long long) SetBkMode32 -0307 stub SetBoundsRect -0308 stdcall SetBrushOrgEx(long long long ptr) SetBrushOrgEx -0309 stub SetColorAdjustment -0310 stub SetColorSpace -0311 stub SetDIBColorTable -0312 stdcall SetDIBits(long long long long ptr ptr long) SetDIBits32 -0313 stdcall SetDIBitsToDevice(long long long long long long long long long + 62 stdcall CreateScalableFontResourceA(long ptr ptr ptr) CreateScalableFontResource32A + 63 stdcall CreateScalableFontResourceW(long ptr ptr ptr) CreateScalableFontResource32W + 64 stdcall CreateSolidBrush(long) CreateSolidBrush32 + 65 stdcall DPtoLP(long ptr long) DPtoLP32 + 66 stub DeleteColorSpace + 67 stdcall DeleteDC(long) DeleteDC32 + 68 stub DeleteEnhMetaFile + 69 stub DeleteMetaFile + 70 stdcall DeleteObject(long) DeleteObject32 + 71 stub DescribePixelFormat + 72 stub DeviceCapabilitiesExA + 73 stub DeviceCapabilitiesExW + 74 stub DrawEscape + 75 stdcall Ellipse(long long long long long) Ellipse32 + 76 stub EndDoc + 77 stub EndPage + 78 stub EndPath + 79 stub EnumEnhMetaFile + 80 stdcall EnumFontFamiliesA(long ptr ptr long) EnumFontFamilies32A + 81 stdcall EnumFontFamiliesExA(long ptr ptr long long) EnumFontFamiliesEx32A + 82 stdcall EnumFontFamiliesExW(long ptr ptr long long) EnumFontFamiliesEx32W + 83 stdcall EnumFontFamiliesW(long ptr ptr long) EnumFontFamilies32W + 84 stdcall EnumFontsA(long ptr ptr long) EnumFonts32A + 85 stdcall EnumFontsW(long ptr ptr long) EnumFonts32W + 86 stub EnumICMProfilesA + 87 stub EnumICMProfilesW + 88 stub EnumMetaFile + 89 stdcall EnumObjects(long long ptr long) EnumObjects32 + 90 stdcall EqualRgn(long long) EqualRgn32 + 91 stdcall Escape(long long long ptr ptr) Escape32 + 92 stdcall ExcludeClipRect(long long long long long) ExcludeClipRect32 + 93 stub ExtCreatePen + 94 stub ExtCreateRegion + 95 stub ExtEscape + 96 stdcall ExtFloodFill(long long long long long) ExtFloodFill32 + 97 stub ExtSelectClipRgn + 98 stdcall ExtTextOutA(long long long long ptr ptr long ptr) ExtTextOut32A + 99 stdcall ExtTextOutW(long long long long ptr ptr long ptr) ExtTextOut32W +100 stub FillPath +101 stdcall FillRgn(long long long) FillRgn32 +102 stub FixBrushOrgEx +103 stub FlattenPath +104 stdcall FloodFill(long long long long) FloodFill32 +105 stdcall FrameRgn(long long long long long) FrameRgn32 +106 stub FreeImageColorMatcher +107 stub GdiAssociateObject +108 stub GdiCleanCacheDC +109 stub GdiComment +110 stub GdiConvertAndCheckDC +111 stub GdiConvertBitmap +112 stub GdiConvertBrush +113 stub GdiConvertDC +114 stub GdiConvertEnhMetaFile +115 stub GdiConvertFont +116 stub GdiConvertMetaFilePict +117 stub GdiConvertPalette +118 stub GdiConvertRegion +119 stub GdiCreateLocalBitmap +120 stub GdiCreateLocalBrush +121 stub GdiCreateLocalEnhMetaFile +122 stub GdiCreateLocalFont +123 stub GdiCreateLocalMetaFilePict +124 stub GdiCreateLocalPalette +125 stub GdiCreateLocalRegion +126 stub GdiDeleteLocalDC +127 stub GdiDeleteLocalObject +128 stub GdiFlush +129 return GdiGetBatchLimit 0 1 +130 stub GdiGetLocalBrush +131 stub GdiGetLocalDC +132 stub GdiGetLocalFont +133 stub GdiIsMetaFileDC +134 stub GdiPlayDCScript +135 stub GdiPlayJournal +136 stub GdiPlayScript +137 stub GdiReleaseLocalDC +138 stub GdiSetAttrs +139 return GdiSetBatchLimit 4 1 +140 stub GdiSetServerAttr +141 stub GetArcDirection +142 stub GetAspectRatioFilterEx +143 stdcall GetBitmapBits(long long ptr) GetBitmapBits32 +144 stdcall GetBitmapDimensionEx(long ptr) GetBitmapDimensionEx32 +145 stdcall GetBkColor(long) GetBkColor32 +146 stdcall GetBkMode(long) GetBkMode32 +147 stub GetBoundsRect +148 stdcall GetBrushOrgEx(long ptr) GetBrushOrgEx32 +149 stdcall GetCharABCWidthsA(long long long ptr) GetCharABCWidths32A +150 stub GetCharABCWidthsFloatA +151 stub GetCharABCWidthsFloatW +152 stdcall GetCharABCWidthsW(long long long ptr) GetCharABCWidths32W +153 stdcall GetCharWidth32A(long long long long) GetCharWidth32A +154 stdcall GetCharWidth32W(long long long long) GetCharWidth32W +155 stdcall GetCharWidthA(long long long long) GetCharWidth32A +156 stub GetCharWidthFloatA +157 stub GetCharWidthFloatW +158 stdcall GetCharWidthW(long long long long) GetCharWidth32W +159 stub GetCharWidthWOW +160 stub GetCharacterPlacementA +161 stub GetCharacterPlacementW +162 stdcall GetClipBox(long ptr) GetClipBox32 +163 stdcall GetClipRgn(long long) GetClipRgn32 +164 stub GetColorAdjustment +165 stub GetColorSpace +166 stub GetCurrentObject +167 stdcall GetCurrentPositionEx(long ptr) GetCurrentPositionEx32 +168 stdcall GetDCOrgEx(long ptr) GetDCOrgEx +169 stub GetDIBColorTable +170 stdcall GetDIBits(long long long long ptr ptr long) GetDIBits32 +171 stdcall GetDeviceCaps(long long) GetDeviceCaps32 +172 stub GetDeviceGammaRamp +173 stub GetETM +174 stub GetEnhMetaFileA +175 stub GetEnhMetaFileBits +176 stub GetEnhMetaFileDescriptionA +177 stub GetEnhMetaFileDescriptionW +178 stub GetEnhMetaFileHeader +179 stub GetEnhMetaFilePaletteEntries +180 stub GetEnhMetaFileW +181 stub GetFontData +182 stub GetFontLanguageInfo +183 stub GetFontResourceInfo +184 stub GetFontResourceInfoW +185 stub GetGlyphOutline +186 stdcall GetGlyphOutlineA(long long long ptr long ptr ptr) GetGlyphOutline32A +187 stdcall GetGlyphOutlineW(long long long ptr long ptr ptr) GetGlyphOutline32W +188 return GetGraphicsMode 4 1 # just return 1 +189 stub GetICMProfileA +190 stub GetICMProfileW +191 stub GetKerningPairs +192 stdcall GetKerningPairsA(long long ptr) GetKerningPairs32A +193 stdcall GetKerningPairsW(long long ptr) GetKerningPairs32W +194 stub GetLogColorSpaceA +195 stub GetLogColorSpaceW +196 stdcall GetMapMode(long) GetMapMode32 +197 stdcall GetMetaFileA(ptr) GetMetaFile32A +198 stub GetMetaFileBitsEx +199 stdcall GetMetaFileW(ptr) GetMetaFile32W +200 stub GetMetaRgn +201 stub GetMiterLimit +202 stdcall GetNearestColor(long long) GetNearestColor32 +203 stdcall GetNearestPaletteIndex(long long) GetNearestPaletteIndex32 +204 stdcall GetObjectA(long long ptr) GetObject32A +205 stub GetObjectType +206 stdcall GetObjectW(long long ptr) GetObject32W +207 stub GetOutlineTextMetricsA +208 stub GetOutlineTextMetricsW +209 stdcall GetPaletteEntries(long long long ptr) GetPaletteEntries32 +210 stub GetPath +211 stdcall GetPixel(long long long) GetPixel32 +212 stub GetPixelFormat +213 stdcall GetPolyFillMode(long) GetPolyFillMode32 +214 stdcall GetROP2(long) GetROP232 +215 stub GetRandomRgn +216 stdcall GetRasterizerCaps(ptr long) GetRasterizerCaps32 +217 stub GetRegionData +218 stdcall GetRelAbs(long) GetRelAbs32 +219 stdcall GetRgnBox(long ptr) GetRgnBox32 +220 stdcall GetStockObject(long) GetStockObject32 +221 stdcall GetStretchBltMode(long) GetStretchBltMode32 +222 stdcall GetSystemPaletteEntries(long long long ptr) GetSystemPaletteEntries32 +223 stdcall GetSystemPaletteUse() GetSystemPaletteUse32 +224 stdcall GetTextAlign(long) GetTextAlign32 +225 stdcall GetTextCharacterExtra(long) GetTextCharacterExtra32 +226 stdcall GetTextCharset(long) GetTextCharset32 +227 stdcall GetTextColor(long) GetTextColor32 +228 stdcall GetTextExtentExPointA(long ptr long long ptr ptr ptr) GetTextExtentExPoint32A +229 stdcall GetTextExtentExPointW(long ptr long long ptr ptr ptr) GetTextExtentExPoint32W +230 stdcall GetTextExtentPoint32A(long ptr long ptr) GetTextExtentPoint32A +231 stdcall GetTextExtentPoint32W(long ptr long ptr) GetTextExtentPoint32W +232 stdcall GetTextExtentPointA(long ptr long ptr) GetTextExtentPoint32ABuggy +233 stdcall GetTextExtentPointW(long ptr long ptr) GetTextExtentPoint32WBuggy +234 stdcall GetTextFaceA(long long ptr) GetTextFace32A +235 stdcall GetTextFaceW(long long ptr) GetTextFace32W +236 stdcall GetTextMetricsA(long ptr) GetTextMetrics32A +237 stdcall GetTextMetricsW(long ptr) GetTextMetrics32W +238 stub GetTransform +239 stdcall GetViewportExtEx(long ptr) GetViewportExtEx32 +240 stdcall GetViewportOrgEx(long ptr) GetViewportOrgEx32 +241 stub GetWinMetaFileBits +242 stdcall GetWindowExtEx(long ptr) GetWindowExtEx32 +243 stdcall GetWindowOrgEx(long ptr) GetWindowOrgEx32 +244 return GetWorldTransform 8 0 +245 stdcall IntersectClipRect(long long long long long) IntersectClipRect32 +246 stdcall InvertRgn(long long) InvertRgn32 +247 stdcall LPtoDP(long ptr long) LPtoDP32 +248 stdcall LineDDA(long long long long ptr long) LineDDA32 +249 stdcall LineTo(long long long) LineTo32 +250 stub LoadImageColorMatcherA +251 stub LoadImageColorMatcherW +252 stub MaskBlt +253 stub ModifyWorldTransform +254 stdcall MoveToEx(long long long ptr) MoveToEx32 +255 stdcall OffsetClipRgn(long long long) OffsetClipRgn32 +256 stdcall OffsetRgn(long long long) OffsetRgn32 +257 stdcall OffsetViewportOrgEx(long long long ptr) OffsetViewportOrgEx32 +258 stdcall OffsetWindowOrgEx(long long long ptr) OffsetWindowOrgEx32 +259 stdcall PaintRgn(long long) PaintRgn32 +260 stdcall PatBlt(long long long long long long) PatBlt32 +261 stub PathToRegion +262 stdcall Pie(long long long long long long long long long) Pie32 +263 stub PlayEnhMetaFile +264 stub PlayEnhMetaFileRecord +265 stdcall PlayMetaFile(long long) PlayMetaFile32 +266 stub PlayMetaFileRecord +267 stub PlgBlt +268 stub PolyBezier +269 stub PolyBezierTo +270 stub PolyDraw +271 stdcall PolyPolygon(long ptr ptr long) PolyPolygon32 +272 stub PolyPolyline +273 stub PolyTextOutA +274 stub PolyTextOutW +275 stdcall Polygon(long ptr long) Polygon32 +276 stdcall Polyline(long ptr long) Polyline32 +277 stub PolylineTo +278 stdcall PtInRegion(long long long) PtInRegion32 +279 stdcall PtVisible(long long long) PtVisible32 +280 stdcall RealizePalette(long) RealizePalette32 +281 stdcall RectInRegion(long ptr) RectInRegion32 +282 stdcall RectVisible(long ptr) RectVisible32 +283 stdcall Rectangle(long long long long long) Rectangle32 +284 stdcall RemoveFontResourceA(ptr) RemoveFontResource32A +285 stub RemoveFontResourceTracking +286 stdcall RemoveFontResourceW(ptr) RemoveFontResource32W +287 stdcall ResetDCA(long ptr) ResetDC32A +288 stdcall ResetDCW(long ptr) ResetDC32W +289 stdcall ResizePalette(long long) ResizePalette32 +290 stdcall RestoreDC(long long) RestoreDC32 +291 stdcall RoundRect(long long long long long long long) RoundRect32 +292 stdcall SaveDC(long) SaveDC32 +293 stdcall ScaleViewportExtEx(long long long long long ptr) ScaleViewportExtEx32 +294 stdcall ScaleWindowExtEx(long long long long long ptr) ScaleWindowExtEx32 +295 stub SelectBrushLocal +296 stub SelectClipPath +297 stdcall SelectClipRgn(long long) SelectClipRgn32 +298 stub SelectFontLocal +299 stdcall SelectObject(long long) SelectObject32 +300 stdcall SelectPalette(long long long) SelectPalette32 +301 stub SetAbortProc +302 stub SetArcDirection +303 stdcall SetBitmapBits(long long ptr) SetBitmapBits32 +304 stdcall SetBitmapDimensionEx(long long long ptr) SetBitmapDimensionEx32 +305 stdcall SetBkColor(long long) SetBkColor32 +306 stdcall SetBkMode(long long) SetBkMode32 +307 stub SetBoundsRect +308 stdcall SetBrushOrgEx(long long long ptr) SetBrushOrgEx +309 stub SetColorAdjustment +310 stub SetColorSpace +311 stub SetDIBColorTable +312 stdcall SetDIBits(long long long long ptr ptr long) SetDIBits32 +313 stdcall SetDIBitsToDevice(long long long long long long long long long ptr ptr long) SetDIBitsToDevice32 -0314 stub SetDeviceGammaRamp -0315 stub SetEnhMetaFileBits -0316 stub SetFontEnumeration -0317 return SetGraphicsMode 8 1 -0318 stub SetICMMode -0319 stub SetICMProfileA -0320 stub SetICMProfileW -0321 stdcall SetMapMode(long long) SetMapMode32 -0322 stdcall SetMapperFlags(long long) SetMapperFlags32 -0323 stub SetMetaFileBitsEx -0324 stub SetMetaRgn -0325 stub SetMiterLimit -0326 stdcall SetPaletteEntries(long long long ptr) SetPaletteEntries32 -0327 stdcall SetPixel(long long long long) SetPixel32 -0328 stub SetPixelFormat -0329 stub SetPixelV -0330 stdcall SetPolyFillMode(long long) SetPolyFillMode32 -0331 stdcall SetROP2(long long) SetROP232 -0332 stdcall SetRectRgn(long long long long long) SetRectRgn32 -0333 stdcall SetRelAbs(long long) SetRelAbs32 -0334 stdcall SetStretchBltMode(long long) SetStretchBltMode32 -0335 stdcall SetSystemPaletteUse(long long) SetSystemPaletteUse32 -0336 stdcall SetTextAlign(long long) SetTextAlign32 -0337 stdcall SetTextCharacterExtra(long long) SetTextCharacterExtra32 -0338 stdcall SetTextColor(long long) SetTextColor32 -0339 stdcall SetTextJustification(long long long) SetTextJustification32 -0340 stdcall SetViewportExtEx(long long long ptr) SetViewportExtEx32 -0341 stdcall SetViewportOrgEx(long long long ptr) SetViewportOrgEx32 -0342 stub SetVirtualResolution -0343 stub SetWinMetaFileBits -0344 stdcall SetWindowExtEx(long long long ptr) SetWindowExtEx32 -0345 stdcall SetWindowOrgEx(long long long ptr) SetWindowOrgEx32 -0346 stub SetWorldTransform -0347 stub StartDocA -0348 stub StartDocW -0349 stub StartPage -0350 stdcall StretchBlt(long long long long long long long long long long long) - StretchBlt32 -0351 stdcall StretchDIBits(long long long long long long long long long - ptr ptr long long) StretchDIBits32 -0352 stub StrokeAndFillPath -0353 stub StrokePath -0354 stub SwapBuffers -0355 stdcall TextOutA(long long long ptr long) TextOut32A -0356 stdcall TextOutW(long long long ptr long) TextOut32W -0357 stub UnloadNetworkFonts -0358 stdcall UnrealizeObject(long) UnrealizeObject32 -0359 stdcall UpdateColors(long) UpdateColors32 -0360 stub WidenPath -0361 stub pstackConnect +314 stub SetDeviceGammaRamp +315 stub SetEnhMetaFileBits +316 stub SetFontEnumeration +317 return SetGraphicsMode 8 1 +318 stub SetICMMode +319 stub SetICMProfileA +320 stub SetICMProfileW +321 stdcall SetMapMode(long long) SetMapMode32 +322 stdcall SetMapperFlags(long long) SetMapperFlags32 +323 stub SetMetaFileBitsEx +324 stub SetMetaRgn +325 stub SetMiterLimit +326 stdcall SetPaletteEntries(long long long ptr) SetPaletteEntries32 +327 stdcall SetPixel(long long long long) SetPixel32 +328 stub SetPixelFormat +329 stub SetPixelV +330 stdcall SetPolyFillMode(long long) SetPolyFillMode32 +331 stdcall SetROP2(long long) SetROP232 +332 stdcall SetRectRgn(long long long long long) SetRectRgn32 +333 stdcall SetRelAbs(long long) SetRelAbs32 +334 stdcall SetStretchBltMode(long long) SetStretchBltMode32 +335 stdcall SetSystemPaletteUse(long long) SetSystemPaletteUse32 +336 stdcall SetTextAlign(long long) SetTextAlign32 +337 stdcall SetTextCharacterExtra(long long) SetTextCharacterExtra32 +338 stdcall SetTextColor(long long) SetTextColor32 +339 stdcall SetTextJustification(long long long) SetTextJustification32 +340 stdcall SetViewportExtEx(long long long ptr) SetViewportExtEx32 +341 stdcall SetViewportOrgEx(long long long ptr) SetViewportOrgEx32 +342 stub SetVirtualResolution +343 stub SetWinMetaFileBits +344 stdcall SetWindowExtEx(long long long ptr) SetWindowExtEx32 +345 stdcall SetWindowOrgEx(long long long ptr) SetWindowOrgEx32 +346 stub SetWorldTransform +347 stub StartDocA +348 stub StartDocW +349 stub StartPage +350 stdcall StretchBlt(long long long long long long long long long long long) + StretchBlt32 +351 stdcall StretchDIBits(long long long long long long long long long + ptr ptr long long) StretchDIBits32 +352 stub StrokeAndFillPath +353 stub StrokePath +354 stub SwapBuffers +355 stdcall TextOutA(long long long ptr long) TextOut32A +356 stdcall TextOutW(long long long ptr long) TextOut32W +357 stub UnloadNetworkFonts +358 stdcall UnrealizeObject(long) UnrealizeObject32 +359 stdcall UpdateColors(long) UpdateColors32 +360 stub WidenPath +361 stub pstackConnect #late additions -0362 stub DeviceCapabilitiesEx -0363 stub GdiDciBeginAccess -0364 stub GdiDciCreateOffscreenSurface -0365 stub GdiDciCreateOverlaySurface -0366 stub GdiDciCreatePrimarySurface -0367 stub GdiDciDestroySurface -0368 stub GdiDciDrawSurface -0369 stub GdiDciEndAccess -0370 stub GdiDciEnumSurface -0371 stub GdiDciInitialize -0372 stub GdiDciSetClipList -0373 stub GdiDciSetDestination -0374 stub GdiDllInitialize -0375 stub GdiGetLocalBitmap -0376 stub GdiWinWatchClose -0377 stub GdiWinWatchDidStatusChange -0378 stub GdiWinWatchGetClipList -0379 stub GdiWinWatchOpen -0380 stub GetGlyphOutlineWow -0381 stub GetTextCharsetInfo -0382 stdcall TranslateCharsetInfo(ptr ptr long) TranslateCharSetInfo -0383 stub UpdateICMRegKeyA -0384 stub UpdateICMRegKeyW -0385 stub gdiPlaySpoolStream -0386 return SetObjectOwner 8 0 +362 stub DeviceCapabilitiesEx +363 stub GdiDciBeginAccess +364 stub GdiDciCreateOffscreenSurface +365 stub GdiDciCreateOverlaySurface +366 stub GdiDciCreatePrimarySurface +367 stub GdiDciDestroySurface +368 stub GdiDciDrawSurface +369 stub GdiDciEndAccess +370 stub GdiDciEnumSurface +371 stub GdiDciInitialize +372 stub GdiDciSetClipList +373 stub GdiDciSetDestination +374 stub GdiDllInitialize +375 stub GdiGetLocalBitmap +376 stub GdiWinWatchClose +377 stub GdiWinWatchDidStatusChange +378 stub GdiWinWatchGetClipList +379 stub GdiWinWatchOpen +380 stub GetGlyphOutlineWow +381 stub GetTextCharsetInfo +382 stdcall TranslateCharsetInfo(ptr ptr long) TranslateCharSetInfo +383 stub UpdateICMRegKeyA +384 stub UpdateICMRegKeyW +385 stub gdiPlaySpoolStream +386 return SetObjectOwner 8 0 diff --git a/if1632/kernel.spec b/if1632/kernel.spec index e17ff9c15d7..df6f2e70678 100644 --- a/if1632/kernel.spec +++ b/if1632/kernel.spec @@ -39,7 +39,7 @@ file krnl386.exe 35 pascal16 GetTaskQueue(word) GetTaskQueue 36 pascal GetCurrentTask() WIN16_GetCurrentTask 37 pascal GetCurrentPDB() GetCurrentPDB -38 pascal SetTaskSignalProc(word segptr) SetTaskSignalProc +38 pascal SetTaskSignalProc(word segptr) THUNK_SetTaskSignalProc 41 return EnableDos 0 0 42 return DisableDos 0 0 45 pascal16 LoadModule(str ptr) LoadModule16 @@ -64,7 +64,7 @@ file krnl386.exe 64 pascal16 AccessResource(word word) AccessResource16 65 pascal SizeofResource(word word) SizeofResource16 66 pascal16 AllocResource(word word long) AllocResource16 -67 pascal SetResourceHandler(word segstr ptr) SetResourceHandler +67 pascal SetResourceHandler(word segstr segptr) THUNK_SetResourceHandler 68 pascal16 InitAtomTable(word) InitAtomTable16 69 pascal16 FindAtom(segstr) FindAtom16 70 pascal16 AddAtom(segstr) AddAtom16 @@ -89,12 +89,12 @@ file krnl386.exe 89 pascal lstrcat(segstr str) lstrcat16 90 pascal16 lstrlen(str) lstrlen16 91 register InitTask() InitTask -92 pascal GetTempDrive(byte) WIN16_GetTempDrive +92 pascal GetTempDrive(word) WIN16_GetTempDrive 93 pascal16 GetCodeHandle(segptr) GetCodeHandle 94 stub DefineHandleTable 95 pascal16 LoadLibrary(str) LoadLibrary16 96 pascal16 FreeLibrary(word) FreeLibrary16 -97 pascal16 GetTempFileName(byte str word ptr) GetTempFileName16 +97 pascal16 GetTempFileName(word str word ptr) GetTempFileName16 98 return GetLastDiskChange 0 0 99 stub GetLPErrMode 100 return ValidateCodeSegments 0 0 @@ -135,7 +135,7 @@ file krnl386.exe 133 pascal16 GetExePtr(word) GetExePtr 134 pascal16 GetWindowsDirectory(ptr word) GetWindowsDirectory16 135 pascal16 GetSystemDirectory(ptr word) GetSystemDirectory16 -136 pascal16 GetDriveType(byte) GetDriveType16 +136 pascal16 GetDriveType(word) GetDriveType16 137 pascal16 FatalAppExit(word str) FatalAppExit16 138 pascal GetHeapSpaces(word) GetHeapSpaces 139 stub DoSignal diff --git a/if1632/kernel32.spec b/if1632/kernel32.spec index 695a564b42c..3b6243a820c 100644 --- a/if1632/kernel32.spec +++ b/if1632/kernel32.spec @@ -1,6 +1,5 @@ name kernel32 type win32 -base 1 # Functions exported by the Win95 kernel32.dll # (these need to have these exact ordinals, for some win95 dlls @@ -9,838 +8,838 @@ base 1 # undocumented ordinal only calls (names taken from k32exp.h by Andrew # Schulman. -0 stub VxDCall0 -1 stub VxDCall0 -2 stub VxDCall0 -3 stub VxDCall0 -4 stub VxDCall0 -5 stub VxDCall0 -6 stub VxDCall0 -7 stub VxDCall0 -8 stub VxDCall0 + 1 stub VxDCall0 + 2 stub VxDCall1 + 3 stub VxDCall2 + 4 stub VxDCall3 + 5 stub VxDCall4 + 6 stub VxDCall5 + 7 stub VxDCall6 + 8 stub VxDCall7 + 9 stub VxDCall8 -9 stub _KERNEL32_stringconv1 #ansi2oem or reverse? + 10 stub _KERNEL32_stringconv1 #ansi2oem or reverse? -17 stdcall _KERNEL32_18(long long) _KERNEL32_18 -18 stub _KERNEL32_getheapsegment + 18 stdcall _KERNEL32_18(long long) _KERNEL32_18 + 19 stub _KERNEL32_getheapsegment -30 stub _KERNEL32_31 + 31 stub _KERNEL32_31 -33 stdcall _KERNEL32_34() _KERNEL32_34 -34 stdcall LoadLibrary16(ptr) LoadLibrary16 -35 stub FreeLibrary16 -36 stdcall GetProcAddress16(long ptr) WIN32_GetProcAddress16 + 34 stdcall _KERNEL32_34() _KERNEL32_34 + 35 stdcall LoadLibrary16(ptr) LoadLibrary16 + 36 stdcall FreeLibrary16(long) FreeLibrary16 + 37 stdcall GetProcAddress16(long ptr) WIN32_GetProcAddress16 -39 stub _KERNEL32_40 -40 stdcall _KERNEL32_41(long long long long long) _KERNEL32_41 -41 stub _KERNEL32_42 -42 stdcall _KERNEL32_43(long ptr long ptr ptr) _KERNEL32_43 -44 register _KERNEL32_45() _KERNEL32_45 -45 stdcall _KERNEL32_46(long long long long long) _KERNEL32_46 -46 stub _KERNEL32_47 + 40 stub _KERNEL32_40 + 41 stdcall _KERNEL32_41(long long long long long) _KERNEL32_41 + 42 stub _KERNEL32_42 + 43 stdcall _KERNEL32_43(long ptr long ptr ptr) _KERNEL32_43 + 45 register _KERNEL32_45() _KERNEL32_45 + 46 stdcall _KERNEL32_46(long long long long long) _KERNEL32_46 + 47 stub _KERNEL32_47 -49 stdcall AddAtomA(ptr) AddAtom32A + 50 stdcall AddAtomA(ptr) AddAtom32A -51 register _KERNEL32_52(long) _KERNEL32_52 + 52 register _KERNEL32_52(long) _KERNEL32_52 # WOW calls -53 stdcall WOWCallback16(long long) WOWCallback16 -54 stub WOWCallback16Ex -55 stdcall WOWGetVDMPointer(long long long) WOWGetVDMPointer -56 stub WOWHandle32 -57 stub WOWHandle16 -58 stub WOWGlobalAlloc16 -59 stub WOWGlobalLock16 -60 stub WOWGlobalUnlock16 -61 stub WOWGlobalFree16 -62 stdcall WOWGlobalAllocLock16(long long ptr) WOWGlobalAllocLock16 -63 stub WOWGlobalUnlockFree16 -64 stub WOWGlobalLockSize16 -65 stub WOWYield16 -66 stub WOWDirectedYield16 -67 stdcall WOWGetVDMPointerFix(long long long) WOWGetVDMPointerFix -68 stdcall WOWGetVDMPointerUnfix(long) WOWGetVDMPointerUnfix -69 stdcall WOW32_1(long long) WOW32_1 + 54 stdcall WOWCallback16(long long) WOWCallback16 + 55 stub WOWCallback16Ex + 56 stdcall WOWGetVDMPointer(long long long) WOWGetVDMPointer + 57 stub WOWHandle32 + 58 stub WOWHandle16 + 59 stub WOWGlobalAlloc16 + 60 stub WOWGlobalLock16 + 61 stub WOWGlobalUnlock16 + 62 stub WOWGlobalFree16 + 63 stdcall WOWGlobalAllocLock16(long long ptr) WOWGlobalAllocLock16 + 64 stub WOWGlobalUnlockFree16 + 65 stub WOWGlobalLockSize16 + 66 stub WOWYield16 + 67 stub WOWDirectedYield16 + 68 stdcall WOWGetVDMPointerFix(long long long) WOWGetVDMPointerFix + 69 stdcall WOWGetVDMPointerUnfix(long) WOWGetVDMPointerUnfix + 70 stdcall WOW32_1(long long) WOW32_1 -71 stub RtlLargeIntegerAdd -72 stub RtlEnlargedIntegerMultiply -73 stub RtlEnlargedUnsignedMultiply -74 stub RtlEnlargedUnsignedDivide -75 stub RtlExtendedLargeIntegerDivide -76 stub RtlExtendedMagicDivide -77 stub RtlExtendedIntegerMultiply -78 stub RtlLargeIntegerShiftLeft -79 stub RtlLargeIntegerShiftRight -80 stub RtlLargeIntegerArithmeticShift -81 stub RtlLargeIntegerNegate -82 stub RtlLargeIntegerSubtract -83 stub RtlConvertLongToLargeInteger -84 stub RtlConvertUlongToLargeInteger + 72 stub RtlLargeIntegerAdd + 73 stub RtlEnlargedIntegerMultiply + 74 stub RtlEnlargedUnsignedMultiply + 75 stub RtlEnlargedUnsignedDivide + 76 stub RtlExtendedLargeIntegerDivide + 77 stub RtlExtendedMagicDivide + 78 stub RtlExtendedIntegerMultiply + 79 stub RtlLargeIntegerShiftLeft + 80 stub RtlLargeIntegerShiftRight + 81 stub RtlLargeIntegerArithmeticShift + 82 stub RtlLargeIntegerNegate + 83 stub RtlLargeIntegerSubtract + 84 stub RtlConvertLongToLargeInteger + 85 stub RtlConvertUlongToLargeInteger -86 stdcall _KERNEL32_87() _KERNEL32_87 -87 cdecl _KERNEL32_88() _KERNEL32_88 -88 stub _KERNEL32_89 -89 register _KERNEL32_90() _KERNEL32_90 -90 stub _KERNEL32_91 -91 stub _KERNEL32_92 -92 stdcall GETPWIN16LOCK(ptr) GetPWinLock -96 stub ENTERSYSLEVEL -97 stub LEAVESYSLEVEL -98 stub _KERNEL32_98 -99 stub _KERNEL32_99 -100 stub _KERNEL32_100 + 87 stdcall _KERNEL32_87() _KERNEL32_87 + 88 varargs _KERNEL32_88() _KERNEL32_88 + 89 stub _KERNEL32_89 + 90 register _KERNEL32_90() _KERNEL32_90 + 91 stub _KERNEL32_91 + 92 stub _KERNEL32_92 + 93 stdcall GETPWIN16LOCK(ptr) GetPWinLock + 97 stub ENTERSYSLEVEL + 98 stub LEAVESYSLEVEL + 99 stub _KERNEL32_98 +100 stub _KERNEL32_99 +101 stub _KERNEL32_100 -101 stdcall AddAtomW(ptr) AddAtom32W -102 stub AllocConsole -103 stub AllocLSCallback -104 stub AllocSLCallback -105 stdcall AreFileApisANSI() AreFileApisANSI -106 stub BackupRead -107 stub BackupSeek -108 stub BackupWrite -109 stdcall Beep(long long) Beep -110 stub BeginUpdateResourceA -111 stub BeginUpdateResourceW -112 stdcall BuildCommDCBA(ptr ptr) BuildCommDCB32A -113 stdcall BuildCommDCBAndTimeoutsA(ptr ptr ptr) BuildCommDCBAndTimeouts32A -114 stdcall BuildCommDCBAndTimeoutsW(ptr ptr ptr) BuildCommDCBAndTimeouts32W -115 stdcall BuildCommDCBW(ptr ptr) BuildCommDCB32W -116 stub CallNamedPipeA -117 stub CallNamedPipeW -118 stub Callback12 -119 stub Callback16 -120 stub Callback20 -121 stub Callback24 -122 stub Callback28 -123 stub Callback32 -124 stub Callback36 -125 stub Callback40 -126 stub Callback44 -127 stub Callback48 -128 stub Callback4 -129 stub Callback52 -130 stub Callback56 -131 stub Callback60 -132 stub Callback64 -133 stub Callback8 -134 stdcall ClearCommBreak(long) ClearCommBreak32 -135 stdcall ClearCommError(long ptr ptr) ClearCommError -136 stdcall CloseHandle(long) CloseHandle -137 stub CloseProfileUserMapping -138 stub CloseSystemHandle -139 stub CommConfigDialogA -140 stub CommConfigDialogW -141 stdcall CompareFileTime(ptr ptr) CompareFileTime -142 stdcall CompareStringA(long long ptr long ptr long) CompareString32A -143 stdcall CompareStringW(long long ptr long ptr long) CompareString32W -144 stub ConnectNamedPipe -145 stdcall ContinueDebugEvent(long long long) ContinueDebugEvent -146 stub ConvertDefaultLocale -147 stdcall ConvertToGlobalHandle(long) ConvertToGlobalHandle -148 stdcall CopyFileA(ptr ptr long) CopyFile32A -149 stdcall CopyFileW(ptr ptr long) CopyFile32W -150 stub CreateConsoleScreenBuffer -151 stdcall CreateDirectoryA(ptr ptr) CreateDirectory32A -152 stdcall CreateDirectoryExA(ptr ptr ptr) CreateDirectoryEx32A -153 stdcall CreateDirectoryExW(ptr ptr ptr) CreateDirectoryEx32W -154 stdcall CreateDirectoryW(ptr ptr) CreateDirectory32W -155 stdcall CreateEventA(ptr long long ptr) CreateEvent32A -156 stdcall CreateEventW(ptr long long ptr) CreateEvent32W -157 stdcall CreateFileA(ptr long long ptr long long long) CreateFile32A -158 stdcall CreateFileMappingA(long ptr long long long ptr) CreateFileMapping32A -159 stdcall CreateFileMappingW(long ptr long long long ptr) CreateFileMapping32W -160 stdcall CreateFileW(ptr long long ptr long long long) CreateFile32W -161 stub CreateIoCompletionPort -162 stub CreateKernelThread -163 stub CreateMailslotA -164 stub CreateMailslotW -165 stdcall CreateMutexA(ptr long ptr) CreateMutex32A -166 stdcall CreateMutexW(ptr long ptr) CreateMutex32W -167 stub CreateNamedPipeA -168 stub CreateNamedPipeW -169 stub CreatePipe -170 stdcall CreateProcessA(ptr ptr ptr ptr long long ptr ptr ptr ptr) CreateProcess32A -171 stub CreateProcessW -172 stub CreateRemoteThread -173 stdcall CreateSemaphoreA(ptr long long ptr) CreateSemaphore32A -174 stdcall CreateSemaphoreW(ptr long long ptr) CreateSemaphore32W -175 stub CreateSocketHandle -176 stub CreateTapePartition -177 stdcall CreateThread(ptr long ptr long long ptr) CreateThread -178 stub CreateToolhelp32Snapshot -179 stub DebugActiveProcess -180 stdcall DebugBreak() DebugBreak32 -181 stub DefineDosDeviceA -182 stub DefineDosDeviceW -183 stdcall DeleteAtom(long) DeleteAtom32 -184 stdcall DeleteCriticalSection(ptr) DeleteCriticalSection -185 stdcall DeleteFileA(ptr) DeleteFile32A -186 stdcall DeleteFileW(ptr) DeleteFile32W -187 stub DeviceIoControl -188 stdcall DisableThreadLibraryCalls(long) DisableThreadLibraryCalls -189 stub DisconnectNamedPipe -190 stdcall DosDateTimeToFileTime(long long ptr) DosDateTimeToFileTime -191 stdcall DuplicateHandle(long long long ptr long long long) DuplicateHandle -192 stub EndUpdateResourceA -193 stub EndUpdateResourceW -194 stdcall EnterCriticalSection(ptr) EnterCriticalSection -195 stub EnumCalendarInfoA -196 stub EnumCalendarInfoW -197 stub EnumDateFormatsA -198 stub EnumDateFormatsW -199 stdcall EnumResourceLanguagesA(long ptr ptr ptr long) THUNK_EnumResourceLanguages32A -200 stdcall EnumResourceLanguagesW(long ptr ptr ptr long) THUNK_EnumResourceLanguages32W -201 stdcall EnumResourceNamesA(long ptr ptr long) THUNK_EnumResourceNames32A -202 stdcall EnumResourceNamesW(long ptr ptr long) THUNK_EnumResourceNames32W -203 stdcall EnumResourceTypesA(long ptr long) THUNK_EnumResourceTypes32A -204 stdcall EnumResourceTypesW(long ptr long) THUNK_EnumResourceTypes32W -205 stdcall EnumSystemCodePagesA(ptr long) THUNK_EnumSystemCodePages32A -206 stdcall EnumSystemCodePagesW(ptr long) THUNK_EnumSystemCodePages32W -207 stdcall EnumSystemLocalesA(ptr long) THUNK_EnumSystemLocales32A -208 stdcall EnumSystemLocalesW(ptr long) THUNK_EnumSystemLocales32W -209 stub EnumTimeFormatsA -210 stub EnumTimeFormatsW -211 stub EraseTape -212 stdcall EscapeCommFunction(long long) EscapeCommFunction32 -213 stdcall ExitProcess(long) ExitProcess -214 stub ExitThread -215 stdcall ExpandEnvironmentStringsA(ptr ptr long) ExpandEnvironmentStrings32A -216 stdcall ExpandEnvironmentStringsW(ptr ptr long) ExpandEnvironmentStrings32W -217 stub FT_Exit0 -218 stub FT_Exit12 -219 stub FT_Exit16 -220 stub FT_Exit20 -221 stub FT_Exit24 -222 stub FT_Exit28 -223 stub FT_Exit32 -224 stub FT_Exit36 -226 stub FT_Exit40 -227 stub FT_Exit44 -228 stub FT_Exit48 -225 stub FT_Exit4 -229 stub FT_Exit52 -230 stub FT_Exit56 -231 stub FT_Exit8 -232 stub FT_Prolog -233 stub FT_Thunk -234 stdcall FatalAppExitA(long ptr) FatalAppExit32A -235 stdcall FatalAppExitW(long ptr) FatalAppExit32W -236 stub FatalExit -237 stdcall FileTimeToDosDateTime(ptr ptr ptr) FileTimeToDosDateTime -238 stdcall FileTimeToLocalFileTime(ptr ptr) FileTimeToLocalFileTime -239 stdcall FileTimeToSystemTime(ptr ptr) FileTimeToSystemTime -240 stub FillConsoleOutputAttribute -241 stub FillConsoleOutputCharacterA -242 stub FillConsoleOutputCharacterW -243 stdcall FindAtomA(ptr) FindAtom32A -244 stdcall FindAtomW(ptr) FindAtom32W -246 stub FindCloseChangeNotification -245 stdcall FindClose(long) FindClose32 -247 stub FindFirstChangeNotificationA -248 stub FindFirstChangeNotificationW -249 stdcall FindFirstFileA(ptr ptr) FindFirstFile32A -250 stdcall FindFirstFileW(ptr ptr) FindFirstFile32W -251 stub FindNextChangeNotification -252 stdcall FindNextFileA(long ptr) FindNextFile32A -253 stdcall FindNextFileW(long ptr) FindNextFile32W -254 stdcall FindResourceA(long ptr ptr) FindResource32A -255 stdcall FindResourceExA(long ptr ptr long) FindResourceEx32A -256 stdcall FindResourceExW(long ptr ptr long) FindResourceEx32W -257 stdcall FindResourceW(long ptr ptr) FindResource32W -258 stdcall FlushConsoleInputBuffer(long) FlushConsoleInputBuffer -259 stdcall FlushFileBuffers(long) FlushFileBuffers -260 stub FlushInstructionCache -261 stub FlushViewOfFile -262 stub FoldStringA -263 stub FoldStringW -264 stdcall FormatMessageA() WIN32_FormatMessage32A -265 stdcall FormatMessageW() WIN32_FormatMessage32W -266 stub FreeConsole -267 stdcall FreeEnvironmentStringsA(ptr) FreeEnvironmentStrings32A -268 stdcall FreeEnvironmentStringsW(ptr) FreeEnvironmentStrings32W -269 stub FreeLSCallback -271 stub FreeLibraryAndExitThread -270 stdcall FreeLibrary(long) FreeLibrary32 -272 stdcall FreeResource(long) FreeResource32 -273 stub FreeSLCallback -274 stub GenerateConsoleCtrlEvent -275 stdcall GetACP() GetACP -276 stdcall GetAtomNameA(long ptr long) GetAtomName32A -277 stdcall GetAtomNameW(long ptr long) GetAtomName32W -278 stub GetBinaryType -279 stub GetBinaryTypeA -280 stub GetBinaryTypeW -281 stdcall GetCPInfo(long ptr) GetCPInfo -282 stub GetCommConfig -283 stdcall GetCommMask(long ptr) GetCommMask -284 stub GetCommModemStatus -285 stub GetCommProperties -286 stdcall GetCommState(long ptr) GetCommState32 -287 stdcall GetCommTimeouts(long ptr) GetCommTimeouts -288 stdcall GetCommandLineA() GetCommandLine32A -289 stdcall GetCommandLineW() GetCommandLine32W -290 stub GetCompressedFileSizeA -291 stub GetCompressedFileSizeW -292 stdcall GetComputerNameA(ptr ptr) GetComputerName32A -293 stdcall GetComputerNameW(ptr ptr) GetComputerName32W -294 stdcall GetConsoleCP() GetConsoleCP -295 stub GetConsoleCursorInfo -296 stdcall GetConsoleMode(long ptr) GetConsoleMode -297 stdcall GetConsoleOutputCP() GetConsoleOutputCP -298 stdcall GetConsoleScreenBufferInfo(long ptr) GetConsoleScreenBufferInfo -299 stdcall GetConsoleTitleA(ptr long) GetConsoleTitle32A -300 stdcall GetConsoleTitleW(ptr long) GetConsoleTitle32W -301 stub GetCurrencyFormatA -302 stub GetCurrencyFormatW -303 stdcall GetCurrentDirectoryA(long ptr) GetCurrentDirectory32A -304 stdcall GetCurrentDirectoryW(long ptr) GetCurrentDirectory32W -305 stdcall GetCurrentProcess() GetCurrentProcess -306 stdcall GetCurrentProcessId() GetCurrentProcessId -307 stdcall GetCurrentThread() GetCurrentThread -308 stdcall GetCurrentThreadId() GetCurrentThreadId -309 stub GetDateFormatA -310 stub GetDateFormatW -311 stub GetDaylightFlag -312 stub GetDefaultCommConfigA -313 stub GetDefaultCommConfigW -314 stdcall GetDiskFreeSpaceA(ptr ptr ptr ptr ptr) GetDiskFreeSpace32A -315 stdcall GetDiskFreeSpaceW(ptr ptr ptr ptr ptr) GetDiskFreeSpace32W -316 stdcall GetDriveTypeA(ptr) GetDriveType32A -317 stdcall GetDriveTypeW(ptr) GetDriveType32W -319 stdcall GetEnvironmentStringsA() GetEnvironmentStrings32A -320 stdcall GetEnvironmentStringsW() GetEnvironmentStrings32W -318 stdcall GetEnvironmentStrings() GetEnvironmentStrings32A -321 stdcall GetEnvironmentVariableA(ptr ptr long) GetEnvironmentVariable32A -322 stdcall GetEnvironmentVariableW(ptr ptr long) GetEnvironmentVariable32W -323 stub GetErrorMode -324 stub GetExitCodeProcess -325 stub GetExitCodeThread -326 stdcall GetFileAttributesA(ptr) GetFileAttributes32A -327 stdcall GetFileAttributesW(ptr) GetFileAttributes32W -328 stdcall GetFileInformationByHandle(long ptr) GetFileInformationByHandle -329 stdcall GetFileSize(long ptr) GetFileSize -330 stdcall GetFileTime(long ptr ptr ptr) GetFileTime -331 stdcall GetFileType(long) GetFileType -332 stdcall GetFullPathNameA(ptr long ptr ptr) GetFullPathName32A -333 stdcall GetFullPathNameW(ptr long ptr ptr) GetFullPathName32W -334 stub GetHandleContext -335 stub GetHandleInformation -336 stub GetLSCallbackTarget -337 stub GetLSCallbackTemplate -338 stdcall GetLargestConsoleWindowSize(long) GetLargestConsoleWindowSize -339 stdcall GetLastError() GetLastError -340 stdcall GetLocalTime(ptr) GetLocalTime -341 stdcall GetLocaleInfoA(long long ptr long) GetLocaleInfo32A -342 stdcall GetLocaleInfoW(long long ptr long) GetLocaleInfo32W -343 stdcall GetLogicalDriveStringsA(long ptr) GetLogicalDriveStrings32A -344 stdcall GetLogicalDriveStringsW(long ptr) GetLogicalDriveStrings32W -345 stdcall GetLogicalDrives() GetLogicalDrives -346 stub GetMailslotInfo -347 stdcall GetModuleFileNameA(long ptr long) GetModuleFileName32A -348 stdcall GetModuleFileNameW(long ptr long) GetModuleFileName32W -349 stdcall GetModuleHandleA(ptr) WIN32_GetModuleHandleA -350 stdcall GetModuleHandleW(ptr) WIN32_GetModuleHandleW -351 stub GetNamedPipeHandleStateA -352 stub GetNamedPipeHandleStateW -353 stub GetNamedPipeInfo -354 stub GetNumberFormatA -355 stub GetNumberFormatW -356 stdcall GetNumberOfConsoleInputEvents(long ptr) GetNumberOfConsoleInputEvents -357 stub GetNumberOfConsoleMouseButtons -358 stdcall GetOEMCP() GetOEMCP -359 stub GetOverlappedResult -360 stdcall GetPriorityClass(long) GetPriorityClass -361 stdcall GetPrivateProfileIntA(ptr ptr long ptr) GetPrivateProfileInt32A -362 stdcall GetPrivateProfileIntW(ptr ptr long ptr) GetPrivateProfileInt32W -363 stub GetPrivateProfileSectionA -364 stub GetPrivateProfileSectionNamesA -365 stub GetPrivateProfileSectionNamesW -366 stub GetPrivateProfileSectionW -367 stdcall GetPrivateProfileStringA(ptr ptr ptr ptr long ptr) GetPrivateProfileString32A -368 stdcall GetPrivateProfileStringW(ptr ptr ptr ptr long ptr) GetPrivateProfileString32W -369 stub GetPrivateProfileStructA -370 stub GetPrivateProfileStructW -371 stdcall GetProcAddress(long ptr) GetProcAddress32 -372 stdcall GetProcessAffinityMask(long ptr ptr) GetProcessAffinityMask -373 stub GetProcessFlags -374 stdcall GetProcessHeap() GetProcessHeap -375 stub GetProcessHeaps -376 stub GetProcessShutdownParameters -377 stdcall GetProcessTimes(long ptr ptr ptr ptr) GetProcessTimes -378 stdcall GetProcessVersion(long) GetProcessVersion -379 stdcall GetProcessWorkingSetSize(long ptr ptr) GetProcessWorkingSetSize -380 stub GetProductName -381 stdcall GetProfileIntA(ptr ptr long) GetProfileInt32A -382 stdcall GetProfileIntW(ptr ptr long) GetProfileInt32W -383 stub GetProfileSectionA -384 stub GetProfileSectionW -385 stdcall GetProfileStringA(ptr ptr ptr ptr long) GetProfileString32A -386 stdcall GetProfileStringW(ptr ptr ptr ptr long) GetProfileString32W -387 stub GetQueuedCompletionStatus -388 stub GetSLCallbackTarget -389 stub GetSLCallbackTemplate -390 stdcall GetShortPathNameA(ptr ptr long) GetShortPathName32A -391 stdcall GetShortPathNameW(ptr ptr long) GetShortPathName32W -392 stdcall GetStartupInfoA(ptr) GetStartupInfo32A -393 stdcall GetStartupInfoW(ptr) GetStartupInfo32W -394 stdcall GetStdHandle(long) GetStdHandle -395 stdcall GetStringTypeA(long long ptr long ptr) GetStringType32A -396 stdcall GetStringTypeExA(long long ptr long ptr) GetStringTypeEx32A -397 stdcall GetStringTypeExW(long long ptr long ptr) GetStringTypeEx32W -398 stdcall GetStringTypeW(long ptr long ptr) GetStringType32W -399 stdcall GetSystemDefaultLCID() GetSystemDefaultLCID -400 stdcall GetSystemDefaultLangID() GetSystemDefaultLangID -401 stdcall GetSystemDirectoryA(ptr long) GetSystemDirectory32A -402 stdcall GetSystemDirectoryW(ptr long) GetSystemDirectory32W -403 stdcall GetSystemInfo(ptr) GetSystemInfo -404 stdcall GetSystemPowerStatus(ptr) GetSystemPowerStatus -405 stdcall GetSystemTime(ptr) GetSystemTime -406 stub GetSystemTimeAdjustment -407 stub GetSystemTimeAsFileTime -408 stub GetTapeParameters -409 stub GetTapePosition -410 stub GetTapeStatus -411 stdcall GetTempFileNameA(ptr ptr long ptr) GetTempFileName32A -412 stdcall GetTempFileNameW(ptr ptr long ptr) GetTempFileName32W -413 stdcall GetTempPathA(long ptr) GetTempPath32A -414 stdcall GetTempPathW(long ptr) GetTempPath32W -415 stdcall GetThreadContext(long ptr) GetThreadContext -416 stdcall GetThreadLocale() GetThreadLocale -417 stdcall GetThreadPriority(long) GetThreadPriority -418 stdcall GetThreadSelectorEntry(long long ptr) GetThreadSelectorEntry -419 stub GetThreadTimes -420 stdcall GetTickCount() GetTickCount -421 stub GetTimeFormatA -422 stub GetTimeFormatW -423 stdcall GetTimeZoneInformation(ptr) GetTimeZoneInformation -424 stdcall GetUserDefaultLCID() GetUserDefaultLCID -425 stdcall GetUserDefaultLangID() GetUserDefaultLangID -426 stdcall GetVersion() GetVersion32 -427 stdcall GetVersionExA(ptr) GetVersionEx32A -428 stdcall GetVersionExW(ptr) GetVersionEx32W -429 stdcall GetVolumeInformationA(ptr ptr long ptr ptr ptr ptr long) GetVolumeInformation32A -430 stdcall GetVolumeInformationW(ptr ptr long ptr ptr ptr ptr long) GetVolumeInformation32W -431 stdcall GetWindowsDirectoryA(ptr long) GetWindowsDirectory32A -432 stdcall GetWindowsDirectoryW(ptr long) GetWindowsDirectory32W -433 stdcall GlobalAddAtomA(ptr) GlobalAddAtom32A -434 stdcall GlobalAddAtomW(ptr) GlobalAddAtom32W -435 stdcall GlobalAlloc(long long) GlobalAlloc32 -436 stdcall GlobalCompact(long) GlobalCompact32 -437 stdcall GlobalDeleteAtom(long) GlobalDeleteAtom -438 stdcall GlobalFindAtomA(ptr) GlobalFindAtom32A -439 stdcall GlobalFindAtomW(ptr) GlobalFindAtom32W -440 stdcall GlobalFix(long) GlobalFix32 -441 stdcall GlobalFlags(long) GlobalFlags32 -442 stdcall GlobalFree(long) GlobalFree32 -443 stdcall GlobalGetAtomNameA(long ptr long) GlobalGetAtomName32A -444 stdcall GlobalGetAtomNameW(long ptr long) GlobalGetAtomName32W -445 stdcall GlobalHandle(ptr) GlobalHandle32 -446 stdcall GlobalLock(long) GlobalLock32 -447 stdcall GlobalMemoryStatus(ptr) GlobalMemoryStatus -448 stdcall GlobalReAlloc(long long long) GlobalReAlloc32 -449 stdcall GlobalSize(long) GlobalSize32 -450 stdcall GlobalUnWire(long) GlobalUnWire32 -451 stdcall GlobalUnfix(long) GlobalUnfix32 -452 stdcall GlobalUnlock(long) GlobalUnlock32 -453 stdcall GlobalWire(long) GlobalWire32 -454 stub Heap32First -455 stub Heap32ListFirst -456 stub Heap32ListNext -457 stub Heap32Next -458 stdcall HeapAlloc(long long long) HeapAlloc -459 stdcall HeapCompact(long long) HeapCompact -460 stdcall HeapCreate(long long long) HeapCreate -461 stdcall HeapDestroy(long) HeapDestroy -462 stdcall HeapFree(long long ptr) HeapFree -463 stdcall HeapLock(long) HeapLock -464 stdcall HeapReAlloc(long long ptr long) HeapReAlloc -465 stub HeapSetFlags -466 stdcall HeapSize(long long ptr) HeapSize -467 stdcall HeapUnlock(long) HeapUnlock -468 stdcall HeapValidate(long long ptr) HeapValidate -469 stdcall HeapWalk(long ptr) HeapWalk -470 stub InitAtomTable -471 stdcall InitializeCriticalSection(ptr) InitializeCriticalSection -472 stdcall InterlockedDecrement(ptr) InterlockedDecrement -473 stdcall InterlockedExchange(ptr long) InterlockedExchange -474 stdcall InterlockedIncrement(ptr) InterlockedIncrement -475 stub InvalidateNLSCache -476 stdcall IsBadCodePtr(ptr) IsBadCodePtr32 -477 stdcall IsBadHugeReadPtr(ptr long) IsBadHugeReadPtr32 -478 stdcall IsBadHugeWritePtr(ptr long) IsBadHugeWritePtr32 -479 stdcall IsBadReadPtr(ptr long) IsBadReadPtr32 -480 stdcall IsBadStringPtrA(ptr long) IsBadStringPtr32A -481 stdcall IsBadStringPtrW(ptr long) IsBadStringPtr32W -482 stdcall IsBadWritePtr(ptr long) IsBadWritePtr32 -483 stdcall IsDBCSLeadByte(long) IsDBCSLeadByte32 -484 stdcall IsDBCSLeadByteEx(long long) IsDBCSLeadByteEx -485 stub IsLSCallback -486 stub IsSLCallback -487 stdcall IsValidCodePage(long) IsValidCodePage -488 stdcall IsValidLocale(long long) IsValidLocale -489 stub K32Thk1632Epilog -490 stub K32Thk1632Prolog -491 stub LCMapStringA -492 stub LCMapStringW -493 stdcall LeaveCriticalSection(ptr) LeaveCriticalSection -494 stdcall LoadLibraryA(ptr) LoadLibrary32A -495 stdcall LoadLibraryExA(ptr long long) LoadLibraryEx32A -496 stub LoadLibraryExW -497 stdcall LoadLibraryW(ptr) LoadLibrary32W -498 stub LoadModule -499 stdcall LoadResource(long long) LoadResource32 -500 stdcall LocalAlloc(long long) LocalAlloc32 -501 stdcall LocalCompact(long) LocalCompact32 -502 stdcall LocalFileTimeToFileTime(ptr ptr) LocalFileTimeToFileTime -503 stdcall LocalFlags(long) LocalFlags32 -504 stdcall LocalFree(long) LocalFree32 -505 stdcall LocalHandle(ptr) LocalHandle32 -506 stdcall LocalLock(long) LocalLock32 -507 stdcall LocalReAlloc(long long long) LocalReAlloc32 -508 stdcall LocalShrink(long long) LocalShrink32 -509 stdcall LocalSize(long) LocalSize32 -510 stdcall LocalUnlock(long) LocalUnlock32 -511 stdcall LockFile(long long long long long) LockFile -512 stub LockFileEx -513 stdcall LockResource(long) LockResource32 -514 stdcall MakeCriticalSectionGlobal(ptr) MakeCriticalSectionGlobal -515 stub MapHInstLS -516 stub MapHInstLS_PN -517 stub MapHInstSL -518 stub MapHInstSL_PN -519 stub MapHModuleLS -520 stub MapHModuleSL -521 stdcall MapLS(ptr) MapLS -522 stdcall MapSL(long) MapSL -523 stub MapSLFix -524 stdcall MapViewOfFile(long long long long long) MapViewOfFile -525 stdcall MapViewOfFileEx(long long long long long ptr) MapViewOfFileEx -526 stub Module32First -527 stub Module32Next -528 stdcall MoveFileA(ptr ptr) MoveFile32A -529 stdcall MoveFileExA(ptr ptr long) MoveFileEx32A -530 stdcall MoveFileExW(ptr ptr long) MoveFileEx32W -531 stdcall MoveFileW(ptr ptr) MoveFile32W -532 stdcall MulDiv(long long long) MulDiv32 -533 stdcall MultiByteToWideChar(long long ptr long ptr long) MultiByteToWideChar -534 stub NotifyNLSUserCache -535 stdcall OpenEventA(long long ptr) OpenEvent32A -536 stdcall OpenEventW(long long ptr) OpenEvent32W -537 stdcall OpenFile(ptr ptr long) OpenFile32 -538 stdcall OpenFileMappingA(long long ptr) OpenFileMapping32A -539 stdcall OpenFileMappingW(long long ptr) OpenFileMapping32W -540 stdcall OpenMutexA(long long ptr) OpenMutex32A -541 stdcall OpenMutexW(long long ptr) OpenMutex32W -542 stub OpenProcess -543 stub OpenProfileUserMapping -544 stdcall OpenSemaphoreA(long long ptr) OpenSemaphore32A -545 stdcall OpenSemaphoreW(long long ptr) OpenSemaphore32W -546 stub OpenVxDHandle -547 stdcall OutputDebugStringA(ptr) OutputDebugString32A -548 stdcall OutputDebugStringW(ptr) OutputDebugString32W -549 stub PeekConsoleInputA -550 stub PeekConsoleInputW -551 stub PeekNamedPipe -552 stub PostQueuedCompletionStatus -553 stub PrepareTape -554 stub Process32First -555 stub Process32Next -556 stub PulseEvent -557 stub PurgeComm -558 register QT_Thunk() QT_Thunk -559 stdcall QueryDosDeviceA(ptr ptr long) QueryDosDevice32A -560 stdcall QueryDosDeviceW(ptr ptr long) QueryDosDevice32W -561 stub QueryNumberOfEventLogRecords -562 stub QueryOldestEventLogRecord -563 stdcall QueryPerformanceCounter(ptr) QueryPerformanceCounter -564 stub QueryPerformanceFrequency -565 stub QueueUserAPC -566 register RaiseException(long long long ptr) RaiseException -567 stdcall ReadConsoleA(long ptr long ptr ptr) ReadConsole32A -568 stub ReadConsoleInputA -569 stub ReadConsoleInputW -570 stub ReadConsoleOutputA -571 stub ReadConsoleOutputAttribute -572 stub ReadConsoleOutputCharacterA -573 stub ReadConsoleOutputCharacterW -574 stub ReadConsoleOutputW -575 stdcall ReadConsoleW(long ptr long ptr ptr) ReadConsole32W -576 stdcall ReadFile(long ptr long ptr ptr) ReadFile -577 stub ReadFileEx -578 stdcall ReadProcessMemory(long ptr ptr long ptr) ReadProcessMemory -579 stub RegisterServiceProcess -580 stdcall ReinitializeCriticalSection(ptr) ReinitializeCriticalSection -581 stdcall ReleaseMutex(long) ReleaseMutex -582 stdcall ReleaseSemaphore(long long ptr) ReleaseSemaphore -583 stdcall RemoveDirectoryA(ptr) RemoveDirectory32A -584 stdcall RemoveDirectoryW(ptr) RemoveDirectory32W -585 stdcall ResetEvent(long) ResetEvent -586 stub ResumeThread -587 stdcall RtlFillMemory(ptr long long) RtlFillMemory -588 stdcall RtlMoveMemory(ptr ptr long) RtlMoveMemory -589 register RtlUnwind(ptr long ptr long) RtlUnwind -590 stdcall RtlZeroMemory(ptr long) RtlZeroMemory -591 register SMapLS() SMapLS -592 register SMapLS_IP_EBP_12() SMapLS_IP_EBP_12 -593 register SMapLS_IP_EBP_16() SMapLS_IP_EBP_16 -594 register SMapLS_IP_EBP_20() SMapLS_IP_EBP_20 -595 register SMapLS_IP_EBP_24() SMapLS_IP_EBP_24 -596 register SMapLS_IP_EBP_28() SMapLS_IP_EBP_28 -597 register SMapLS_IP_EBP_32() SMapLS_IP_EBP_32 -598 register SMapLS_IP_EBP_36() SMapLS_IP_EBP_36 -599 register SMapLS_IP_EBP_40() SMapLS_IP_EBP_40 -600 register SMapLS_IP_EBP_8() SMapLS_IP_EBP_8 -601 stub SUnMapLS -602 stub SUnMapLS_IP_EBP_12 -603 stub SUnMapLS_IP_EBP_16 -604 stub SUnMapLS_IP_EBP_20 -605 stub SUnMapLS_IP_EBP_24 -606 stub SUnMapLS_IP_EBP_28 -607 stub SUnMapLS_IP_EBP_32 -608 stub SUnMapLS_IP_EBP_36 -609 stub SUnMapLS_IP_EBP_40 -610 stub SUnMapLS_IP_EBP_8 -611 stub ScrollConsoleScreenBufferA -612 stub ScrollConsoleScreenBufferW -613 stdcall SearchPathA(ptr ptr ptr long ptr ptr) SearchPath32A -614 stdcall SearchPathW(ptr ptr ptr long ptr ptr) SearchPath32W -615 stdcall SetCommBreak(long) SetCommBreak32 -616 stub SetCommConfig -617 stdcall SetCommMask(long ptr) SetCommMask -618 stdcall SetCommState(long ptr) SetCommState32 -619 stdcall SetCommTimeouts(long ptr) SetCommTimeouts -620 stub SetComputerNameA -621 stub SetComputerNameW -622 stub SetConsoleActiveScreenBuffer -623 stub SetConsoleCP -624 stdcall SetConsoleCtrlHandler(ptr long) SetConsoleCtrlHandler -625 stub SetConsoleCursorInfo -626 stdcall SetConsoleCursorPosition(long long) SetConsoleCursorPosition -627 stdcall SetConsoleMode(long long) SetConsoleMode -628 stub SetConsoleOutputCP -629 stub SetConsoleScreenBufferSize -630 stub SetConsoleTextAttribute -631 stdcall SetConsoleTitleA(ptr) SetConsoleTitle32A -632 stdcall SetConsoleTitleW(ptr) SetConsoleTitle32W -633 stub SetConsoleWindowInfo -634 stdcall SetCurrentDirectoryA(ptr) SetCurrentDirectory32A -635 stdcall SetCurrentDirectoryW(ptr) SetCurrentDirectory32W -636 stub SetDaylightFlag -637 stub SetDefaultCommConfigA -638 stub SetDefaultCommConfigW -639 stdcall SetEndOfFile(long) SetEndOfFile -640 stdcall SetEnvironmentVariableA(ptr ptr) SetEnvironmentVariable32A -641 stdcall SetEnvironmentVariableW(ptr ptr) SetEnvironmentVariable32W -642 stdcall SetErrorMode(long) SetErrorMode32 -643 stdcall SetEvent(long) SetEvent -644 stdcall SetFileApisToANSI() SetFileApisToANSI -645 stdcall SetFileApisToOEM() SetFileApisToOEM -646 stdcall SetFileAttributesA(ptr long) SetFileAttributes32A -647 stdcall SetFileAttributesW(ptr long) SetFileAttributes32W -648 stdcall SetFilePointer(long long ptr long) SetFilePointer -649 stdcall SetFileTime(long ptr ptr ptr) SetFileTime -650 stub SetHandleContext -651 stdcall SetHandleCount(long) SetHandleCount32 -652 stub SetHandleInformation -653 stdcall SetLastError(long) SetLastError -654 stub SetLocalTime -655 stdcall SetLocaleInfoA(long long ptr) SetLocaleInfoA -656 stub SetLocaleInfoW -657 stub SetMailslotInfo -658 stub SetNamedPipeHandleState -659 stdcall SetPriorityClass(long long) SetPriorityClass -660 stdcall SetProcessShutdownParameters(long long) SetProcessShutdownParameters -661 stdcall SetProcessWorkingSetSize(long long long) SetProcessWorkingSetSize -662 stdcall SetStdHandle(long long) SetStdHandle -663 stdcall SetSystemPowerState(long long) SetSystemPowerState -664 stdcall SetSystemTime(ptr) SetSystemTime -665 stub SetSystemTimeAdjustment -666 stub SetTapeParameters -667 stub SetTapePosition -668 stdcall SetThreadAffinityMask(long long) SetThreadAffinityMask -669 stub SetThreadContext -670 stub SetThreadLocale -671 stdcall SetThreadPriority(long long) SetThreadPriority -672 stdcall SetTimeZoneInformation(ptr) SetTimeZoneInformation -673 stdcall SetUnhandledExceptionFilter(ptr) THUNK_SetUnhandledExceptionFilter -674 stub SetVolumeLabelA -675 stub SetVolumeLabelW -676 stub SetupComm -677 stdcall SizeofResource(long long) SizeofResource32 -678 stdcall Sleep(long) Sleep -679 stub SleepEx -680 stub SuspendThread -681 stdcall SystemTimeToFileTime(ptr ptr) SystemTimeToFileTime -682 stub SystemTimeToTzSpecificLocalTime -683 stub TerminateProcess -684 stdcall TerminateThread(long long) TerminateThread -685 stub Thread32First -686 stub Thread32Next -687 stdcall ThunkConnect32(ptr ptr ptr ptr ptr ptr) ThunkConnect32 -688 stdcall TlsAlloc() TlsAlloc -689 stub TlsAllocInternal -690 stdcall TlsFree(long) TlsFree -691 stub TlsFreeInternal -692 stdcall TlsGetValue(long) TlsGetValue -693 stdcall TlsSetValue(long ptr) TlsSetValue -694 stub Toolhelp32ReadProcessMemory -695 stub TransactNamedPipe -696 stdcall TransmitCommChar(long long) TransmitCommChar32 -697 stub UTRegister -698 stub UTUnRegister -699 stdcall UnMapLS(long) UnMapLS -700 stub UnMapSLFixArray -701 stdcall UnhandledExceptionFilter(ptr) UnhandledExceptionFilter -702 stub UninitializeCriticalSection -703 stdcall UnlockFile(long long long long long) UnlockFile -704 stub UnlockFileEx -705 stdcall UnmapViewOfFile(ptr) UnmapViewOfFile -706 stub UpdateResourceA -707 stub UpdateResourceW -708 stub VerLanguageNameA -709 stub VerLanguageNameW -710 stdcall VirtualAlloc(ptr long long long) VirtualAlloc -711 stdcall VirtualFree(ptr long long) VirtualFree -712 stdcall VirtualLock(ptr long) VirtualLock -713 stdcall VirtualProtect(ptr long long ptr) VirtualProtect -714 stdcall VirtualProtectEx(long ptr long long ptr) VirtualProtectEx -715 stdcall VirtualQuery(ptr ptr long) VirtualQuery -716 stdcall VirtualQueryEx(long ptr ptr long) VirtualQueryEx -717 stdcall VirtualUnlock(ptr long) VirtualUnlock -718 stub WaitCommEvent -719 stub WaitForDebugEvent -720 stub WaitForMultipleObjects -721 stub WaitForMultipleObjectsEx -722 stdcall WaitForSingleObject(long long) WaitForSingleObject -723 stdcall WaitForSingleObjectEx(long long long) WaitForSingleObjectEx -724 stub WaitNamedPipeA -725 stub WaitNamedPipeW -726 stdcall WideCharToMultiByte(long long ptr long ptr long ptr ptr) WideCharToMultiByte -727 stdcall WinExec(ptr long) WinExec32 -728 stdcall WriteConsoleA(long ptr long ptr ptr) WriteConsole32A -729 stub WriteConsoleInputA -730 stub WriteConsoleInputW -731 stub WriteConsoleOutputA -732 stub WriteConsoleOutputAttribute -733 stub WriteConsoleOutputCharacterA -734 stub WriteConsoleOutputCharacterW -735 stub WriteConsoleOutputW -736 stdcall WriteConsoleW(long ptr long ptr ptr) WriteConsole32W -737 stdcall WriteFile(long ptr long ptr ptr) WriteFile -738 stub WriteFileEx -739 stub WritePrivateProfileSectionA -740 stub WritePrivateProfileSectionW -741 stdcall WritePrivateProfileStringA(ptr ptr ptr ptr) WritePrivateProfileString32A -742 stdcall WritePrivateProfileStringW(ptr ptr ptr ptr) WritePrivateProfileString32W -743 stub WritePrivateProfileStructA -744 stub WritePrivateProfileStructW -745 stub WriteProcessMemory -746 stub WriteProfileSectionA -747 stub WriteProfileSectionW -748 stdcall WriteProfileStringA(ptr ptr ptr) WriteProfileString32A -749 stdcall WriteProfileStringW(ptr ptr ptr) WriteProfileString32W -750 stub WriteTapemark -751 stub _DebugOut -752 stub _DebugPrintf -753 stdcall _hread(long ptr long) _hread32 -754 stdcall _hwrite(long ptr long) _hwrite32 -755 stdcall _lclose(long) _lclose32 -756 stdcall _lcreat(ptr long) _lcreat32 -757 stdcall _llseek(long long long) _llseek32 -758 stdcall _lopen(ptr long) _lopen32 -759 stdcall _lread(long ptr long) _lread32 -760 stdcall _lwrite(long ptr long) _lwrite32 -761 stub dprintf -762 stdcall lstrcat(ptr ptr) lstrcat32A -763 stdcall lstrcatA(ptr ptr) lstrcat32A -764 stdcall lstrcatW(ptr ptr) lstrcat32W -765 stdcall lstrcmp(ptr ptr) lstrcmp32A -766 stdcall lstrcmpA(ptr ptr) lstrcmp32A -767 stdcall lstrcmpW(ptr ptr) lstrcmp32W -768 stdcall lstrcmpi(ptr ptr) lstrcmpi32A -769 stdcall lstrcmpiA(ptr ptr) lstrcmpi32A -770 stdcall lstrcmpiW(ptr ptr) lstrcmpi32W -771 stdcall lstrcpy(ptr ptr) lstrcpy32A -772 stdcall lstrcpyA(ptr ptr) lstrcpy32A -773 stdcall lstrcpyW(ptr ptr) lstrcpy32W -774 stdcall lstrcpyn(ptr ptr long) lstrcpyn32A -775 stdcall lstrcpynA(ptr ptr long) lstrcpyn32A -776 stdcall lstrcpynW(ptr ptr long) lstrcpyn32W -777 stdcall lstrlen(ptr) lstrlen32A -778 stdcall lstrlenA(ptr) lstrlen32A -779 stdcall lstrlenW(ptr) lstrlen32W +102 stdcall AddAtomW(ptr) AddAtom32W +103 stub AllocConsole +104 stub AllocLSCallback +105 stub AllocSLCallback +106 stdcall AreFileApisANSI() AreFileApisANSI +107 stub BackupRead +108 stub BackupSeek +109 stub BackupWrite +110 stdcall Beep(long long) Beep +111 stub BeginUpdateResourceA +112 stub BeginUpdateResourceW +113 stdcall BuildCommDCBA(ptr ptr) BuildCommDCB32A +114 stdcall BuildCommDCBAndTimeoutsA(ptr ptr ptr) BuildCommDCBAndTimeouts32A +115 stdcall BuildCommDCBAndTimeoutsW(ptr ptr ptr) BuildCommDCBAndTimeouts32W +116 stdcall BuildCommDCBW(ptr ptr) BuildCommDCB32W +117 stub CallNamedPipeA +118 stub CallNamedPipeW +119 stub Callback12 +120 stub Callback16 +121 stub Callback20 +122 stub Callback24 +123 stub Callback28 +124 stub Callback32 +125 stub Callback36 +126 stub Callback40 +127 stub Callback44 +128 stub Callback48 +129 stub Callback4 +130 stub Callback52 +131 stub Callback56 +132 stub Callback60 +133 stub Callback64 +134 stub Callback8 +135 stdcall ClearCommBreak(long) ClearCommBreak32 +136 stdcall ClearCommError(long ptr ptr) ClearCommError +137 stdcall CloseHandle(long) CloseHandle +138 stub CloseProfileUserMapping +139 stub CloseSystemHandle +140 stub CommConfigDialogA +141 stub CommConfigDialogW +142 stdcall CompareFileTime(ptr ptr) CompareFileTime +143 stdcall CompareStringA(long long ptr long ptr long) CompareString32A +144 stdcall CompareStringW(long long ptr long ptr long) CompareString32W +145 stub ConnectNamedPipe +146 stdcall ContinueDebugEvent(long long long) ContinueDebugEvent +147 stub ConvertDefaultLocale +148 stdcall ConvertToGlobalHandle(long) ConvertToGlobalHandle +149 stdcall CopyFileA(ptr ptr long) CopyFile32A +150 stdcall CopyFileW(ptr ptr long) CopyFile32W +151 stub CreateConsoleScreenBuffer +152 stdcall CreateDirectoryA(ptr ptr) CreateDirectory32A +153 stdcall CreateDirectoryExA(ptr ptr ptr) CreateDirectoryEx32A +154 stdcall CreateDirectoryExW(ptr ptr ptr) CreateDirectoryEx32W +155 stdcall CreateDirectoryW(ptr ptr) CreateDirectory32W +156 stdcall CreateEventA(ptr long long ptr) CreateEvent32A +157 stdcall CreateEventW(ptr long long ptr) CreateEvent32W +158 stdcall CreateFileA(ptr long long ptr long long long) CreateFile32A +159 stdcall CreateFileMappingA(long ptr long long long ptr) CreateFileMapping32A +160 stdcall CreateFileMappingW(long ptr long long long ptr) CreateFileMapping32W +161 stdcall CreateFileW(ptr long long ptr long long long) CreateFile32W +162 stub CreateIoCompletionPort +163 stub CreateKernelThread +164 stub CreateMailslotA +165 stub CreateMailslotW +166 stdcall CreateMutexA(ptr long ptr) CreateMutex32A +167 stdcall CreateMutexW(ptr long ptr) CreateMutex32W +168 stub CreateNamedPipeA +169 stub CreateNamedPipeW +170 stub CreatePipe +171 stdcall CreateProcessA(ptr ptr ptr ptr long long ptr ptr ptr ptr) CreateProcess32A +172 stub CreateProcessW +173 stub CreateRemoteThread +174 stdcall CreateSemaphoreA(ptr long long ptr) CreateSemaphore32A +175 stdcall CreateSemaphoreW(ptr long long ptr) CreateSemaphore32W +176 stub CreateSocketHandle +177 stub CreateTapePartition +178 stdcall CreateThread(ptr long ptr long long ptr) CreateThread +179 stub CreateToolhelp32Snapshot +180 stub DebugActiveProcess +181 register DebugBreak() DebugBreak32 +182 stub DefineDosDeviceA +183 stub DefineDosDeviceW +184 stdcall DeleteAtom(long) DeleteAtom32 +185 stdcall DeleteCriticalSection(ptr) DeleteCriticalSection +186 stdcall DeleteFileA(ptr) DeleteFile32A +187 stdcall DeleteFileW(ptr) DeleteFile32W +188 stub DeviceIoControl +189 stdcall DisableThreadLibraryCalls(long) DisableThreadLibraryCalls +190 stub DisconnectNamedPipe +191 stdcall DosDateTimeToFileTime(long long ptr) DosDateTimeToFileTime +192 stdcall DuplicateHandle(long long long ptr long long long) DuplicateHandle +193 stub EndUpdateResourceA +194 stub EndUpdateResourceW +195 stdcall EnterCriticalSection(ptr) EnterCriticalSection +196 stub EnumCalendarInfoA +197 stub EnumCalendarInfoW +198 stub EnumDateFormatsA +199 stub EnumDateFormatsW +200 stdcall EnumResourceLanguagesA(long ptr ptr ptr long) EnumResourceLanguages32A +201 stdcall EnumResourceLanguagesW(long ptr ptr ptr long) EnumResourceLanguages32W +202 stdcall EnumResourceNamesA(long ptr ptr long) EnumResourceNames32A +203 stdcall EnumResourceNamesW(long ptr ptr long) EnumResourceNames32W +204 stdcall EnumResourceTypesA(long ptr long) EnumResourceTypes32A +205 stdcall EnumResourceTypesW(long ptr long) EnumResourceTypes32W +206 stdcall EnumSystemCodePagesA(ptr long) EnumSystemCodePages32A +207 stdcall EnumSystemCodePagesW(ptr long) EnumSystemCodePages32W +208 stdcall EnumSystemLocalesA(ptr long) EnumSystemLocales32A +209 stdcall EnumSystemLocalesW(ptr long) EnumSystemLocales32W +210 stub EnumTimeFormatsA +211 stub EnumTimeFormatsW +212 stub EraseTape +213 stdcall EscapeCommFunction(long long) EscapeCommFunction32 +214 stdcall ExitProcess(long) ExitProcess +215 stub ExitThread +216 stdcall ExpandEnvironmentStringsA(ptr ptr long) ExpandEnvironmentStrings32A +217 stdcall ExpandEnvironmentStringsW(ptr ptr long) ExpandEnvironmentStrings32W +218 stub FT_Exit0 +219 stub FT_Exit12 +220 stub FT_Exit16 +221 stub FT_Exit20 +222 stub FT_Exit24 +223 stub FT_Exit28 +224 stub FT_Exit32 +225 stub FT_Exit36 +227 stub FT_Exit40 +228 stub FT_Exit44 +229 stub FT_Exit48 +226 stub FT_Exit4 +230 stub FT_Exit52 +231 stub FT_Exit56 +232 stub FT_Exit8 +233 stub FT_Prolog +234 stub FT_Thunk +235 stdcall FatalAppExitA(long ptr) FatalAppExit32A +236 stdcall FatalAppExitW(long ptr) FatalAppExit32W +237 stub FatalExit +238 stdcall FileTimeToDosDateTime(ptr ptr ptr) FileTimeToDosDateTime +239 stdcall FileTimeToLocalFileTime(ptr ptr) FileTimeToLocalFileTime +240 stdcall FileTimeToSystemTime(ptr ptr) FileTimeToSystemTime +241 stub FillConsoleOutputAttribute +242 stub FillConsoleOutputCharacterA +243 stub FillConsoleOutputCharacterW +244 stdcall FindAtomA(ptr) FindAtom32A +245 stdcall FindAtomW(ptr) FindAtom32W +247 stub FindCloseChangeNotification +246 stdcall FindClose(long) FindClose32 +248 stub FindFirstChangeNotificationA +249 stub FindFirstChangeNotificationW +250 stdcall FindFirstFileA(ptr ptr) FindFirstFile32A +251 stdcall FindFirstFileW(ptr ptr) FindFirstFile32W +252 stub FindNextChangeNotification +253 stdcall FindNextFileA(long ptr) FindNextFile32A +254 stdcall FindNextFileW(long ptr) FindNextFile32W +255 stdcall FindResourceA(long ptr ptr) FindResource32A +256 stdcall FindResourceExA(long ptr ptr long) FindResourceEx32A +257 stdcall FindResourceExW(long ptr ptr long) FindResourceEx32W +258 stdcall FindResourceW(long ptr ptr) FindResource32W +259 stdcall FlushConsoleInputBuffer(long) FlushConsoleInputBuffer +260 stdcall FlushFileBuffers(long) FlushFileBuffers +261 stub FlushInstructionCache +262 stub FlushViewOfFile +263 stub FoldStringA +264 stub FoldStringW +265 stdcall FormatMessageA(long ptr long long ptr long ptr) FormatMessage32A +266 stdcall FormatMessageW(long ptr long long ptr long ptr) FormatMessage32W +267 stub FreeConsole +268 stdcall FreeEnvironmentStringsA(ptr) FreeEnvironmentStrings32A +269 stdcall FreeEnvironmentStringsW(ptr) FreeEnvironmentStrings32W +270 stub FreeLSCallback +272 stub FreeLibraryAndExitThread +271 stdcall FreeLibrary(long) FreeLibrary32 +273 stdcall FreeResource(long) FreeResource32 +274 stub FreeSLCallback +275 stub GenerateConsoleCtrlEvent +276 stdcall GetACP() GetACP +277 stdcall GetAtomNameA(long ptr long) GetAtomName32A +278 stdcall GetAtomNameW(long ptr long) GetAtomName32W +279 stub GetBinaryType +280 stub GetBinaryTypeA +281 stub GetBinaryTypeW +282 stdcall GetCPInfo(long ptr) GetCPInfo +283 stub GetCommConfig +284 stdcall GetCommMask(long ptr) GetCommMask +285 stub GetCommModemStatus +286 stub GetCommProperties +287 stdcall GetCommState(long ptr) GetCommState32 +288 stdcall GetCommTimeouts(long ptr) GetCommTimeouts +289 stdcall GetCommandLineA() GetCommandLine32A +290 stdcall GetCommandLineW() GetCommandLine32W +291 stub GetCompressedFileSizeA +292 stub GetCompressedFileSizeW +293 stdcall GetComputerNameA(ptr ptr) GetComputerName32A +294 stdcall GetComputerNameW(ptr ptr) GetComputerName32W +295 stdcall GetConsoleCP() GetConsoleCP +296 stub GetConsoleCursorInfo +297 stdcall GetConsoleMode(long ptr) GetConsoleMode +298 stdcall GetConsoleOutputCP() GetConsoleOutputCP +299 stdcall GetConsoleScreenBufferInfo(long ptr) GetConsoleScreenBufferInfo +300 stdcall GetConsoleTitleA(ptr long) GetConsoleTitle32A +301 stdcall GetConsoleTitleW(ptr long) GetConsoleTitle32W +302 stub GetCurrencyFormatA +303 stub GetCurrencyFormatW +304 stdcall GetCurrentDirectoryA(long ptr) GetCurrentDirectory32A +305 stdcall GetCurrentDirectoryW(long ptr) GetCurrentDirectory32W +306 stdcall GetCurrentProcess() GetCurrentProcess +307 stdcall GetCurrentProcessId() GetCurrentProcessId +308 stdcall GetCurrentThread() GetCurrentThread +309 stdcall GetCurrentThreadId() GetCurrentThreadId +310 stub GetDateFormatA +311 stub GetDateFormatW +312 stub GetDaylightFlag +313 stub GetDefaultCommConfigA +314 stub GetDefaultCommConfigW +315 stdcall GetDiskFreeSpaceA(ptr ptr ptr ptr ptr) GetDiskFreeSpace32A +316 stdcall GetDiskFreeSpaceW(ptr ptr ptr ptr ptr) GetDiskFreeSpace32W +317 stdcall GetDriveTypeA(ptr) GetDriveType32A +318 stdcall GetDriveTypeW(ptr) GetDriveType32W +320 stdcall GetEnvironmentStringsA() GetEnvironmentStrings32A +321 stdcall GetEnvironmentStringsW() GetEnvironmentStrings32W +319 stdcall GetEnvironmentStrings() GetEnvironmentStrings32A +322 stdcall GetEnvironmentVariableA(ptr ptr long) GetEnvironmentVariable32A +323 stdcall GetEnvironmentVariableW(ptr ptr long) GetEnvironmentVariable32W +324 stub GetErrorMode +325 stub GetExitCodeProcess +326 stdcall GetExitCodeThread(long ptr) GetExitCodeThread +327 stdcall GetFileAttributesA(ptr) GetFileAttributes32A +328 stdcall GetFileAttributesW(ptr) GetFileAttributes32W +329 stdcall GetFileInformationByHandle(long ptr) GetFileInformationByHandle +330 stdcall GetFileSize(long ptr) GetFileSize +331 stdcall GetFileTime(long ptr ptr ptr) GetFileTime +332 stdcall GetFileType(long) GetFileType +333 stdcall GetFullPathNameA(ptr long ptr ptr) GetFullPathName32A +334 stdcall GetFullPathNameW(ptr long ptr ptr) GetFullPathName32W +335 stub GetHandleContext +336 stub GetHandleInformation +337 stub GetLSCallbackTarget +338 stub GetLSCallbackTemplate +339 stdcall GetLargestConsoleWindowSize(long) GetLargestConsoleWindowSize +340 stdcall GetLastError() GetLastError +341 stdcall GetLocalTime(ptr) GetLocalTime +342 stdcall GetLocaleInfoA(long long ptr long) GetLocaleInfo32A +343 stdcall GetLocaleInfoW(long long ptr long) GetLocaleInfo32W +344 stdcall GetLogicalDriveStringsA(long ptr) GetLogicalDriveStrings32A +345 stdcall GetLogicalDriveStringsW(long ptr) GetLogicalDriveStrings32W +346 stdcall GetLogicalDrives() GetLogicalDrives +347 stub GetMailslotInfo +348 stdcall GetModuleFileNameA(long ptr long) GetModuleFileName32A +349 stdcall GetModuleFileNameW(long ptr long) GetModuleFileName32W +350 stdcall GetModuleHandleA(ptr) GetModuleHandle32A +351 stdcall GetModuleHandleW(ptr) GetModuleHandle32W +352 stub GetNamedPipeHandleStateA +353 stub GetNamedPipeHandleStateW +354 stub GetNamedPipeInfo +355 stub GetNumberFormatA +356 stub GetNumberFormatW +357 stdcall GetNumberOfConsoleInputEvents(long ptr) GetNumberOfConsoleInputEvents +358 stub GetNumberOfConsoleMouseButtons +359 stdcall GetOEMCP() GetOEMCP +360 stub GetOverlappedResult +361 stdcall GetPriorityClass(long) GetPriorityClass +362 stdcall GetPrivateProfileIntA(ptr ptr long ptr) GetPrivateProfileInt32A +363 stdcall GetPrivateProfileIntW(ptr ptr long ptr) GetPrivateProfileInt32W +364 stdcall GetPrivateProfileSectionA(ptr ptr long ptr) GetPrivateProfileSection32A +365 stub GetPrivateProfileSectionNamesA +366 stub GetPrivateProfileSectionNamesW +367 stub GetPrivateProfileSectionW +368 stdcall GetPrivateProfileStringA(ptr ptr ptr ptr long ptr) GetPrivateProfileString32A +369 stdcall GetPrivateProfileStringW(ptr ptr ptr ptr long ptr) GetPrivateProfileString32W +370 stub GetPrivateProfileStructA +371 stub GetPrivateProfileStructW +372 stdcall GetProcAddress(long ptr) GetProcAddress32 +373 stdcall GetProcessAffinityMask(long ptr ptr) GetProcessAffinityMask +374 stub GetProcessFlags +375 stdcall GetProcessHeap() GetProcessHeap +376 stub GetProcessHeaps +377 stub GetProcessShutdownParameters +378 stdcall GetProcessTimes(long ptr ptr ptr ptr) GetProcessTimes +379 stdcall GetProcessVersion(long) GetProcessVersion +380 stdcall GetProcessWorkingSetSize(long ptr ptr) GetProcessWorkingSetSize +381 stub GetProductName +382 stdcall GetProfileIntA(ptr ptr long) GetProfileInt32A +383 stdcall GetProfileIntW(ptr ptr long) GetProfileInt32W +384 stdcall GetProfileSectionA(ptr ptr long) GetProfileSection32A +385 stub GetProfileSectionW +386 stdcall GetProfileStringA(ptr ptr ptr ptr long) GetProfileString32A +387 stdcall GetProfileStringW(ptr ptr ptr ptr long) GetProfileString32W +388 stub GetQueuedCompletionStatus +389 stub GetSLCallbackTarget +390 stub GetSLCallbackTemplate +391 stdcall GetShortPathNameA(ptr ptr long) GetShortPathName32A +392 stdcall GetShortPathNameW(ptr ptr long) GetShortPathName32W +393 stdcall GetStartupInfoA(ptr) GetStartupInfo32A +394 stdcall GetStartupInfoW(ptr) GetStartupInfo32W +395 stdcall GetStdHandle(long) GetStdHandle +396 stdcall GetStringTypeA(long long ptr long ptr) GetStringType32A +397 stdcall GetStringTypeExA(long long ptr long ptr) GetStringTypeEx32A +398 stdcall GetStringTypeExW(long long ptr long ptr) GetStringTypeEx32W +399 stdcall GetStringTypeW(long ptr long ptr) GetStringType32W +400 stdcall GetSystemDefaultLCID() GetSystemDefaultLCID +401 stdcall GetSystemDefaultLangID() GetSystemDefaultLangID +402 stdcall GetSystemDirectoryA(ptr long) GetSystemDirectory32A +403 stdcall GetSystemDirectoryW(ptr long) GetSystemDirectory32W +404 stdcall GetSystemInfo(ptr) GetSystemInfo +405 stdcall GetSystemPowerStatus(ptr) GetSystemPowerStatus +406 stdcall GetSystemTime(ptr) GetSystemTime +407 stub GetSystemTimeAdjustment +408 stub GetSystemTimeAsFileTime +409 stub GetTapeParameters +410 stub GetTapePosition +411 stub GetTapeStatus +412 stdcall GetTempFileNameA(ptr ptr long ptr) GetTempFileName32A +413 stdcall GetTempFileNameW(ptr ptr long ptr) GetTempFileName32W +414 stdcall GetTempPathA(long ptr) GetTempPath32A +415 stdcall GetTempPathW(long ptr) GetTempPath32W +416 stdcall GetThreadContext(long ptr) GetThreadContext +417 stdcall GetThreadLocale() GetThreadLocale +418 stdcall GetThreadPriority(long) GetThreadPriority +419 stdcall GetThreadSelectorEntry(long long ptr) GetThreadSelectorEntry +420 stub GetThreadTimes +421 stdcall GetTickCount() GetTickCount +422 stub GetTimeFormatA +423 stub GetTimeFormatW +424 stdcall GetTimeZoneInformation(ptr) GetTimeZoneInformation +425 stdcall GetUserDefaultLCID() GetUserDefaultLCID +426 stdcall GetUserDefaultLangID() GetUserDefaultLangID +427 stdcall GetVersion() GetVersion32 +428 stdcall GetVersionExA(ptr) GetVersionEx32A +429 stdcall GetVersionExW(ptr) GetVersionEx32W +430 stdcall GetVolumeInformationA(ptr ptr long ptr ptr ptr ptr long) GetVolumeInformation32A +431 stdcall GetVolumeInformationW(ptr ptr long ptr ptr ptr ptr long) GetVolumeInformation32W +432 stdcall GetWindowsDirectoryA(ptr long) GetWindowsDirectory32A +433 stdcall GetWindowsDirectoryW(ptr long) GetWindowsDirectory32W +434 stdcall GlobalAddAtomA(ptr) GlobalAddAtom32A +435 stdcall GlobalAddAtomW(ptr) GlobalAddAtom32W +436 stdcall GlobalAlloc(long long) GlobalAlloc32 +437 stdcall GlobalCompact(long) GlobalCompact32 +438 stdcall GlobalDeleteAtom(long) GlobalDeleteAtom +439 stdcall GlobalFindAtomA(ptr) GlobalFindAtom32A +440 stdcall GlobalFindAtomW(ptr) GlobalFindAtom32W +441 stdcall GlobalFix(long) GlobalFix32 +442 stdcall GlobalFlags(long) GlobalFlags32 +443 stdcall GlobalFree(long) GlobalFree32 +444 stdcall GlobalGetAtomNameA(long ptr long) GlobalGetAtomName32A +445 stdcall GlobalGetAtomNameW(long ptr long) GlobalGetAtomName32W +446 stdcall GlobalHandle(ptr) GlobalHandle32 +447 stdcall GlobalLock(long) GlobalLock32 +448 stdcall GlobalMemoryStatus(ptr) GlobalMemoryStatus +449 stdcall GlobalReAlloc(long long long) GlobalReAlloc32 +450 stdcall GlobalSize(long) GlobalSize32 +451 stdcall GlobalUnWire(long) GlobalUnWire32 +452 stdcall GlobalUnfix(long) GlobalUnfix32 +453 stdcall GlobalUnlock(long) GlobalUnlock32 +454 stdcall GlobalWire(long) GlobalWire32 +455 stub Heap32First +456 stub Heap32ListFirst +457 stub Heap32ListNext +458 stub Heap32Next +459 stdcall HeapAlloc(long long long) HeapAlloc +460 stdcall HeapCompact(long long) HeapCompact +461 stdcall HeapCreate(long long long) HeapCreate +462 stdcall HeapDestroy(long) HeapDestroy +463 stdcall HeapFree(long long ptr) HeapFree +464 stdcall HeapLock(long) HeapLock +465 stdcall HeapReAlloc(long long ptr long) HeapReAlloc +466 stub HeapSetFlags +467 stdcall HeapSize(long long ptr) HeapSize +468 stdcall HeapUnlock(long) HeapUnlock +469 stdcall HeapValidate(long long ptr) HeapValidate +470 stdcall HeapWalk(long ptr) HeapWalk +471 stub InitAtomTable +472 stdcall InitializeCriticalSection(ptr) InitializeCriticalSection +473 stdcall InterlockedDecrement(ptr) InterlockedDecrement +474 stdcall InterlockedExchange(ptr long) InterlockedExchange +475 stdcall InterlockedIncrement(ptr) InterlockedIncrement +476 stub InvalidateNLSCache +477 stdcall IsBadCodePtr(ptr) IsBadCodePtr32 +478 stdcall IsBadHugeReadPtr(ptr long) IsBadHugeReadPtr32 +479 stdcall IsBadHugeWritePtr(ptr long) IsBadHugeWritePtr32 +480 stdcall IsBadReadPtr(ptr long) IsBadReadPtr32 +481 stdcall IsBadStringPtrA(ptr long) IsBadStringPtr32A +482 stdcall IsBadStringPtrW(ptr long) IsBadStringPtr32W +483 stdcall IsBadWritePtr(ptr long) IsBadWritePtr32 +484 stdcall IsDBCSLeadByte(long) IsDBCSLeadByte32 +485 stdcall IsDBCSLeadByteEx(long long) IsDBCSLeadByteEx +486 stub IsLSCallback +487 stub IsSLCallback +488 stdcall IsValidCodePage(long) IsValidCodePage +489 stdcall IsValidLocale(long long) IsValidLocale +490 stub K32Thk1632Epilog +491 stub K32Thk1632Prolog +492 stdcall LCMapStringA(long long ptr long ptr long) LCMapString32A +493 stdcall LCMapStringW(long long ptr long ptr long) LCMapString32W +494 stdcall LeaveCriticalSection(ptr) LeaveCriticalSection +495 stdcall LoadLibraryA(ptr) LoadLibrary32A +496 stdcall LoadLibraryExA(ptr long long) LoadLibraryEx32A +497 stub LoadLibraryExW +498 stdcall LoadLibraryW(ptr) LoadLibrary32W +499 stub LoadModule +500 stdcall LoadResource(long long) LoadResource32 +501 stdcall LocalAlloc(long long) LocalAlloc32 +502 stdcall LocalCompact(long) LocalCompact32 +503 stdcall LocalFileTimeToFileTime(ptr ptr) LocalFileTimeToFileTime +504 stdcall LocalFlags(long) LocalFlags32 +505 stdcall LocalFree(long) LocalFree32 +506 stdcall LocalHandle(ptr) LocalHandle32 +507 stdcall LocalLock(long) LocalLock32 +508 stdcall LocalReAlloc(long long long) LocalReAlloc32 +509 stdcall LocalShrink(long long) LocalShrink32 +510 stdcall LocalSize(long) LocalSize32 +511 stdcall LocalUnlock(long) LocalUnlock32 +512 stdcall LockFile(long long long long long) LockFile +513 stub LockFileEx +514 stdcall LockResource(long) LockResource32 +515 stdcall MakeCriticalSectionGlobal(ptr) MakeCriticalSectionGlobal +516 stub MapHInstLS +517 stub MapHInstLS_PN +518 stub MapHInstSL +519 stub MapHInstSL_PN +520 stub MapHModuleLS +521 stub MapHModuleSL +522 stdcall MapLS(ptr) MapLS +523 stdcall MapSL(long) MapSL +524 stub MapSLFix +525 stdcall MapViewOfFile(long long long long long) MapViewOfFile +526 stdcall MapViewOfFileEx(long long long long long ptr) MapViewOfFileEx +527 stub Module32First +528 stub Module32Next +529 stdcall MoveFileA(ptr ptr) MoveFile32A +530 stdcall MoveFileExA(ptr ptr long) MoveFileEx32A +531 stdcall MoveFileExW(ptr ptr long) MoveFileEx32W +532 stdcall MoveFileW(ptr ptr) MoveFile32W +533 stdcall MulDiv(long long long) MulDiv32 +534 stdcall MultiByteToWideChar(long long ptr long ptr long) MultiByteToWideChar +535 stub NotifyNLSUserCache +536 stdcall OpenEventA(long long ptr) OpenEvent32A +537 stdcall OpenEventW(long long ptr) OpenEvent32W +538 stdcall OpenFile(ptr ptr long) OpenFile32 +539 stdcall OpenFileMappingA(long long ptr) OpenFileMapping32A +540 stdcall OpenFileMappingW(long long ptr) OpenFileMapping32W +541 stdcall OpenMutexA(long long ptr) OpenMutex32A +542 stdcall OpenMutexW(long long ptr) OpenMutex32W +543 stub OpenProcess +544 stub OpenProfileUserMapping +545 stdcall OpenSemaphoreA(long long ptr) OpenSemaphore32A +546 stdcall OpenSemaphoreW(long long ptr) OpenSemaphore32W +547 stub OpenVxDHandle +548 stdcall OutputDebugStringA(ptr) OutputDebugString32A +549 stdcall OutputDebugStringW(ptr) OutputDebugString32W +550 stub PeekConsoleInputA +551 stub PeekConsoleInputW +552 stub PeekNamedPipe +553 stub PostQueuedCompletionStatus +554 stub PrepareTape +555 stub Process32First +556 stub Process32Next +557 stub PulseEvent +558 stdcall PurgeComm(long long) PurgeComm +559 register QT_Thunk() QT_Thunk +560 stdcall QueryDosDeviceA(ptr ptr long) QueryDosDevice32A +561 stdcall QueryDosDeviceW(ptr ptr long) QueryDosDevice32W +562 stub QueryNumberOfEventLogRecords +563 stub QueryOldestEventLogRecord +564 stdcall QueryPerformanceCounter(ptr) QueryPerformanceCounter +565 stub QueryPerformanceFrequency +566 stub QueueUserAPC +567 register RaiseException(long long long ptr) RaiseException +568 stdcall ReadConsoleA(long ptr long ptr ptr) ReadConsole32A +569 stub ReadConsoleInputA +570 stub ReadConsoleInputW +571 stub ReadConsoleOutputA +572 stub ReadConsoleOutputAttribute +573 stub ReadConsoleOutputCharacterA +574 stub ReadConsoleOutputCharacterW +575 stub ReadConsoleOutputW +576 stdcall ReadConsoleW(long ptr long ptr ptr) ReadConsole32W +577 stdcall ReadFile(long ptr long ptr ptr) ReadFile +578 stub ReadFileEx +579 stdcall ReadProcessMemory(long ptr ptr long ptr) ReadProcessMemory +580 stub RegisterServiceProcess +581 stdcall ReinitializeCriticalSection(ptr) ReinitializeCriticalSection +582 stdcall ReleaseMutex(long) ReleaseMutex +583 stdcall ReleaseSemaphore(long long ptr) ReleaseSemaphore +584 stdcall RemoveDirectoryA(ptr) RemoveDirectory32A +585 stdcall RemoveDirectoryW(ptr) RemoveDirectory32W +586 stdcall ResetEvent(long) ResetEvent +587 stdcall ResumeThread(long) ResumeThread +588 stdcall RtlFillMemory(ptr long long) RtlFillMemory +589 stdcall RtlMoveMemory(ptr ptr long) RtlMoveMemory +590 register RtlUnwind(ptr long ptr long) RtlUnwind +591 stdcall RtlZeroMemory(ptr long) RtlZeroMemory +592 register SMapLS() SMapLS +593 register SMapLS_IP_EBP_12() SMapLS_IP_EBP_12 +594 register SMapLS_IP_EBP_16() SMapLS_IP_EBP_16 +595 register SMapLS_IP_EBP_20() SMapLS_IP_EBP_20 +596 register SMapLS_IP_EBP_24() SMapLS_IP_EBP_24 +597 register SMapLS_IP_EBP_28() SMapLS_IP_EBP_28 +598 register SMapLS_IP_EBP_32() SMapLS_IP_EBP_32 +599 register SMapLS_IP_EBP_36() SMapLS_IP_EBP_36 +600 register SMapLS_IP_EBP_40() SMapLS_IP_EBP_40 +601 register SMapLS_IP_EBP_8() SMapLS_IP_EBP_8 +602 stub SUnMapLS +603 stub SUnMapLS_IP_EBP_12 +604 stub SUnMapLS_IP_EBP_16 +605 stub SUnMapLS_IP_EBP_20 +606 stub SUnMapLS_IP_EBP_24 +607 stub SUnMapLS_IP_EBP_28 +608 stub SUnMapLS_IP_EBP_32 +609 stub SUnMapLS_IP_EBP_36 +610 stub SUnMapLS_IP_EBP_40 +611 stub SUnMapLS_IP_EBP_8 +612 stub ScrollConsoleScreenBufferA +613 stub ScrollConsoleScreenBufferW +614 stdcall SearchPathA(ptr ptr ptr long ptr ptr) SearchPath32A +615 stdcall SearchPathW(ptr ptr ptr long ptr ptr) SearchPath32W +616 stdcall SetCommBreak(long) SetCommBreak32 +617 stub SetCommConfig +618 stdcall SetCommMask(long ptr) SetCommMask +619 stdcall SetCommState(long ptr) SetCommState32 +620 stdcall SetCommTimeouts(long ptr) SetCommTimeouts +621 stub SetComputerNameA +622 stub SetComputerNameW +623 stub SetConsoleActiveScreenBuffer +624 stub SetConsoleCP +625 stdcall SetConsoleCtrlHandler(ptr long) SetConsoleCtrlHandler +626 stub SetConsoleCursorInfo +627 stdcall SetConsoleCursorPosition(long long) SetConsoleCursorPosition +628 stdcall SetConsoleMode(long long) SetConsoleMode +629 stub SetConsoleOutputCP +630 stub SetConsoleScreenBufferSize +631 stub SetConsoleTextAttribute +632 stdcall SetConsoleTitleA(ptr) SetConsoleTitle32A +633 stdcall SetConsoleTitleW(ptr) SetConsoleTitle32W +634 stub SetConsoleWindowInfo +635 stdcall SetCurrentDirectoryA(ptr) SetCurrentDirectory32A +636 stdcall SetCurrentDirectoryW(ptr) SetCurrentDirectory32W +637 stub SetDaylightFlag +638 stub SetDefaultCommConfigA +639 stub SetDefaultCommConfigW +640 stdcall SetEndOfFile(long) SetEndOfFile +641 stdcall SetEnvironmentVariableA(ptr ptr) SetEnvironmentVariable32A +642 stdcall SetEnvironmentVariableW(ptr ptr) SetEnvironmentVariable32W +643 stdcall SetErrorMode(long) SetErrorMode32 +644 stdcall SetEvent(long) SetEvent +645 stdcall SetFileApisToANSI() SetFileApisToANSI +646 stdcall SetFileApisToOEM() SetFileApisToOEM +647 stdcall SetFileAttributesA(ptr long) SetFileAttributes32A +648 stdcall SetFileAttributesW(ptr long) SetFileAttributes32W +649 stdcall SetFilePointer(long long ptr long) SetFilePointer +650 stdcall SetFileTime(long ptr ptr ptr) SetFileTime +651 stub SetHandleContext +652 stdcall SetHandleCount(long) SetHandleCount32 +653 stub SetHandleInformation +654 stdcall SetLastError(long) SetLastError +655 stub SetLocalTime +656 stdcall SetLocaleInfoA(long long ptr) SetLocaleInfoA +657 stub SetLocaleInfoW +658 stub SetMailslotInfo +659 stub SetNamedPipeHandleState +660 stdcall SetPriorityClass(long long) SetPriorityClass +661 stdcall SetProcessShutdownParameters(long long) SetProcessShutdownParameters +662 stdcall SetProcessWorkingSetSize(long long long) SetProcessWorkingSetSize +663 stdcall SetStdHandle(long long) SetStdHandle +664 stdcall SetSystemPowerState(long long) SetSystemPowerState +665 stdcall SetSystemTime(ptr) SetSystemTime +666 stub SetSystemTimeAdjustment +667 stub SetTapeParameters +668 stub SetTapePosition +669 stdcall SetThreadAffinityMask(long long) SetThreadAffinityMask +670 stub SetThreadContext +671 stub SetThreadLocale +672 stdcall SetThreadPriority(long long) SetThreadPriority +673 stdcall SetTimeZoneInformation(ptr) SetTimeZoneInformation +674 stdcall SetUnhandledExceptionFilter(ptr) SetUnhandledExceptionFilter +675 stub SetVolumeLabelA +676 stub SetVolumeLabelW +677 stdcall SetupComm(long long long) SetupComm +678 stdcall SizeofResource(long long) SizeofResource32 +679 stdcall Sleep(long) Sleep +680 stub SleepEx +681 stub SuspendThread +682 stdcall SystemTimeToFileTime(ptr ptr) SystemTimeToFileTime +683 stub SystemTimeToTzSpecificLocalTime +684 stub TerminateProcess +685 stdcall TerminateThread(long long) TerminateThread +686 stub Thread32First +687 stub Thread32Next +688 stdcall ThunkConnect32(ptr ptr ptr ptr ptr ptr) ThunkConnect32 +689 stdcall TlsAlloc() TlsAlloc +690 stub TlsAllocInternal +691 stdcall TlsFree(long) TlsFree +692 stub TlsFreeInternal +693 stdcall TlsGetValue(long) TlsGetValue +694 stdcall TlsSetValue(long ptr) TlsSetValue +695 stub Toolhelp32ReadProcessMemory +696 stub TransactNamedPipe +697 stdcall TransmitCommChar(long long) TransmitCommChar32 +698 stdcall UTRegister(long ptr ptr ptr ptr ptr ptr) UTRegister +699 stdcall UTUnRegister(long) UTUnRegister +700 stdcall UnMapLS(long) UnMapLS +701 stub UnMapSLFixArray +702 stdcall UnhandledExceptionFilter(ptr) UnhandledExceptionFilter +703 stub UninitializeCriticalSection +704 stdcall UnlockFile(long long long long long) UnlockFile +705 stub UnlockFileEx +706 stdcall UnmapViewOfFile(ptr) UnmapViewOfFile +707 stub UpdateResourceA +708 stub UpdateResourceW +709 stub VerLanguageNameA +710 stub VerLanguageNameW +711 stdcall VirtualAlloc(ptr long long long) VirtualAlloc +712 stdcall VirtualFree(ptr long long) VirtualFree +713 stdcall VirtualLock(ptr long) VirtualLock +714 stdcall VirtualProtect(ptr long long ptr) VirtualProtect +715 stdcall VirtualProtectEx(long ptr long long ptr) VirtualProtectEx +716 stdcall VirtualQuery(ptr ptr long) VirtualQuery +717 stdcall VirtualQueryEx(long ptr ptr long) VirtualQueryEx +718 stdcall VirtualUnlock(ptr long) VirtualUnlock +719 stub WaitCommEvent +720 stub WaitForDebugEvent +721 stub WaitForMultipleObjects +722 stub WaitForMultipleObjectsEx +723 stdcall WaitForSingleObject(long long) WaitForSingleObject +724 stdcall WaitForSingleObjectEx(long long long) WaitForSingleObjectEx +725 stub WaitNamedPipeA +726 stub WaitNamedPipeW +727 stdcall WideCharToMultiByte(long long ptr long ptr long ptr ptr) WideCharToMultiByte +728 stdcall WinExec(ptr long) WinExec32 +729 stdcall WriteConsoleA(long ptr long ptr ptr) WriteConsole32A +730 stub WriteConsoleInputA +731 stub WriteConsoleInputW +732 stub WriteConsoleOutputA +733 stub WriteConsoleOutputAttribute +734 stub WriteConsoleOutputCharacterA +735 stub WriteConsoleOutputCharacterW +736 stub WriteConsoleOutputW +737 stdcall WriteConsoleW(long ptr long ptr ptr) WriteConsole32W +738 stdcall WriteFile(long ptr long ptr ptr) WriteFile +739 stub WriteFileEx +740 stub WritePrivateProfileSectionA +741 stub WritePrivateProfileSectionW +742 stdcall WritePrivateProfileStringA(ptr ptr ptr ptr) WritePrivateProfileString32A +743 stdcall WritePrivateProfileStringW(ptr ptr ptr ptr) WritePrivateProfileString32W +744 stub WritePrivateProfileStructA +745 stub WritePrivateProfileStructW +746 stub WriteProcessMemory +747 stub WriteProfileSectionA +748 stub WriteProfileSectionW +749 stdcall WriteProfileStringA(ptr ptr ptr) WriteProfileString32A +750 stdcall WriteProfileStringW(ptr ptr ptr) WriteProfileString32W +751 stub WriteTapemark +752 stub _DebugOut +753 stub _DebugPrintf +754 stdcall _hread(long ptr long) _hread32 +755 stdcall _hwrite(long ptr long) _hwrite32 +756 stdcall _lclose(long) _lclose32 +757 stdcall _lcreat(ptr long) _lcreat32 +758 stdcall _llseek(long long long) _llseek32 +759 stdcall _lopen(ptr long) _lopen32 +760 stdcall _lread(long ptr long) _lread32 +761 stdcall _lwrite(long ptr long) _lwrite32 +762 stub dprintf +763 stdcall lstrcat(ptr ptr) lstrcat32A +764 stdcall lstrcatA(ptr ptr) lstrcat32A +765 stdcall lstrcatW(ptr ptr) lstrcat32W +766 stdcall lstrcmp(ptr ptr) lstrcmp32A +767 stdcall lstrcmpA(ptr ptr) lstrcmp32A +768 stdcall lstrcmpW(ptr ptr) lstrcmp32W +769 stdcall lstrcmpi(ptr ptr) lstrcmpi32A +770 stdcall lstrcmpiA(ptr ptr) lstrcmpi32A +771 stdcall lstrcmpiW(ptr ptr) lstrcmpi32W +772 stdcall lstrcpy(ptr ptr) lstrcpy32A +773 stdcall lstrcpyA(ptr ptr) lstrcpy32A +774 stdcall lstrcpyW(ptr ptr) lstrcpy32W +775 stdcall lstrcpyn(ptr ptr long) lstrcpyn32A +776 stdcall lstrcpynA(ptr ptr long) lstrcpyn32A +777 stdcall lstrcpynW(ptr ptr long) lstrcpyn32W +778 stdcall lstrlen(ptr) lstrlen32A +779 stdcall lstrlenA(ptr) lstrlen32A +780 stdcall lstrlenW(ptr) lstrlen32W # # Functions exported by kernel32.dll in NT 3.51 # -780 stub AddConsoleAliasA -781 stub AddConsoleAliasW -782 stub BaseAttachCompleteThunk -783 stub BasepDebugDump -784 stub CloseConsoleHandle -785 stub CmdBatNotification -786 stub ConsoleMenuControl -787 stub ConsoleSubst -788 stub CreateVirtualBuffer -789 stub ExitVDM -790 stub ExpungeConsoleCommandHistoryA -791 stub ExpungeConsoleCommandHistoryW -792 stub ExtendVirtualBuffer -793 stub FreeVirtualBuffer -794 stub GetConsoleAliasA -795 stub GetConsoleAliasExesA -796 stub GetConsoleAliasExesLengthA -797 stub GetConsoleAliasExesLengthW -798 stub GetConsoleAliasExesW -799 stub GetConsoleAliasW -800 stub GetConsoleAliasesA -801 stub GetConsoleAliasesLengthA -802 stub GetConsoleAliasesLengthW -803 stub GetConsoleAliasesW -804 stub GetConsoleCommandHistoryA -805 stub GetConsoleCommandHistoryLengthA -806 stub GetConsoleCommandHistoryLengthW -807 stub GetConsoleCommandHistoryW -810 stub GetConsoleDisplayMode -811 stub GetConsoleFontInfo -812 stub GetConsoleFontSize -813 stub GetConsoleHardwareState -814 stub GetConsoleInputWaitHandle -815 stub GetCurrentConsoleFont -816 stub GetNextVDMCommand -817 stub GetNumberOfConsoleFonts -818 stub GetVDMCurrentDirectories -819 stub HeapCreateTagsW -820 stub HeapExtend -821 stub HeapQueryTagW -823 stub HeapSummary -824 stub HeapUsage -825 stub InvalidateConsoleDIBits -826 stub IsDebuggerPresent -828 stub OpenConsoleW -829 stub QueryWin31IniFilesMappedToRegistry -830 stub RegisterConsoleVDM -831 stub RegisterWaitForInputIdle -832 stub RegisterWowBaseHandlers -833 stub RegisterWowExec -834 stub SetConsoleCommandHistoryMode -835 stub SetConsoleCursor -836 stub SetConsoleDisplayMode -837 stub SetConsoleFont -838 stub SetConsoleHardwareState -839 stub SetConsoleKeyShortcuts -840 stub SetConsoleMaximumWindowSize -841 stub SetConsoleMenuClose -842 stub SetConsoleNumberOfCommandsA -843 stub SetConsoleNumberOfCommandsW -844 stub SetConsolePalette -845 stub SetLastConsoleEventActive -846 stub SetVDMCurrentDirectories -847 stub ShowConsoleCursor -848 stub TrimVirtualBuffer -849 stub VDMConsoleOperation -850 stub VDMOperationStarted -851 stub VerifyConsoleIoHandle -852 stub VirtualBufferExceptionHandler -853 stub WriteConsoleInputVDMA -854 stub WriteConsoleInputVDMW +781 stub AddConsoleAliasA +782 stub AddConsoleAliasW +783 stub BaseAttachCompleteThunk +784 stub BasepDebugDump +785 stub CloseConsoleHandle +786 stub CmdBatNotification +787 stub ConsoleMenuControl +788 stub ConsoleSubst +789 stub CreateVirtualBuffer +790 stub ExitVDM +791 stub ExpungeConsoleCommandHistoryA +792 stub ExpungeConsoleCommandHistoryW +793 stub ExtendVirtualBuffer +794 stub FreeVirtualBuffer +795 stub GetConsoleAliasA +796 stub GetConsoleAliasExesA +797 stub GetConsoleAliasExesLengthA +798 stub GetConsoleAliasExesLengthW +799 stub GetConsoleAliasExesW +800 stub GetConsoleAliasW +801 stub GetConsoleAliasesA +802 stub GetConsoleAliasesLengthA +803 stub GetConsoleAliasesLengthW +804 stub GetConsoleAliasesW +805 stub GetConsoleCommandHistoryA +806 stub GetConsoleCommandHistoryLengthA +807 stub GetConsoleCommandHistoryLengthW +808 stub GetConsoleCommandHistoryW +811 stub GetConsoleDisplayMode +812 stub GetConsoleFontInfo +813 stub GetConsoleFontSize +814 stub GetConsoleHardwareState +815 stub GetConsoleInputWaitHandle +816 stub GetCurrentConsoleFont +817 stub GetNextVDMCommand +818 stub GetNumberOfConsoleFonts +819 stub GetVDMCurrentDirectories +820 stub HeapCreateTagsW +821 stub HeapExtend +822 stub HeapQueryTagW +824 stub HeapSummary +825 stub HeapUsage +826 stub InvalidateConsoleDIBits +827 stub IsDebuggerPresent +829 stub OpenConsoleW +830 stub QueryWin31IniFilesMappedToRegistry +831 stub RegisterConsoleVDM +832 stub RegisterWaitForInputIdle +833 stub RegisterWowBaseHandlers +834 stub RegisterWowExec +835 stub SetConsoleCommandHistoryMode +836 stub SetConsoleCursor +837 stub SetConsoleDisplayMode +838 stub SetConsoleFont +839 stub SetConsoleHardwareState +840 stub SetConsoleKeyShortcuts +841 stub SetConsoleMaximumWindowSize +842 stub SetConsoleMenuClose +843 stub SetConsoleNumberOfCommandsA +844 stub SetConsoleNumberOfCommandsW +845 stub SetConsolePalette +846 stub SetLastConsoleEventActive +847 stub SetVDMCurrentDirectories +848 stub ShowConsoleCursor +849 stub TrimVirtualBuffer +850 stub VDMConsoleOperation +851 stub VDMOperationStarted +852 stub VerifyConsoleIoHandle +853 stub VirtualBufferExceptionHandler +854 stub WriteConsoleInputVDMA +855 stub WriteConsoleInputVDMW diff --git a/if1632/keyboard.spec b/if1632/keyboard.spec index b4b2c561094..354c5afa260 100644 --- a/if1632/keyboard.spec +++ b/if1632/keyboard.spec @@ -12,8 +12,8 @@ type win16 #126 pascal GetTableSeg #127 pascal NewTable 128 pascal OemKeyScan(word) OemKeyScan -129 pascal16 VkKeyScan(byte) VkKeyScan16 -130 pascal16 GetKeyboardType(byte) GetKeyboardType16 +129 pascal16 VkKeyScan(word) VkKeyScan16 +130 pascal16 GetKeyboardType(word) GetKeyboardType16 131 pascal16 MapVirtualKey(word word) MapVirtualKey16 132 pascal16 GetKBCodePage() GetKBCodePage16 133 pascal16 GetKeyNameText(long ptr word) GetKeyNameText16 diff --git a/if1632/mpr.spec b/if1632/mpr.spec index 3acba591a35..ade7cba8071 100644 --- a/if1632/mpr.spec +++ b/if1632/mpr.spec @@ -48,7 +48,7 @@ type win32 0067 stub WNetFormatNetworkNameA 0068 stub WNetFormatNetworkNameW 0069 stdcall WNetGetCachedPassword(ptr long ptr ptr long) WNetGetCachedPassword -0070 stub WNetGetConnectionA +0070 stdcall WNetGetConnectionA(ptr ptr ptr) WNetGetConnection32A 0071 stub WNetGetConnectionW 0072 stub WNetGetHomeDirectoryA 0073 stub WNetGetHomeDirectoryW diff --git a/if1632/ntdll.spec b/if1632/ntdll.spec index 08d394197a8..ebe55e970ea 100644 --- a/if1632/ntdll.spec +++ b/if1632/ntdll.spec @@ -1,6 +1,5 @@ name ntdll type win32 -base 0 001 stub CsrAllocateCaptureBuffer 002 stub CsrAllocateCapturePointer @@ -873,82 +872,82 @@ base 0 869 stub _snprintf 870 stub _snwprintf 871 stub _splitpath -872 stub _strcmpi -873 stdcall _stricmp(ptr ptr) lstrcmpi32A +872 cdecl _strcmpi(ptr ptr) CRTDLL__strcmpi +873 cdecl _stricmp(ptr ptr) CRTDLL__strcmpi 874 stub _strlwr -875 stub _strnicmp -876 stdcall _strupr(ptr) CRTDLL__strupr +875 cdecl _strnicmp(ptr ptr long) CRTDLL__strnicmp +876 cdecl _strupr(ptr) CRTDLL__strupr 877 stub _ultoa 878 stub _vsnprintf -879 stdcall _wcsicmp(ptr ptr) lstrcmpi32W -880 stdcall _wcslwr(ptr) CRTDLL__wcslwr -881 stdcall _wcsnicmp(ptr ptr long) lstrncmpi32W -882 stdcall _wcsupr(ptr) CRTDLL__wcsupr +879 cdecl _wcsicmp(ptr ptr) CRTDLL__wcsicmp +880 cdecl _wcslwr(ptr) CRTDLL__wcslwr +881 cdecl _wcsnicmp(ptr ptr long) CRTDLL__wcsnicmp +882 cdecl _wcsupr(ptr) CRTDLL__wcsupr 883 stub abs 884 stub atan -885 stdcall atoi(ptr) CRTDLL_atoi -886 stdcall atol(ptr) CRTDLL_atol +885 cdecl atoi(ptr) atoi +886 cdecl atol(ptr) atol 887 stub ceil 888 stub cos 889 stub fabs 890 stub floor -891 stdcall isalpha(long) CRTDLL_isalpha -892 stdcall isdigit(long) CRTDLL_isdigit -893 stdcall islower(long) CRTDLL_islower -894 stdcall isprint(long) CRTDLL_isprint -895 stdcall isspace(long) CRTDLL_isspace -896 stdcall isupper(long) CRTDLL_isupper +891 cdecl isalpha(long) isalpha +892 cdecl isdigit(long) isdigit +893 cdecl islower(long) islower +894 cdecl isprint(long) isprint +895 cdecl isspace(long) isspace +896 cdecl isupper(long) isupper 897 stub iswalpha 898 stub iswctype -899 stdcall isxdigit(long) CRTDLL_isxdigit +899 cdecl isxdigit(long) isxdigit 900 stub labs 901 stub log 902 stub mbstowcs -903 stub memchr -904 stub memcmp -905 stub memcpy -906 stdcall memmove(ptr ptr long) memmove -907 stub memset +903 cdecl memchr(ptr long long) memchr +904 cdecl memcmp(ptr ptr long) memcmp +905 cdecl memcpy(ptr ptr long) memcpy +906 cdecl memmove(ptr ptr long) memmove +907 cdecl memset(ptr long long) memset 908 stub pow 909 stub qsort 910 stub sin -911 stdcall sprintf() CRTDLL_sprintf +911 varargs sprintf() wsprintf32A 912 stub sqrt -913 stdcall sscanf() CRTDLL_sscanf -914 stub strcat -915 stdcall strchr(ptr long) strchr -916 stdcall strcmp(ptr ptr) lstrcmp32A -917 stdcall strcpy(ptr ptr) lstrcpy32A -918 stub strcspn -919 stdcall strlen(ptr) lstrlen32A -920 stub strncat -921 stub strncmp -922 stub strncpy -923 stub strpbrk -924 stdcall strrchr(ptr long) strrchr -925 stub strspn -926 stub strstr -927 stdcall swprintf() CRTDLL_swprintf +913 varargs sscanf() sscanf +914 cdecl strcat(ptr ptr) strcat +915 cdecl strchr(ptr long) strchr +916 cdecl strcmp(ptr ptr) strcmp +917 cdecl strcpy(ptr ptr) strcpy +918 cdecl strcspn(ptr ptr) strcspn +919 cdecl strlen(ptr) strlen +920 cdecl strncat(ptr ptr long) strncat +921 cdecl strncmp(ptr ptr long) strncmp +922 cdecl strncpy(ptr ptr long) strncpy +923 cdecl strpbrk(ptr ptr long) strpbrk +924 cdecl strrchr(ptr long) strrchr +925 cdecl strspn(ptr ptr) strspn +926 cdecl strstr(ptr ptr) strstr +927 varargs swprintf() wsprintf32W 928 stub tan -929 stdcall tolower(long) CRTDLL_tolower -930 stdcall toupper(long) CRTDLL_toupper +929 cdecl tolower(long) tolower +930 cdecl toupper(long) toupper 931 stub towlower 932 stub towupper -933 stub vsprintf -934 stdcall wcscat(ptr ptr) lstrcat32W -935 stdcall wcschr(ptr long) CRTDLL_wcschr +933 cdecl vsprintf(ptr ptr ptr) CRTDLL_vsprintf +934 cdecl wcscat(ptr ptr) CRTDLL_wcscat +935 cdecl wcschr(ptr long) CRTDLL_wcschr 936 stub wcscmp -937 stdcall wcscpy(ptr ptr) lstrcpy32W +937 cdecl wcscpy(ptr ptr) CRTDLL_wcscpy 938 stub wcscspn -939 stdcall wcslen(ptr) lstrlen32W +939 cdecl wcslen(ptr) CRTDLL_wcslen 940 stub wcsncat 941 stub wcsncmp -942 stdcall wcsncpy(ptr ptr long) lstrcpyn32W +942 cdecl wcsncpy(ptr ptr long) CRTDLL_wcsncpy 943 stub wcspbrk -944 stdcall wcsrchr(ptr long) CRTDLL_wcsrchr +944 cdecl wcsrchr(ptr long) CRTDLL_wcsrchr 945 stub wcsspn -946 stdcall wcsstr(ptr ptr) CRTDLL_wcsstr +946 cdecl wcsstr(ptr ptr) CRTDLL_wcsstr 947 stub wcstok 948 stub wcstol -949 stdcall wcstombs(ptr ptr) lstrcpyWtoA +949 cdecl wcstombs(ptr ptr long) CRTDLL_wcstombs 950 stub wcstoul diff --git a/if1632/ole2.spec b/if1632/ole2.spec index b86a0f80866..5289929e69b 100644 --- a/if1632/ole2.spec +++ b/if1632/ole2.spec @@ -74,7 +74,7 @@ type win16 71 stub OLECONVERTOLESTREAMTOISTORAGE 74 stub READFMTUSERTYPESTG 75 stub WRITEFMTUSERTYPESTG -76 stub OLEFLUSHCLIPBOARD +76 pascal16 OleFlushClipboard() OleFlushClipboard 77 stub OLEISCURRENTCLIPBOARD 78 stub OLETRANSLATEACCELERATOR 79 stub OLEDOAUTOCONVERT diff --git a/if1632/ole32.spec b/if1632/ole32.spec index 838a9d2a66f..4595e4f814a 100644 --- a/if1632/ole32.spec +++ b/if1632/ole32.spec @@ -1,166 +1,165 @@ name ole32 type win32 -base 1 -0 stub BindMoniker -1 stub CLSIDFromProgID -2 stub CLSIDFromString -3 stub CoBuildVersion -4 stub CoCreateFreeThreadedMarshaler -5 stub CoCreateGuid -6 stub CoCreateInstance -7 stub CoDisconnectObject -8 stub CoDosDateTimeToFileTime -9 stub CoFileTimeNow -10 stub CoFileTimeToDosDateTime -11 stub CoFreeAllLibraries -12 stub CoFreeLibrary -13 stub CoFreeUnusedLibraries -14 stub CoGetCallerTID -15 stub CoGetClassObject -16 stub CoGetCurrentLogicalThreadId -17 stub CoGetCurrentProcess -18 stub CoGetInterfaceAndReleaseStream -19 stub CoGetMalloc -20 stub CoGetMarshalSizeMax -21 stub CoGetPSClsid -22 stub CoGetStandardMarshal -23 stub CoGetState -24 stub CoGetTreatAsClass -25 stub CoInitialize -26 stub CoInitializeWOW -27 stub CoIsHandlerConnected -28 stub CoIsOle1Class -29 stub CoLoadLibrary -30 stub CoLockObjectExternal -31 stub CoMarshalHresult -32 stub CoMarshalInterThreadInterfaceInStream -33 stub CoMarshalInterface -34 stub CoQueryReleaseObject -35 stub CoRegisterClassObject -36 stub CoRegisterMallocSpy -37 stub CoRegisterMessageFilter -38 stub CoReleaseMarshalData -39 stub CoRevokeClassObject -40 stub CoRevokeMallocSpy -41 stub CoSetState -42 stub CoTaskMemAlloc -43 stub CoTaskMemFree -44 stub CoTaskMemRealloc -45 stub CoTreatAsClass -46 stub CoUninitialize -47 stub CoUnloadingWOW -48 stub CoUnmarshalHresult -49 stub CoUnmarshalInterface -50 stub CreateAntiMoniker -51 stub CreateBindCtx -52 stub CreateDataAdviseHolder -53 stub CreateDataCache -54 stub CreateFileMoniker -55 stub CreateGenericComposite -56 stub CreateILockBytesOnHGlobal -57 stub CreateItemMoniker -58 stub CreateOleAdviseHolder -59 stub CreatePointerMoniker -60 stub CreateStreamOnHGlobal -61 stub DllDebugObjectRPCHook -62 stub DllGetClassObject -63 stub DllGetClassObjectWOW -64 stub DoDragDrop -65 stub EnableHookObject -66 stub GetClassFile -67 stub GetConvertStg -68 stub GetDocumentBitStg -69 stub GetHGlobalFromILockBytes -70 stub GetHGlobalFromStream -71 stub GetHookInterface -72 stub GetRunningObjectTable -73 stub IIDFromString -74 stub IsAccelerator -75 stub IsEqualGUID -76 stub IsValidIid -77 stub IsValidInterface -78 stub IsValidPtrIn -79 stub IsValidPtrOut -80 stub MkParseDisplayName -81 stub MonikerCommonPrefixWith -82 stub MonikerRelativePathTo -83 stub OleBuildVersion -84 stub OleConvertIStorageToOLESTREAM -85 stub OleConvertIStorageToOLESTREAMEx -86 stub OleConvertOLESTREAMToIStorage -87 stub OleConvertOLESTREAMToIStorageEx -88 stub OleCreate -89 stub OleCreateDefaultHandler -90 stub OleCreateEmbeddingHelper -91 stub OleCreateFromData -92 stub OleCreateFromFile -93 stub OleCreateLink -94 stub OleCreateLinkFromData -95 stub OleCreateLinkToFile -96 stub OleCreateMenuDescriptor -97 stub OleCreateStaticFromData -98 stub OleDestroyMenuDescriptor -99 stub OleDoAutoConvert -100 stub OleDraw -101 stub OleDuplicateData -102 stub OleFlushClipboard -103 stub OleGetAutoConvert -104 stub OleGetClipboard -105 stub OleGetIconOfClass -106 stub OleGetIconOfFile -107 return OleInitialize 4 0 -108 stub OleInitializeWOW -109 stub OleIsCurrentClipboard -110 stub OleIsRunning -111 stub OleLoad -112 stub OleLoadFromStream -113 stub OleLockRunning -114 stub OleMetafilePictFromIconAndLabel -115 stub OleNoteObjectVisible -116 stub OleQueryCreateFromData -117 stub OleQueryLinkFromData -118 stub OleRegEnumFormatEtc -119 stub OleRegEnumVerbs -120 stub OleRegGetMiscStatus -121 stub OleRegGetUserType -122 stub OleRun -123 stub OleSave -124 stub OleSaveToStream -125 stub OleSetAutoConvert -126 stub OleSetClipboard -127 stub OleSetContainedObject -128 stub OleSetMenuDescriptor -129 stub OleTranslateAccelerator -130 return OleUninitialize 0 0 -131 stub OpenOrCreateStream -132 stub ProgIDFromCLSID -133 stub ReadClassStg -134 stub ReadClassStm -135 stub ReadFmtUserTypeStg -136 stub ReadOleStg -137 stub ReadStringStream -138 stub RegisterDragDrop -139 stub ReleaseStgMedium -140 stub RevokeDragDrop -141 stub SetConvertStg -142 stub SetDocumentBitStg -143 stub StgCreateDocfile -144 stub StgCreateDocfileOnILockBytes -145 stub StgIsStorageFile -146 stub StgIsStorageILockBytes -147 stub StgOpenStorage -148 stub StgOpenStorageOnILockBytes -149 stub StgSetTimes -150 stub StringFromCLSID -151 stub StringFromGUID2 -152 stub StringFromIID -153 stub UtConvertDvtd16toDvtd32 -154 stub UtConvertDvtd32toDvtd16 -155 stub UtGetDvtd16Info -156 stub UtGetDvtd32Info -157 stub WriteClassStg -158 stub WriteClassStm -159 stub WriteFmtUserTypeStg -160 stub WriteOleStg -161 stub WriteStringStream + 1 stub BindMoniker + 2 stub CLSIDFromProgID + 3 stub CLSIDFromString + 4 stub CoBuildVersion + 5 stub CoCreateFreeThreadedMarshaler + 6 stub CoCreateGuid + 7 stub CoCreateInstance + 8 stub CoDisconnectObject + 9 stub CoDosDateTimeToFileTime + 10 stub CoFileTimeNow + 11 stub CoFileTimeToDosDateTime + 12 stub CoFreeAllLibraries + 13 stub CoFreeLibrary + 14 stub CoFreeUnusedLibraries + 15 stub CoGetCallerTID + 16 stub CoGetClassObject + 17 stub CoGetCurrentLogicalThreadId + 18 stub CoGetCurrentProcess + 19 stub CoGetInterfaceAndReleaseStream + 20 stub CoGetMalloc + 21 stub CoGetMarshalSizeMax + 22 stub CoGetPSClsid + 23 stub CoGetStandardMarshal + 24 stub CoGetState + 25 stub CoGetTreatAsClass + 26 stub CoInitialize + 27 stub CoInitializeWOW + 28 stub CoIsHandlerConnected + 29 stub CoIsOle1Class + 30 stub CoLoadLibrary + 31 stub CoLockObjectExternal + 32 stub CoMarshalHresult + 33 stub CoMarshalInterThreadInterfaceInStream + 34 stub CoMarshalInterface + 35 stub CoQueryReleaseObject + 36 stub CoRegisterClassObject + 37 stub CoRegisterMallocSpy + 38 stub CoRegisterMessageFilter + 39 stub CoReleaseMarshalData + 40 stub CoRevokeClassObject + 41 stub CoRevokeMallocSpy + 42 stub CoSetState + 43 stub CoTaskMemAlloc + 44 stub CoTaskMemFree + 45 stub CoTaskMemRealloc + 46 stub CoTreatAsClass + 47 stub CoUninitialize + 48 stub CoUnloadingWOW + 49 stub CoUnmarshalHresult + 50 stub CoUnmarshalInterface + 51 stub CreateAntiMoniker + 52 stub CreateBindCtx + 53 stub CreateDataAdviseHolder + 54 stub CreateDataCache + 55 stub CreateFileMoniker + 56 stub CreateGenericComposite + 57 stub CreateILockBytesOnHGlobal + 58 stub CreateItemMoniker + 59 stub CreateOleAdviseHolder + 60 stub CreatePointerMoniker + 61 stub CreateStreamOnHGlobal + 62 stub DllDebugObjectRPCHook + 63 stub DllGetClassObject + 64 stub DllGetClassObjectWOW + 65 stub DoDragDrop + 66 stub EnableHookObject + 67 stub GetClassFile + 68 stub GetConvertStg + 69 stub GetDocumentBitStg + 70 stub GetHGlobalFromILockBytes + 71 stub GetHGlobalFromStream + 72 stub GetHookInterface + 73 stub GetRunningObjectTable + 74 stub IIDFromString + 75 stub IsAccelerator + 76 stub IsEqualGUID + 77 stub IsValidIid + 78 stub IsValidInterface + 79 stub IsValidPtrIn + 80 stub IsValidPtrOut + 81 stub MkParseDisplayName + 82 stub MonikerCommonPrefixWith + 83 stub MonikerRelativePathTo + 84 stub OleBuildVersion + 85 stub OleConvertIStorageToOLESTREAM + 86 stub OleConvertIStorageToOLESTREAMEx + 87 stub OleConvertOLESTREAMToIStorage + 88 stub OleConvertOLESTREAMToIStorageEx + 89 stub OleCreate + 90 stub OleCreateDefaultHandler + 91 stub OleCreateEmbeddingHelper + 92 stub OleCreateFromData + 93 stub OleCreateFromFile + 94 stub OleCreateLink + 95 stub OleCreateLinkFromData + 96 stub OleCreateLinkToFile + 97 stub OleCreateMenuDescriptor + 98 stub OleCreateStaticFromData + 99 stub OleDestroyMenuDescriptor +100 stub OleDoAutoConvert +101 stub OleDraw +102 stub OleDuplicateData +103 stub OleFlushClipboard +104 stub OleGetAutoConvert +105 stub OleGetClipboard +106 stub OleGetIconOfClass +107 stub OleGetIconOfFile +108 return OleInitialize 4 0 +109 stub OleInitializeWOW +110 stub OleIsCurrentClipboard +111 stub OleIsRunning +112 stub OleLoad +113 stub OleLoadFromStream +114 stub OleLockRunning +115 stub OleMetafilePictFromIconAndLabel +116 stub OleNoteObjectVisible +117 stub OleQueryCreateFromData +118 stub OleQueryLinkFromData +119 stub OleRegEnumFormatEtc +120 stub OleRegEnumVerbs +121 stub OleRegGetMiscStatus +122 stub OleRegGetUserType +123 stub OleRun +124 stub OleSave +125 stub OleSaveToStream +126 stub OleSetAutoConvert +127 stub OleSetClipboard +128 stub OleSetContainedObject +129 stub OleSetMenuDescriptor +130 stub OleTranslateAccelerator +131 return OleUninitialize 0 0 +132 stub OpenOrCreateStream +133 stub ProgIDFromCLSID +134 stub ReadClassStg +135 stub ReadClassStm +136 stub ReadFmtUserTypeStg +137 stub ReadOleStg +138 stub ReadStringStream +139 stub RegisterDragDrop +140 stub ReleaseStgMedium +141 stub RevokeDragDrop +142 stub SetConvertStg +143 stub SetDocumentBitStg +144 stub StgCreateDocfile +145 stub StgCreateDocfileOnILockBytes +146 stub StgIsStorageFile +147 stub StgIsStorageILockBytes +148 stub StgOpenStorage +149 stub StgOpenStorageOnILockBytes +150 stub StgSetTimes +151 stub StringFromCLSID +152 stub StringFromGUID2 +153 stub StringFromIID +154 stub UtConvertDvtd16toDvtd32 +155 stub UtConvertDvtd32toDvtd16 +156 stub UtGetDvtd16Info +157 stub UtGetDvtd32Info +158 stub WriteClassStg +159 stub WriteClassStm +160 stub WriteFmtUserTypeStg +161 stub WriteOleStg +162 stub WriteStringStream diff --git a/if1632/relay.c b/if1632/relay.c index f8e98c4efd0..6ad7c326bec 100644 --- a/if1632/relay.c +++ b/if1632/relay.c @@ -352,15 +352,15 @@ INT16 WINAPI Catch( LPCATCHBUF lpbuf ) */ /* FIXME: we need to save %si and %di */ - lpbuf[0] = OFFSETOF(IF1632_Saved16_ss_sp); - lpbuf[1] = LOWORD(IF1632_Saved32_esp); - lpbuf[2] = HIWORD(IF1632_Saved32_esp); - lpbuf[3] = LOWORD(pFrame->saved_ss_sp); - lpbuf[4] = HIWORD(pFrame->saved_ss_sp); - lpbuf[5] = pFrame->ds; - lpbuf[6] = pFrame->bp; - lpbuf[7] = pFrame->ip; - lpbuf[8] = pFrame->cs; + lpbuf[0] = pFrame->ip; + lpbuf[1] = pFrame->cs; + lpbuf[2] = LOWORD(pFrame->saved_ss_sp); + lpbuf[3] = pFrame->bp; + lpbuf[4] = LOWORD(IF1632_Saved32_esp); + lpbuf[5] = HIWORD(IF1632_Saved32_esp); + lpbuf[6] = pFrame->ds; + lpbuf[7] = OFFSETOF(IF1632_Saved16_ss_sp); + lpbuf[8] = HIWORD(pFrame->saved_ss_sp); return 0; } @@ -373,15 +373,15 @@ INT16 WINAPI Throw( LPCATCHBUF lpbuf, INT16 retval ) STACK16FRAME *pFrame; WORD es = CURRENT_STACK16->es; - IF1632_Saved16_ss_sp = MAKELONG( lpbuf[0] - sizeof(WORD), + IF1632_Saved16_ss_sp = MAKELONG( lpbuf[7] - sizeof(WORD), HIWORD(IF1632_Saved16_ss_sp) ); - IF1632_Saved32_esp = MAKELONG( lpbuf[1], lpbuf[2] ); + IF1632_Saved32_esp = MAKELONG( lpbuf[4], lpbuf[5] ); pFrame = CURRENT_STACK16; - pFrame->saved_ss_sp = MAKELONG( lpbuf[3], lpbuf[4] ); - pFrame->ds = lpbuf[5]; - pFrame->bp = lpbuf[6]; - pFrame->ip = lpbuf[7]; - pFrame->cs = lpbuf[8]; + pFrame->saved_ss_sp = MAKELONG( lpbuf[2], lpbuf[8] ); + pFrame->ds = lpbuf[6]; + pFrame->bp = lpbuf[3]; + pFrame->ip = lpbuf[0]; + pFrame->cs = lpbuf[1]; pFrame->es = es; if (debugging_relay) /* Make sure we have a valid entry point address */ { diff --git a/if1632/shell32.spec b/if1632/shell32.spec index 14f5deb7c17..ed55b9b6fb9 100644 --- a/if1632/shell32.spec +++ b/if1632/shell32.spec @@ -1,140 +1,153 @@ name shell32 type win32 -base 1 # Functions exported by the Win95 shell32.dll # (these need to have these exact ordinals, for some win95 dlls # import shell32.dll by ordinal) - 1 stub CheckEscapesA - 4 stub CheckEscapesW - 5 stdcall CommandLineToArgvW(ptr ptr) CommandLineToArgvW - 6 stub Control_FillCache_RunDLL - 10 stub Control_RunDLL - 12 stub DllGetClassObject - 20 stub DoEnvironmentSubstA - 36 stub DoEnvironmentSubstW - 39 stdcall DragAcceptFiles(long long) DragAcceptFiles - 40 stub DragFinish - 42 stub DragQueryFile + 3 stub CheckEscapesA + 6 stub CheckEscapesW + 7 stdcall CommandLineToArgvW(ptr ptr) CommandLineToArgvW + 8 stub Control_FillCache_RunDLL + 12 stdcall Control_RunDLL(long long long long) Control_RunDLL + 14 stub DllGetClassObject + 22 stub DoEnvironmentSubstA + 33 stub SHELL32_33 + 34 stub SHELL32_34 + 35 stub SHELL32_35 + 38 stub DoEnvironmentSubstW + 41 stdcall DragAcceptFiles(long long) DragAcceptFiles + 42 stub DragFinish + 44 stub DragQueryFile + 46 stub SHELL32_46 47 stub SHELL32_47 - 48 stub DragQueryFileA - 51 stub DragQueryFileAorW - 52 stub DragQueryFileW - 74 stub DragQueryPoint - 78 stub DuplicateIcon - 80 stub ExtractAssociatedIconA - 99 stub ExtractAssociatedIconExA - 122 stub ExtractAssociatedIconExW - 123 stub ExtractAssociatedIconW - 131 stub ExtractIconA - 133 stub ExtractIconEx - 136 stub ExtractIconExA - 146 stub ExtractIconResInfoA - 148 stub ExtractIconResInfoW - 154 stub SHELL32_154 - 155 stub SHELL32_155 + 48 stub SHELL32_48 + 49 stub SHELL32_49 + 50 stub DragQueryFileA + 53 stub DragQueryFileAorW + 54 stub DragQueryFileW + 56 stub SHELL32_56 + 57 stub SHELL32_57 + 58 stub SHELL32_58 + 62 stub SHELL32_62 + 63 stub SHELL32_63 + 64 stub SHELL32_64 + 65 stub SHELL32_65 + 76 stub DragQueryPoint + 80 stub DuplicateIcon + 82 stub ExtractAssociatedIconA + 101 stub ExtractAssociatedIconExA + 124 stub ExtractAssociatedIconExW + 125 stub ExtractAssociatedIconW + 133 stub ExtractIconA + 135 stub ExtractIconEx + 138 stub ExtractIconExA + 148 stub ExtractIconResInfoA + 150 stub ExtractIconResInfoW 156 stub SHELL32_156 + 157 stub SHELL32_157 158 stub SHELL32_158 - 178 stub ExtractIconW - 180 stub ExtractVersionResource16W - 182 stub SHELL32_182 - 183 stub SHELL32_183 - 184 stdcall FindExecutableA(ptr ptr ptr) FindExecutable32A - 185 stub FindExecutableW - 186 return FreeIconList 4 0 - 187 stub InternalExtractIconListA - 188 stub InternalExtractIconListW - 189 stub OpenAs_RunDLL - 190 stub PrintersGetCommand_RunDLL - 191 stub RealShellExecuteA - 192 stub RealShellExecuteExA - 201 stub RealShellExecuteExW - 202 stub RealShellExecuteW - 203 stub RegenerateUserEnvironment - 204 stub SHAddToRecentDocs - 205 stub SHAppBarMessage - 206 stub SHBrowseForFolder - 207 stub SHBrowseForFolderA - 208 stub SHChangeNotify - 209 stub SHFileOperation - 210 stub SHFileOperationA - 211 stub SHFormatDrive - 212 stub SHFreeNameMappings - 213 stub SHGetDataFromIDListA - 214 stub SHGetDesktopFolder - 215 stdcall SHGetFileInfo(ptr long ptr long long) SHGetFileInfo32A - 216 stdcall SHGetFileInfoA(ptr long ptr long long) SHGetFileInfo32A - 217 stub SHGetInstanceExplorer - 218 stub SHGetMalloc - 219 stub SHGetPathFromIDList - 220 stub SHGetPathFromIDListA - 221 stub SHGetSpecialFolderLocation - 222 stub SHHelpShortcuts_RunDLL - 223 stub SHLoadInProc - 224 stub SheChangeDirA - 225 stub SheChangeDirExA - 226 stub SheChangeDirExW - 227 stub SheChangeDirW - 228 stub SheConvertPathW - 229 stub SheFullPathA - 230 stub SheFullPathW - 231 stub SheGetCurDrive - 232 stub SheGetDirA - 233 stub SheGetDirExW - 234 stub SheGetDirW - 235 stub SheGetPathOffsetW - 236 stub SheRemoveQuotesA - 237 stub SheRemoveQuotesW - 238 stub SheSetCurDrive - 239 stub SheShortenPathA - 240 stub SheShortenPathW - 241 stdcall ShellAboutA(long ptr ptr long) ShellAbout32A - 242 stdcall ShellAboutW(long ptr ptr long) ShellAbout32W - 243 stdcall ShellExecuteA(long ptr ptr ptr ptr long) ShellExecute32A - 244 stub ShellExecuteEx - 245 stub ShellExecuteExA - 246 stub ShellExecuteW - 247 stub Shell_NotifyIcon - 248 stub Shell_NotifyIconA - 249 stub Shl1632_ThunkData32 - 250 stub Shl3216_ThunkData32 -1023 stub ExtractIconExW # proper ordinal unknown -1028 stub FindExeDlgProc # proper ordinal unknown -1041 stub RegisterShellHook # proper ordinal unknown -1046 stub SHBrowseForFolderW # proper ordinal unknown -1050 stub SHFileOperationW # proper ordinal unknown -1056 stub SHGetFileInfoW # proper ordinal unknown -1061 stub SHGetPathFromIDListW # proper ordinal unknown -1087 stub ShellExecuteExW # proper ordinal unknown -1089 stub ShellHookProc # proper ordinal unknown -1092 stub Shell_NotifyIconW # proper ordinal unknown -1093 stub StrChrA # proper ordinal unknown -1094 stub StrChrIA # proper ordinal unknown -1095 stub StrChrIW # proper ordinal unknown -1096 stub StrChrW # proper ordinal unknown -1097 stub StrCmpNA # proper ordinal unknown -1098 stub StrCmpNIA # proper ordinal unknown -1099 stub StrCmpNIW # proper ordinal unknown -1100 stub StrCmpNW # proper ordinal unknown -1101 stub StrCpyNA # proper ordinal unknown -1102 stub StrCpyNW # proper ordinal unknown -1103 stub StrNCmpA # proper ordinal unknown -1104 stub StrNCmpIA # proper ordinal unknown -1105 stub StrNCmpIW # proper ordinal unknown -1106 stub StrNCmpW # proper ordinal unknown -1107 stub StrNCpyA # proper ordinal unknown -1108 stub StrNCpyW # proper ordinal unknown -1109 stub StrRChrA # proper ordinal unknown -1110 stub StrRChrIA # proper ordinal unknown -1111 stub StrRChrIW # proper ordinal unknown -1112 stub StrRChrW # proper ordinal unknown -1113 stub StrRStrA # proper ordinal unknown -1114 stub StrRStrIA # proper ordinal unknown -1115 stub StrRStrIW # proper ordinal unknown -1116 stub StrRStrW # proper ordinal unknown -1117 stub StrStrA # proper ordinal unknown -1118 stub StrStrIA # proper ordinal unknown -1119 stub StrStrIW # proper ordinal unknown -1120 stub StrStrW # proper ordinal unknown -1121 stub WOWShellExecute # proper ordinal unknown + 159 stub SHELL32_159 + 160 stub SHELL32_160 + 180 stub ExtractIconW + 182 stub ExtractVersionResource16W + 184 stub SHELL32_184 + 185 stub SHELL32_185 + 186 stdcall FindExecutableA(ptr ptr ptr) FindExecutable32A + 187 stub FindExecutableW + 188 return FreeIconList 4 0 + 189 stub InternalExtractIconListA + 190 stub InternalExtractIconListW + 191 stub OpenAs_RunDLL + 192 stub PrintersGetCommand_RunDLL + 193 stub RealShellExecuteA + 194 stub RealShellExecuteExA + 203 stub RealShellExecuteExW + 204 stub RealShellExecuteW + 205 stub RegenerateUserEnvironment + 206 stub SHAddToRecentDocs + 207 stub SHAppBarMessage + 208 stub SHBrowseForFolder + 209 stub SHBrowseForFolderA + 210 stub SHChangeNotify + 211 stub SHFileOperation + 212 stub SHFileOperationA + 213 stub SHFormatDrive + 214 stub SHFreeNameMappings + 215 stub SHGetDataFromIDListA + 216 stub SHGetDesktopFolder + 217 stdcall SHGetFileInfo(ptr long ptr long long) SHGetFileInfo32A + 218 stdcall SHGetFileInfoA(ptr long ptr long long) SHGetFileInfo32A + 219 stub SHGetInstanceExplorer + 220 stub SHGetMalloc + 221 stub SHGetPathFromIDList + 222 stub SHGetPathFromIDListA + 223 stub SHGetSpecialFolderLocation + 224 stub SHHelpShortcuts_RunDLL + 225 stub SHLoadInProc + 226 stub SheChangeDirA + 227 stub SheChangeDirExA + 228 stub SheChangeDirExW + 229 stub SheChangeDirW + 230 stub SheConvertPathW + 231 stub SheFullPathA + 232 stub SheFullPathW + 233 stub SheGetCurDrive + 234 stub SheGetDirA + 235 stub SheGetDirExW + 236 stub SheGetDirW + 237 stub SheGetPathOffsetW + 238 stub SheRemoveQuotesA + 239 stub SheRemoveQuotesW + 240 stub SheSetCurDrive + 241 stub SheShortenPathA + 242 stub SheShortenPathW + 243 stdcall ShellAboutA(long ptr ptr long) ShellAbout32A + 244 stdcall ShellAboutW(long ptr ptr long) ShellAbout32W + 245 stdcall ShellExecuteA(long ptr ptr ptr ptr long) ShellExecute32A + 246 stub ShellExecuteEx + 247 stub ShellExecuteExA + 248 stub ShellExecuteW + 249 stub Shell_NotifyIcon + 250 stub Shell_NotifyIconA + 251 stub Shl1632_ThunkData32 + 252 stub Shl3216_ThunkData32 +1025 stub ExtractIconExW # proper ordinal unknown +1030 stub FindExeDlgProc # proper ordinal unknown +1043 stub RegisterShellHook # proper ordinal unknown +1048 stub SHBrowseForFolderW # proper ordinal unknown +1052 stub SHFileOperationW # proper ordinal unknown +1058 stub SHGetFileInfoW # proper ordinal unknown +1063 stub SHGetPathFromIDListW # proper ordinal unknown +1089 stub ShellExecuteExW # proper ordinal unknown +1091 stub ShellHookProc # proper ordinal unknown +1094 stub Shell_NotifyIconW # proper ordinal unknown +1095 stub StrChrA # proper ordinal unknown +1096 stub StrChrIA # proper ordinal unknown +1097 stub StrChrIW # proper ordinal unknown +1098 stub StrChrW # proper ordinal unknown +1099 stub StrCmpNA # proper ordinal unknown +1100 stub StrCmpNIA # proper ordinal unknown +1101 stub StrCmpNIW # proper ordinal unknown +1102 stub StrCmpNW # proper ordinal unknown +1103 stub StrCpyNA # proper ordinal unknown +1104 stub StrCpyNW # proper ordinal unknown +1105 stub StrNCmpA # proper ordinal unknown +1106 stub StrNCmpIA # proper ordinal unknown +1107 stub StrNCmpIW # proper ordinal unknown +1108 stub StrNCmpW # proper ordinal unknown +1109 stub StrNCpyA # proper ordinal unknown +1110 stub StrNCpyW # proper ordinal unknown +1111 stub StrRChrA # proper ordinal unknown +1112 stub StrRChrIA # proper ordinal unknown +1113 stub StrRChrIW # proper ordinal unknown +1114 stub StrRChrW # proper ordinal unknown +1115 stub StrRStrA # proper ordinal unknown +1116 stub StrRStrIA # proper ordinal unknown +1117 stub StrRStrIW # proper ordinal unknown +1118 stub StrRStrW # proper ordinal unknown +1119 stub StrStrA # proper ordinal unknown +1120 stub StrStrIA # proper ordinal unknown +1121 stub StrStrIW # proper ordinal unknown +1122 stub StrStrW # proper ordinal unknown +1123 stub WOWShellExecute # proper ordinal unknown diff --git a/if1632/signal.c b/if1632/signal.c index 62a639561ea..06890db93c4 100644 --- a/if1632/signal.c +++ b/if1632/signal.c @@ -30,7 +30,7 @@ #include "options.h" #include "sig_context.h" #include "miscemu.h" - +#include "thread.h" /* Signal handler declaration */ @@ -104,6 +104,115 @@ static HANDLER_DEF(SIGNAL_fault) } +/*********************************************************************** + * SIGNAL_SetContext + * + * Set the register values from a sigcontext. + */ +static void SIGNAL_SetSigContext( const SIGCONTEXT *sigcontext, + CONTEXT *context ) +{ + EAX_reg(context) = EAX_sig(sigcontext); + EBX_reg(context) = EBX_sig(sigcontext); + ECX_reg(context) = ECX_sig(sigcontext); + EDX_reg(context) = EDX_sig(sigcontext); + ESI_reg(context) = ESI_sig(sigcontext); + EDI_reg(context) = EDI_sig(sigcontext); + EBP_reg(context) = EBP_sig(sigcontext); + EFL_reg(context) = EFL_sig(sigcontext); + EIP_reg(context) = EIP_sig(sigcontext); + ESP_reg(context) = ESP_sig(sigcontext); + CS_reg(context) = LOWORD(CS_sig(sigcontext)); + DS_reg(context) = LOWORD(DS_sig(sigcontext)); + ES_reg(context) = LOWORD(ES_sig(sigcontext)); + SS_reg(context) = LOWORD(SS_sig(sigcontext)); +#ifdef FS_sig + FS_reg(context) = LOWORD(FS_sig(sigcontext)); +#else + __asm__("movw %%fs,%w0":"=r" (FS_reg(&DEBUG_context))); + FS_reg(context) &= 0xffff; +#endif +#ifdef GS_sig + GS_reg(context) = LOWORD(GS_sig(sigcontext)); +#else + __asm__("movw %%gs,%w0":"=r" (GS_reg(&DEBUG_context))); + GS_reg(context) &= 0xffff; +#endif +} + + +/*********************************************************************** + * SIGNAL_GetSigContext + * + * Build a sigcontext from the register values. + */ +static void SIGNAL_GetSigContext( SIGCONTEXT *sigcontext, + const CONTEXT *context ) +{ + EAX_sig(sigcontext) = EAX_reg(context); + EBX_sig(sigcontext) = EBX_reg(context); + ECX_sig(sigcontext) = ECX_reg(context); + EDX_sig(sigcontext) = EDX_reg(context); + ESI_sig(sigcontext) = ESI_reg(context); + EDI_sig(sigcontext) = EDI_reg(context); + EBP_sig(sigcontext) = EBP_reg(context); + EFL_sig(sigcontext) = EFL_reg(context); + EIP_sig(sigcontext) = EIP_reg(context); + ESP_sig(sigcontext) = ESP_reg(context); + CS_sig(sigcontext) = CS_reg(context); + DS_sig(sigcontext) = DS_reg(context); + ES_sig(sigcontext) = ES_reg(context); + SS_sig(sigcontext) = SS_reg(context); +#ifdef FS_sig + FS_sig(sigcontext) = FS_reg(context); +#else + __asm__("movw %w0,%%fs"::"r" (FS_reg(context))); +#endif +#ifdef GS_sig + GS_sig(sigcontext) = GS_reg(context); +#else + __asm__("movw %w0,%%gs"::"r" (GS_reg(context))); +#endif +} + + +/*********************************************************************** + * SIGNAL_InfoRegisters + * + * Display registers information. + */ +void SIGNAL_InfoRegisters( CONTEXT *context ) +{ + fprintf( stderr," CS:%04x SS:%04x DS:%04x ES:%04x FS:%04x GS:%04x", + (WORD)CS_reg(context), (WORD)SS_reg(context), + (WORD)DS_reg(context), (WORD)ES_reg(context), + (WORD)FS_reg(context), (WORD)GS_reg(context) ); + fprintf( stderr, "\n EIP:%08lx ESP:%08lx EBP:%08lx EFLAGS:%08lx\n", + EIP_reg(context), ESP_reg(context), + EBP_reg(context), EFL_reg(context) ); + fprintf( stderr, " EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx\n", + EAX_reg(context), EBX_reg(context), + ECX_reg(context), EDX_reg(context) ); + fprintf( stderr, " ESI:%08lx EDI:%08lx\n", + ESI_reg(context), EDI_reg(context) ); +} + + +/********************************************************************** + * SIGNAL_tick + * + * Tick handler. + */ +static HANDLER_DEF(SIGNAL_tick) +{ + HANDLER_PROLOG + CONTEXT nt_context; + SIGNAL_SetSigContext( context, &nt_context ); + if (THREAD_SwitchThread( &nt_context )) + SIGNAL_GetSigContext( context, &nt_context ); + HANDLER_EPILOG +} + /********************************************************************** * SIGNAL_InitEmulator * @@ -111,14 +220,25 @@ static HANDLER_DEF(SIGNAL_fault) */ BOOL32 SIGNAL_InitEmulator(void) { + struct itimerval vt_timer; + SIGNAL_SetHandler( SIGINT, (void (*)())SIGNAL_break, 1); SIGNAL_SetHandler( SIGSEGV, (void (*)())SIGNAL_fault, 1); SIGNAL_SetHandler( SIGILL, (void (*)())SIGNAL_fault, 1); SIGNAL_SetHandler( SIGFPE, (void (*)())SIGNAL_fault, 1); + SIGNAL_SetHandler( SIGVTALRM, (void (*)())SIGNAL_tick, 0); SIGNAL_SetHandler( SIGTRAP, (void (*)())SIGNAL_trap, 1); /* debugger */ SIGNAL_SetHandler( SIGHUP, (void (*)())SIGNAL_trap, 1); /* forced break*/ #ifdef SIGBUS SIGNAL_SetHandler( SIGBUS, (void (*)())SIGNAL_fault, 1); #endif + + /* Start the tick timer */ +#if 0 + vt_timer.it_interval.tv_sec = 0; + vt_timer.it_interval.tv_usec = 10000; + vt_timer.it_value = vt_timer.it_interval; + setitimer( ITIMER_VIRTUAL, &vt_timer, NULL ); +#endif return TRUE; } diff --git a/if1632/thunk.c b/if1632/thunk.c index a28c665741b..901a9bbc7cf 100644 --- a/if1632/thunk.c +++ b/if1632/thunk.c @@ -7,6 +7,9 @@ #include "windows.h" #include "callback.h" +#include "resource.h" +#include "task.h" +#include "user.h" #include "heap.h" #include "hook.h" #include "module.h" @@ -50,7 +53,6 @@ BOOL32 THUNK_Init(void) { /* Set the window proc calling functions */ WINPROC_SetCallWndProc16( THUNK_CallWndProc16 ); - WINPROC_SetCallWndProc32( (WINPROC_CALLWNDPROC32)CallTo32_4 ); return TRUE; } @@ -115,20 +117,20 @@ static void THUNK_Free( THUNK *thunk ) static LRESULT THUNK_CallWndProc16( WNDPROC16 proc, HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPARAM lParam ) { - if ((msg == WM_CREATE) || (msg == WM_NCCREATE)) + if (((msg == WM_CREATE) || (msg == WM_NCCREATE)) && lParam) { CREATESTRUCT16 *cs = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam); /* Build the CREATESTRUCT on the 16-bit stack. */ /* This is really ugly, but some programs (notably the */ /* "Undocumented Windows" examples) want it that way. */ - return CallTo16_long_lllllllwlwwwl( (FARPROC16)proc, + return CallTo16_wndp_lllllllwlwwwl( (FARPROC16)proc, cs->dwExStyle, cs->lpszClass, cs->lpszName, cs->style, MAKELONG( cs->y, cs->x ), MAKELONG( cs->cy, cs->cx ), MAKELONG( cs->hMenu, cs->hwndParent ), cs->hInstance, (LONG)cs->lpCreateParams, hwnd, msg, wParam, IF1632_Saved16_ss_sp - sizeof(CREATESTRUCT16) ); } - return CallTo16_long_wwwl( (FARPROC16)proc, hwnd, msg, wParam, lParam ); + return CallTo16_wndp_wwwl( (FARPROC16)proc, hwnd, msg, wParam, lParam ); } @@ -143,17 +145,6 @@ INT16 WINAPI THUNK_EnumObjects16( HDC16 hdc, INT16 nObjType, } -/*********************************************************************** - * THUNK_EnumObjects32 (GDI32.89) - */ -INT32 WINAPI THUNK_EnumObjects32( HDC32 hdc, INT32 nObjType, - GOBJENUMPROC32 func, LPARAM lParam ) -{ - DECL_THUNK( thunk, func, CallTo32_2 ); - return EnumObjects32( hdc, nObjType, (GOBJENUMPROC32)&thunk, lParam ); -} - - /************************************************************************* * THUNK_EnumFonts16 (GDI.70) */ @@ -164,26 +155,6 @@ INT16 WINAPI THUNK_EnumFonts16( HDC16 hdc, LPCSTR lpFaceName, return EnumFonts16( hdc, lpFaceName, (FONTENUMPROC16)&thunk, lParam ); } -/************************************************************************* - * THUNK_EnumFonts32A (GDI32.84) - */ -INT32 WINAPI THUNK_EnumFonts32A( HDC32 hdc, LPCSTR lpFaceName, - FONTENUMPROC32A func, LPARAM lParam ) -{ - DECL_THUNK( thunk, func, CallTo32_4 ); - return EnumFonts32A( hdc, lpFaceName, (FONTENUMPROC32A)&thunk, lParam ); -} - -/************************************************************************* - * THUNK_EnumFonts32W (GDI32.85) - */ -INT32 WINAPI THUNK_EnumFonts32W( HDC32 hdc, LPCWSTR lpFaceName, - FONTENUMPROC32W func, LPARAM lParam ) -{ - DECL_THUNK( thunk, func, CallTo32_4 ); - return EnumFonts32W( hdc, lpFaceName, (FONTENUMPROC32W)&thunk, lParam ); -} - /****************************************************************** * THUNK_EnumMetaFile16 (GDI.175) */ @@ -206,27 +177,6 @@ INT16 WINAPI THUNK_EnumFontFamilies16( HDC16 hdc, LPCSTR lpszFamily, } -/************************************************************************* - * THUNK_EnumFontFamilies32A (GDI32.80) - */ -INT32 WINAPI THUNK_EnumFontFamilies32A( HDC32 hdc, LPCSTR lpszFamily, - FONTENUMPROC32A func, LPARAM lParam ) -{ - DECL_THUNK( thunk, func, CallTo32_4 ); - return EnumFontFamilies32A(hdc,lpszFamily,(FONTENUMPROC32A)&thunk,lParam); -} - - -/************************************************************************* - * THUNK_EnumFontFamilies32W (GDI32.83) - */ -INT32 WINAPI THUNK_EnumFontFamilies32W( HDC32 hdc, LPCWSTR lpszFamily, - FONTENUMPROC32W func, LPARAM lParam ) -{ - DECL_THUNK( thunk, func, CallTo32_4 ); - return EnumFontFamilies32W(hdc,lpszFamily,(FONTENUMPROC32W)&thunk,lParam); -} - /************************************************************************* * THUNK_EnumFontFamiliesEx16 (GDI.613) */ @@ -240,32 +190,6 @@ INT16 WINAPI THUNK_EnumFontFamiliesEx16( HDC16 hdc, LPLOGFONT16 lpLF, } -/************************************************************************* - * THUNK_EnumFontFamiliesEx32A (GDI32.81) - */ -INT32 WINAPI THUNK_EnumFontFamiliesEx32A( HDC32 hdc, LPLOGFONT32A lpLF, - FONTENUMPROCEX32A func, LPARAM lParam, - DWORD reserved) -{ - DECL_THUNK( thunk, func, CallTo32_4 ); - return EnumFontFamiliesEx32A( hdc, lpLF, (FONTENUMPROCEX32A)&thunk, - lParam, reserved ); -} - - -/************************************************************************* - * THUNK_EnumFontFamiliesEx32W (GDI32.82) - */ -INT32 WINAPI THUNK_EnumFontFamiliesEx32W( HDC32 hdc, LPLOGFONT32W lpLF, - FONTENUMPROCEX32W func, LPARAM lParam, - DWORD reserved ) -{ - DECL_THUNK( thunk, func, CallTo32_4 ); - return EnumFontFamiliesEx32W( hdc, lpLF, (FONTENUMPROCEX32W)&thunk, - lParam, reserved ); -} - - /********************************************************************** * THUNK_LineDDA16 (GDI.100) */ @@ -277,18 +201,6 @@ void WINAPI THUNK_LineDDA16( INT16 nXStart, INT16 nYStart, INT16 nXEnd, } -/********************************************************************** - * THUNK_LineDDA32 (GDI32.248) - */ -BOOL32 WINAPI THUNK_LineDDA32( INT32 nXStart, INT32 nYStart, INT32 nXEnd, - INT32 nYEnd, LINEDDAPROC32 func, LPARAM lParam ) -{ - DECL_THUNK( thunk, func, CallTo32_3 ); - return LineDDA32( nXStart, nYStart, nXEnd, nYEnd, - (LINEDDAPROC32)&thunk, lParam ); -} - - /******************************************************************* * THUNK_EnumWindows16 (USER.54) */ @@ -299,16 +211,6 @@ BOOL16 WINAPI THUNK_EnumWindows16( WNDENUMPROC16 func, LPARAM lParam ) } -/******************************************************************* - * THUNK_EnumWindows32 (USER32.192) - */ -BOOL32 WINAPI THUNK_EnumWindows32( WNDENUMPROC32 func, LPARAM lParam ) -{ - DECL_THUNK( thunk, func, CallTo32_2 ); - return EnumWindows32( (WNDENUMPROC32)&thunk, lParam ); -} - - /********************************************************************** * THUNK_EnumChildWindows16 (USER.55) */ @@ -320,17 +222,6 @@ BOOL16 WINAPI THUNK_EnumChildWindows16( HWND16 parent, WNDENUMPROC16 func, } -/********************************************************************** - * THUNK_EnumChildWindows32 (USER32.177) - */ -BOOL32 WINAPI THUNK_EnumChildWindows32( HWND32 parent, WNDENUMPROC32 func, - LPARAM lParam ) -{ - DECL_THUNK( thunk, func, CallTo32_2 ); - return EnumChildWindows32( parent, (WNDENUMPROC32)&thunk, lParam ); -} - - /********************************************************************** * THUNK_EnumTaskWindows16 (USER.225) */ @@ -342,17 +233,6 @@ BOOL16 WINAPI THUNK_EnumTaskWindows16( HTASK16 hTask, WNDENUMPROC16 func, } -/********************************************************************** - * THUNK_EnumThreadWindows (USER32.189) - */ -BOOL32 WINAPI THUNK_EnumThreadWindows( DWORD id, WNDENUMPROC32 func, - LPARAM lParam ) -{ - DECL_THUNK( thunk, func, CallTo32_2 ); - return EnumThreadWindows( id, (WNDENUMPROC32)&thunk, lParam ); -} - - /*********************************************************************** * THUNK_EnumProps16 (USER.27) */ @@ -363,154 +243,6 @@ INT16 WINAPI THUNK_EnumProps16( HWND16 hwnd, PROPENUMPROC16 func ) } -/*********************************************************************** - * THUNK_EnumProps32A (USER32.185) - */ -INT32 WINAPI THUNK_EnumProps32A( HWND32 hwnd, PROPENUMPROC32A func ) -{ - DECL_THUNK( thunk, func, CallTo32_3 ); - return EnumProps32A( hwnd, (PROPENUMPROC32A)&thunk ); -} - - -/*********************************************************************** - * THUNK_EnumProps32W (USER32.188) - */ -INT32 WINAPI THUNK_EnumProps32W( HWND32 hwnd, PROPENUMPROC32W func ) -{ - DECL_THUNK( thunk, func, CallTo32_3 ); - return EnumProps32W( hwnd, (PROPENUMPROC32W)&thunk ); -} - - -/*********************************************************************** - * THUNK_EnumPropsEx32A (USER32.186) - */ -INT32 WINAPI THUNK_EnumPropsEx32A( HWND32 hwnd, PROPENUMPROCEX32A func, - LPARAM lParam) -{ - DECL_THUNK( thunk, func, CallTo32_4 ); - return EnumPropsEx32A( hwnd, (PROPENUMPROCEX32A)&thunk, lParam ); -} - - -/*********************************************************************** - * THUNK_EnumPropsEx32W (USER32.187) - */ -INT32 WINAPI THUNK_EnumPropsEx32W( HWND32 hwnd, PROPENUMPROCEX32W func, - LPARAM lParam) -{ - DECL_THUNK( thunk, func, CallTo32_4 ); - return EnumPropsEx32W( hwnd, (PROPENUMPROCEX32W)&thunk, lParam ); -} - - -/*********************************************************************** - * THUNK_EnumSystemCodePages32A (KERNEL32.92) - */ -BOOL32 WINAPI THUNK_EnumSystemCodePages32A( CODEPAGE_ENUMPROC32A func, - DWORD flags ) -{ - DECL_THUNK( thunk, func, CallTo32_1 ); - return EnumSystemCodePages32A( (CODEPAGE_ENUMPROC32A)&thunk, flags ); -} - - -/*********************************************************************** - * THUNK_EnumSystemCodePages32W (KERNEL32.93) - */ -BOOL32 WINAPI THUNK_EnumSystemCodePages32W( CODEPAGE_ENUMPROC32W func, - DWORD flags ) -{ - DECL_THUNK( thunk, func, CallTo32_1 ); - return EnumSystemCodePages32W( (CODEPAGE_ENUMPROC32W)&thunk, flags ); -} - -/*********************************************************************** - * THUNK_EnumSystemLocales32A (KERNEL32.92) - */ -BOOL32 WINAPI THUNK_EnumSystemLocales32A( LOCALE_ENUMPROC32A func, DWORD flags) -{ - DECL_THUNK( thunk, func, CallTo32_1 ); - return EnumSystemLocales32A( (LOCALE_ENUMPROC32A)&thunk, flags ); -} - - -/*********************************************************************** - * THUNK_EnumSystemLocales32W (KERNEL32.93) - */ -BOOL32 WINAPI THUNK_EnumSystemLocales32W( LOCALE_ENUMPROC32W func, DWORD flags) -{ - DECL_THUNK( thunk, func, CallTo32_1 ); - return EnumSystemLocales32W( (LOCALE_ENUMPROC32W)&thunk, flags ); -} - -/*********************************************************************** - * THUNK_EnumResourceLanguages32W (KERNEL32.87) - */ -BOOL32 WINAPI THUNK_EnumResourceLanguages32W( HMODULE32 hmod, LPCWSTR type, - LPCWSTR name, - ENUMRESLANGPROC32W func, - LONG lParam ) -{ - DECL_THUNK( thunk, func, CallTo32_5 ); - return EnumResourceLanguages32W( hmod,type,name,(ENUMRESLANGPROC32W)&thunk, lParam ); -} - -/*********************************************************************** - * THUNK_EnumResourceLanguages32A (KERNEL32.86) - */ -BOOL32 WINAPI THUNK_EnumResourceLanguages32A( HMODULE32 hmod, LPCSTR type, - LPCSTR name, - ENUMRESLANGPROC32A func, - LONG lParam ) -{ - DECL_THUNK( thunk, func, CallTo32_5 ); - return EnumResourceLanguages32A( hmod,type,name,(ENUMRESLANGPROC32A)&thunk, lParam ); -} - -/*********************************************************************** - * THUNK_EnumResourceNames32A (KERNEL32.88) - */ -BOOL32 WINAPI THUNK_EnumResourceNames32A( HMODULE32 hmod, LPCSTR type, - ENUMRESNAMEPROC32A func, LONG lParam) -{ - DECL_THUNK( thunk, func, CallTo32_4 ); - return EnumResourceNames32A( hmod,type,(ENUMRESNAMEPROC32A)&thunk,lParam ); -} - -/*********************************************************************** - * THUNK_EnumResourceNames32W (KERNEL32.89) - */ -BOOL32 WINAPI THUNK_EnumResourceNames32W( HMODULE32 hmod, LPCWSTR type, - ENUMRESNAMEPROC32W func, LONG lParam) -{ - DECL_THUNK( thunk, func, CallTo32_4 ); - return EnumResourceNames32W( hmod,type,(ENUMRESNAMEPROC32W)&thunk, lParam); -} - -/*********************************************************************** - * THUNK_EnumResourceTypes32A (KERNEL32.90) - */ -BOOL32 WINAPI THUNK_EnumResourceTypes32A( HMODULE32 hmod, - ENUMRESTYPEPROC32A func, LONG lParam) -{ - DECL_THUNK( thunk, func, CallTo32_3 ); - return EnumResourceTypes32A( hmod,(ENUMRESTYPEPROC32A)&thunk, lParam ); -} - -/*********************************************************************** - * THUNK_EnumResourceTypes32W (KERNEL32.91) - */ -BOOL32 WINAPI THUNK_EnumResourceTypes32W( HMODULE32 hmod, - ENUMRESTYPEPROC32W func, - LONG lParam ) -{ - DECL_THUNK( thunk, func, CallTo32_3 ); - return EnumResourceTypes32W( hmod,(ENUMRESTYPEPROC32W)&thunk, lParam ); -} - - /*********************************************************************** * THUNK_GrayString16 (USER.185) */ @@ -528,40 +260,6 @@ BOOL16 WINAPI THUNK_GrayString16( HDC16 hdc, HBRUSH16 hbr, } -/*********************************************************************** - * THUNK_GrayString32A (USER32.314) - */ -BOOL32 WINAPI THUNK_GrayString32A( HDC32 hdc, HBRUSH32 hbr, - GRAYSTRINGPROC32 func, LPARAM lParam, - INT32 cch, INT32 x, INT32 y, - INT32 cx, INT32 cy ) -{ - DECL_THUNK( thunk, func, CallTo32_3 ); - if (!func) - return GrayString32A( hdc, hbr, NULL, lParam, cch, x, y, cx, cy ); - else - return GrayString32A( hdc, hbr, (GRAYSTRINGPROC32)&thunk, lParam, cch, - x, y, cx, cy ); -} - - -/*********************************************************************** - * THUNK_GrayString32W (USER32.315) - */ -BOOL32 WINAPI THUNK_GrayString32W( HDC32 hdc, HBRUSH32 hbr, - GRAYSTRINGPROC32 func, - LPARAM lParam, INT32 cch, INT32 x, INT32 y, - INT32 cx, INT32 cy ) -{ - DECL_THUNK( thunk, func, CallTo32_3 ); - if (!func) - return GrayString32W( hdc, hbr, NULL, lParam, cch, x, y, cx, cy ); - else - return GrayString32W( hdc, hbr, (GRAYSTRINGPROC32)&thunk, lParam, cch, - x, y, cx, cy ); -} - - /*********************************************************************** * THUNK_SetWindowsHook16 (USER.121) */ @@ -639,24 +337,6 @@ WORD WINAPI THUNK_KillSystemTimer( WORD timer ) } -/*********************************************************************** - * THUNK_SetUnhandledExceptionFilter (KERNEL32.516) - */ -LPTOP_LEVEL_EXCEPTION_FILTER WINAPI THUNK_SetUnhandledExceptionFilter( - LPTOP_LEVEL_EXCEPTION_FILTER filter ) -{ - LPTOP_LEVEL_EXCEPTION_FILTER old; - THUNK *thunk = THUNK_Alloc( (FARPROC16)filter, (RELAY)CallTo32_1 ); - if (!thunk) return NULL; - old = SetUnhandledExceptionFilter( (LPTOP_LEVEL_EXCEPTION_FILTER)thunk ); - if (!old) return NULL; - thunk = (THUNK *)old; - old = (LPTOP_LEVEL_EXCEPTION_FILTER)thunk->proc; - THUNK_Free( thunk ); - return old; -} - - static FARPROC16 defDCHookProc = NULL; /*********************************************************************** @@ -705,6 +385,93 @@ DWORD WINAPI THUNK_GetDCHook( HDC16 hdc, FARPROC16 *phookProc ) return ret; } + +/*********************************************************************** + * THUNK_SetTaskSignalProc (KERNEL.38) + */ +FARPROC16 WINAPI THUNK_SetTaskSignalProc( HTASK16 hTask, FARPROC16 proc ) +{ + static FARPROC16 defSignalProc16 = NULL; + + THUNK *thunk = NULL; + + if( !defSignalProc16 ) + defSignalProc16 = MODULE_GetEntryPoint(GetModuleHandle16("USER"), 314 ); + + if( proc == defSignalProc16 ) + thunk = (THUNK*)SetTaskSignalProc( hTask, (FARPROC16)&USER_SignalProc ); + else + { + thunk = THUNK_Alloc( proc, (RELAY)CallTo16_word_wwwww ); + if( !thunk ) return FALSE; + thunk = (THUNK*)SetTaskSignalProc( hTask, (FARPROC16)thunk ); + } + + if( thunk != (THUNK*)USER_SignalProc ) + { + if( !thunk ) return NULL; + + proc = thunk->proc; + THUNK_Free( thunk ); + return proc; + } + return defSignalProc16; +} + + +/*********************************************************************** + * THUNK_SetResourceHandler (KERNEL.67) + */ +FARPROC16 WINAPI THUNK_SetResourceHandler( HMODULE16 hModule, SEGPTR typeId, FARPROC16 proc ) +{ + /* loader/ne_resource.c */ + extern HGLOBAL16 WINAPI NE_DefResourceHandler(HGLOBAL16,HMODULE16,HRSRC16); + + static FARPROC16 defDIBIconLoader16 = NULL; + static FARPROC16 defDIBCursorLoader16 = NULL; + static FARPROC16 defResourceLoader16 = NULL; + + THUNK *thunk = NULL; + + if( !defResourceLoader16 ) + { + HMODULE16 hUser = GetModuleHandle16("USER"); + defDIBIconLoader16 = MODULE_GetEntryPoint( hUser, 357 ); + defDIBCursorLoader16 = MODULE_GetEntryPoint( hUser, 356 ); + defResourceLoader16 = MODULE_GetWndProcEntry16( "DefResourceHandler" ); + } + + if( proc == defResourceLoader16 ) + thunk = (THUNK*)&NE_DefResourceHandler; + else if( proc == defDIBIconLoader16 ) + thunk = (THUNK*)&LoadDIBIconHandler; + else if( proc == defDIBCursorLoader16 ) + thunk = (THUNK*)&LoadDIBCursorHandler; + else + { + thunk = THUNK_Alloc( proc, (RELAY)CallTo16_word_www ); + if( !thunk ) return FALSE; + } + + thunk = (THUNK*)SetResourceHandler( hModule, typeId, (FARPROC16)thunk ); + + if( thunk == (THUNK*)&NE_DefResourceHandler ) + return defResourceLoader16; + if( thunk == (THUNK*)&LoadDIBIconHandler ) + return defDIBIconLoader16; + if( thunk == (THUNK*)&LoadDIBCursorHandler ) + return defDIBCursorLoader16; + + if( thunk ) + { + proc = thunk->proc; + THUNK_Free( thunk ); + return proc; + } + return NULL; +} + + /*********************************************************************** * * * Win95 internal thunks * @@ -726,7 +493,7 @@ static void _write_ftprolog(LPBYTE start,DWORD thunkstart) { *x++ = 0x0f;*x++=0xb6;*x++=0xd1; /* movzbl edx,cl */ *x++ = 0x8B;*x++=0x14;*x++=0x95;*(DWORD*)x= thunkstart; x+=4; /* mov edx, [4*edx + thunkstart] */ - *x++ = 0x68; *(DWORD*)x = (DWORD)GetProcAddress32(WIN32_GetModuleHandleA("KERNEL32"),"FT_Prolog"); + *x++ = 0x68; *(DWORD*)x = (DWORD)GetProcAddress32(GetModuleHandle32A("KERNEL32"),"FT_Prolog"); x+=4; /* push FT_Prolog */ *x++ = 0xC3; /* lret */ /* fill rest with 0xCC / int 3 */ @@ -749,7 +516,7 @@ static void _write_qtthunk(LPBYTE start,DWORD thunkstart) { *x++ = 0x8A;*x++=0x4D;*x++=0xFC; /* movb cl,[ebp-04] */ *x++ = 0x8B;*x++=0x14;*x++=0x8D;*(DWORD*)x= thunkstart; x+=4; /* mov edx, [4*ecx + (EAX+EDX) */ - *x++ = 0xB8; *(DWORD*)x = (DWORD)GetProcAddress32(WIN32_GetModuleHandleA("KERNEL32"),"QT_Thunk"); + *x++ = 0xB8; *(DWORD*)x = (DWORD)GetProcAddress32(GetModuleHandle32A("KERNEL32"),"QT_Thunk"); x+=4; /* mov eax , QT_Thunk */ *x++ = 0xFF; *x++ = 0xE0; /* jmp eax */ /* should fill the rest of the 32 bytes with 0xCC */ @@ -1020,7 +787,7 @@ VOID WINAPI _KERNEL32_45(CONTEXT *context) LPVOID WINAPI _KERNEL32_41(LPBYTE thunk,LPCSTR thkbuf,DWORD len,LPCSTR dll16, LPCSTR dll32) { - HMODULE32 hkrnl32 = WIN32_GetModuleHandleA("KERNEL32"); + HMODULE32 hkrnl32 = GetModuleHandle32A("KERNEL32"); HMODULE16 hmod; LPDWORD addr,addr2; DWORD segaddr; @@ -1130,44 +897,41 @@ BOOL32 WINAPI _KERNEL32_87() * * And YES, I've seen nr=48 (somewhere in the Win95 32<->16 OLE coupling) */ -DWORD WINAPI _KERNEL32_88(DWORD *args) +DWORD WINAPIV _KERNEL32_88( DWORD nr, DWORD flags, FARPROC32 fun, ... ) { - DWORD nr = args[0]; - DWORD flags = args[1]; - FARPROC32 fun = (FARPROC32)args[2]; - DWORD i,ret; + DWORD i,ret; + DWORD *args = ((DWORD *)&fun) + 1; fprintf(stderr,"KERNEL32_88(%ld,0x%08lx,%p,[ ",nr,flags,fun); - for (i=0;ipe_module : 0)) /* module.c */ -extern NE_MODULE *MODULE_GetPtr( HMODULE16 hModule ); -extern void MODULE_DumpModule( HMODULE16 hmodule ); +extern NE_MODULE *MODULE_GetPtr( HMODULE32 hModule ); +extern HMODULE16 MODULE_HANDLEtoHMODULE16( HANDLE32 handle ); +extern HMODULE32 MODULE_HANDLEtoHMODULE32( HANDLE32 handle ); +extern void MODULE_DumpModule( HMODULE32 hmodule ); extern void MODULE_WalkModules(void); -extern int MODULE_OpenFile( HMODULE16 hModule ); -extern LPSTR MODULE_GetModuleName( HMODULE16 hModule ); +extern int MODULE_OpenFile( HMODULE32 hModule ); +extern LPSTR MODULE_GetModuleName( HMODULE32 hModule ); extern void MODULE_RegisterModule( NE_MODULE *pModule ); -extern HMODULE16 MODULE_FindModule( LPCSTR path ); -extern HINSTANCE16 MODULE_GetInstance( HMODULE16 hModule ); -extern HMODULE16 MODULE_CreateDummyModule( const OFSTRUCT *ofs ); -extern HINSTANCE16 MODULE_Load( LPCSTR name, LPVOID paramBlock, BOOL32 first ); -extern WORD MODULE_GetOrdinal( HMODULE16 hModule, const char *name ); -extern FARPROC16 MODULE_GetEntryPoint( HMODULE16 hModule, WORD ordinal ); -extern BOOL16 MODULE_SetEntryPoint( HMODULE16 hModule, WORD ordinal, +extern HMODULE32 MODULE_FindModule( LPCSTR path ); +extern HINSTANCE16 MODULE_CreateInstance( HMODULE16 hModule, LOADPARAMS* paramBlock ); +extern HINSTANCE16 MODULE_GetInstance( HMODULE32 hModule ); +extern HMODULE32 MODULE_CreateDummyModule( const OFSTRUCT *ofs ); +extern HINSTANCE16 MODULE_Load( LPCSTR name, LPVOID paramBlock, UINT16 flags ); +extern WORD MODULE_GetOrdinal( HMODULE32 hModule, const char *name ); +extern FARPROC16 MODULE_GetEntryPoint( HMODULE32 hModule, WORD ordinal ); +extern BOOL16 MODULE_SetEntryPoint( HMODULE32 hModule, WORD ordinal, WORD offset ); extern FARPROC16 MODULE_GetWndProcEntry16( const char *name ); -extern FARPROC16 WIN32_GetProcAddress16( HMODULE16 hmodule, LPSTR name ); +extern FARPROC16 WIN32_GetProcAddress16( HMODULE32 hmodule, LPSTR name ); /* builtin.c */ extern BOOL16 BUILTIN_Init(void); diff --git a/include/neexe.h b/include/neexe.h index ead7623a3aa..5378fd95458 100644 --- a/include/neexe.h +++ b/include/neexe.h @@ -88,6 +88,10 @@ typedef struct #define NE_FFLAGS_MULTIPLEDATA 0x0002 #define NE_FFLAGS_WIN32 0x0010 #define NE_FFLAGS_BUILTIN 0x0020 /* Wine built-in module */ +#define NE_FFLAGS_IMPLICIT 0x0040 +#define NE_FFLAGS_FRAMEBUF 0x0100 /* OS/2 fullscreen app */ +#define NE_FFLAGS_CONSOLE 0x0200 /* OS/2 console app */ +#define NE_FFLAGS_GUI 0x0300 /* right, (NE_FFLAGS_FRAMEBUF | NE_FFLAGS_CONSOLE) */ #define NE_FFLAGS_SELFLOAD 0x0800 #define NE_FFLAGS_LINKERROR 0x2000 #define NE_FFLAGS_CALLWEP 0x4000 @@ -225,7 +229,7 @@ struct resource_typeinfo_s { unsigned short type_id; /* Type identifier */ unsigned short count; /* Number of resources of this type */ - unsigned long reserved; + DWORD resloader; /* SetResourceHandler() */ /* * Name info array. */ @@ -244,7 +248,4 @@ struct resource_typeinfo_s #define NE_RSCTYPE_RCDATA 0x800a #define NE_RSCTYPE_STRING 0x8006 -int load_typeinfo (int, struct resource_typeinfo_s *); -int load_nameinfo (int, struct resource_nameinfo_s *); - #endif /* __WINE_NEEXE_H */ diff --git a/include/pe_image.h b/include/pe_image.h index 433bcdc3763..482c0f3d576 100644 --- a/include/pe_image.h +++ b/include/pe_image.h @@ -6,20 +6,34 @@ #include "winnt.h" #include "peexe.h" +/* This struct is used for loaded PE .dlls */ struct pe_data { - LPIMAGE_NT_HEADERS pe_header; - LPIMAGE_SECTION_HEADER pe_seg; - LPIMAGE_IMPORT_DESCRIPTOR pe_import; - LPIMAGE_EXPORT_DIRECTORY pe_export; - LPIMAGE_RESOURCE_DIRECTORY pe_resource; - LPIMAGE_BASE_RELOCATION pe_reloc; - int base_addr; - int load_addr; - int vma_size; + LPIMAGE_NT_HEADERS pe_header; + LPIMAGE_SECTION_HEADER pe_seg; + HMODULE32 mappeddll; }; typedef struct pe_data PE_MODULE; +/* modreference used for attached processes + * all section are calculated here, relocations etc. + */ +struct pe_modref { + struct pe_modref *next; + PE_MODULE *pe_module; + unsigned long int load_addr; + LPIMAGE_IMPORT_DESCRIPTOR pe_import; + LPIMAGE_EXPORT_DIRECTORY pe_export; + LPIMAGE_RESOURCE_DIRECTORY pe_resource; + LPIMAGE_BASE_RELOCATION pe_reloc; + int flags; +#define PE_MODREF_PROCESS_ATTACHED 0x00000001 +#define PE_MODREF_NO_DLL_CALLS 0x00000002 +#define PE_MODREF_RELOCS_DONE 0x00000004 +}; + +typedef struct pe_modref PE_MODREF; + extern int PE_unloadImage(HMODULE32 hModule); extern FARPROC32 PE_FindExportedFunction(struct pe_data *pe, LPCSTR funcName); extern void my_wcstombs(char * result, u_short * source, int len); @@ -31,7 +45,10 @@ extern BOOL32 PE_EnumResourceLanguages32A(HMODULE32,LPCSTR,LPCSTR,ENUMRESLANGPRO extern BOOL32 PE_EnumResourceLanguages32W(HMODULE32,LPCWSTR,LPCWSTR,ENUMRESLANGPROC32W,LONG); extern HRSRC32 PE_FindResourceEx32W(HINSTANCE32,LPCWSTR,LPCWSTR,WORD); extern DWORD PE_SizeofResource32(HINSTANCE32,HRSRC32); +extern HMODULE32 PE_LoadLibraryEx32A(LPCSTR,HFILE32,DWORD); extern HGLOBAL32 PE_LoadResource32(HINSTANCE32,HRSRC32); -extern void PE_InitializeDLLs(HMODULE16,DWORD,LPVOID); + +struct _PDB32; /* forward definition */ +extern void PE_InitializeDLLs(struct _PDB32*,DWORD,LPVOID); #endif /* __WINE_PE_IMAGE_H */ diff --git a/include/peexe.h b/include/peexe.h index bc13148a9be..49d7cf99437 100644 --- a/include/peexe.h +++ b/include/peexe.h @@ -323,7 +323,7 @@ typedef struct _IMAGE_RESOURCE_DATA_ENTRY { DWORD OffsetToData; DWORD Size; DWORD CodePage; - DWORD Reserved; + DWORD ResourceHandle; } IMAGE_RESOURCE_DATA_ENTRY,*LPIMAGE_RESOURCE_DATA_ENTRY; typedef struct _IMAGE_BASE_RELOCATION diff --git a/include/process.h b/include/process.h index dc6b421d5e6..3cbd14cca3c 100644 --- a/include/process.h +++ b/include/process.h @@ -11,6 +11,7 @@ #include "winbase.h" #include "winnt.h" #include "handle32.h" +#include "pe_image.h" #include "task.h" /* Process handle entry */ @@ -71,7 +72,7 @@ typedef struct _PDB32 ENVDB *env_db; /* 40 Environment database */ HANDLE_TABLE *handle_table; /* 44 Handle table */ struct _PDB32 *parent; /* 48 Parent process */ - void *modref_list; /* 4c MODREF list */ + PE_MODREF *modref_list; /* 4c MODREF list */ void *thread_list; /* 50 List of threads */ void *debuggee_CB; /* 54 Debuggee context block */ void *local_heap_free; /* 58 Head of local heap free list */ @@ -82,7 +83,7 @@ typedef struct _PDB32 DWORD tls_bits[2]; /* 88 TLS in-use bits */ DWORD process_dword; /* 90 Unknown */ struct _PDB32 *group; /* 94 Process group */ - void *exe_modref; /* 98 MODREF for the process EXE */ + PE_MODREF *exe_modref; /* 98 MODREF for the process EXE */ LPTOP_LEVEL_EXCEPTION_FILTER top_filter; /* 9c Top exception filter */ DWORD priority; /* a0 Priority level */ HANDLE32 heap_list; /* a4 Head of process heap list */ @@ -101,7 +102,7 @@ extern HANDLE32 PROCESS_AllocHandle( K32OBJ *ptr, DWORD flags); extern K32OBJ *PROCESS_GetObjPtr( HANDLE32 handle, K32OBJ_TYPE type ); extern BOOL32 PROCESS_SetObjPtr( HANDLE32 handle, K32OBJ *ptr, DWORD flags ); -extern PDB32 *PROCESS_Create( TDB *pTask ); +extern PDB32 *PROCESS_Create( TDB *pTask, LPCSTR cmd_line ); extern void PROCESS_Destroy( K32OBJ *ptr ); extern PDB32 *pCurrentProcess; diff --git a/include/progress.h b/include/progress.h new file mode 100644 index 00000000000..0aadb154c72 --- /dev/null +++ b/include/progress.h @@ -0,0 +1,23 @@ +/* + * Progress class extra info + * + * Copyright 1997 Dimitrie O. Paun + */ + +#ifndef __WINE_PROGRESS_H +#define __WINE_PROGRESS_H + +#include "windows.h" +#include "commctrl.h" + +typedef struct +{ + INT32 CurVal; /* Current progress value */ + INT32 MinVal; /* Minimum progress value */ + INT32 MaxVal; /* Maximum progress value */ + INT32 Step; /* Step to use on PMB_STEPIT */ +} PROGRESS_INFO; + +LRESULT WINAPI ProgressWindowProc(HWND32, UINT32, WPARAM32, LPARAM); + +#endif /* __WINE_PROGRESS_H */ diff --git a/include/resource.h b/include/resource.h index 02a6dd4b718..50bd60a0c82 100644 --- a/include/resource.h +++ b/include/resource.h @@ -44,14 +44,21 @@ extern void LIBRES_RegisterResources(const struct resource* const * Res); #define WINE_CONSTRUCTOR #endif +typedef HGLOBAL16 (CALLBACK *RESOURCEHANDLER16)(HGLOBAL16, HMODULE16, HRSRC16 ); + +/* FIXME: convert all NE_ functions to accept NE_MODULE pointer instead + * of redundant hModule (which is always verified prior to calling these). + */ + extern int NE_AccessResource( HMODULE16 hModule, HRSRC16 hRsrc ); extern BOOL32 NE_FreeResource( HMODULE16 hModule, HGLOBAL16 handle ); extern HRSRC16 NE_FindResource(HMODULE16 hModule, SEGPTR typeId, SEGPTR resId); extern DWORD NE_SizeofResource( HMODULE16 hModule, HRSRC16 hRsrc ); extern SEGPTR NE_LockResource( HMODULE16 hModule, HGLOBAL16 handle ); -extern HGLOBAL16 NE_AllocResource( HMODULE16 hModule, HRSRC16 hRsrc, - DWORD size ); +extern HGLOBAL16 NE_AllocResource( HMODULE16 hModule, HRSRC16 hRsrc, DWORD size ); extern HGLOBAL16 NE_LoadResource( HMODULE16 hModule, HRSRC16 hRsrc ); +extern BOOL32 NE_InitResourceHandler( HMODULE16 hModule ); +extern FARPROC32 NE_SetResourceHandler( HMODULE16 hModule, SEGPTR typeId, FARPROC32 handler); extern HGLOBAL16 SYSRES_LoadResource( SYSTEM_RESOURCE id ); extern void SYSRES_FreeResource( HGLOBAL16 handle ); diff --git a/include/spy.h b/include/spy.h index a221ab87e5b..bb6f776b0ec 100644 --- a/include/spy.h +++ b/include/spy.h @@ -18,6 +18,9 @@ #define SPY_RESULT_OK32 0x0001 #define SPY_RESULT_INVALIDHWND16 0x0002 #define SPY_RESULT_INVALIDHWND32 0x0003 +#define SPY_RESULT_DEFWND16 0x0004 +#define SPY_RESULT_DEFWND32 0x0005 + extern const char *SPY_GetMsgName( UINT32 msg ); extern void SPY_EnterMessage( INT32 iFlag, HWND32 hwnd, UINT32 msg, diff --git a/include/stackframe.h b/include/stackframe.h index 1e3711e33d3..09cdb854b0f 100644 --- a/include/stackframe.h +++ b/include/stackframe.h @@ -37,9 +37,10 @@ typedef struct DWORD edx; DWORD ecx; DWORD ebx; + DWORD restore_addr; /* return address for restoring code selector */ + DWORD codeselector; /* code selector to restore */ DWORD ebp; /* saved 32-bit frame pointer */ - DWORD retaddr; /* return address */ - DWORD codeselector; /* code selector for return address */ + DWORD retaddr; /* actual return address */ DWORD args[1]; /* arguments to 16-bit function */ } STACK32FRAME; diff --git a/include/stddebug.h b/include/stddebug.h index 819ae530e63..c5ac25b0a61 100644 --- a/include/stddebug.h +++ b/include/stddebug.h @@ -133,6 +133,7 @@ #undef DEBUG_OLE #undef DEBUG_PALETTE #undef DEBUG_PROFILE +#undef DEBUG_PROGRESS #undef DEBUG_PROP #undef DEBUG_REG #undef DEBUG_REGION @@ -218,6 +219,7 @@ #define DEBUG_OLE #define DEBUG_PALETTE #define DEBUG_PROFILE +#define DEBUG_PROGRESS #define DEBUG_PROP #define DEBUG_REG #define DEBUG_REGION diff --git a/include/struct32.h b/include/struct32.h index 81a60e19a2a..70875bfced7 100644 --- a/include/struct32.h +++ b/include/struct32.h @@ -23,45 +23,4 @@ void STRUCT32_MDICREATESTRUCT32Ato16( const MDICREATESTRUCT32A*, MDICREATESTRUCT16*); void STRUCT32_MDICREATESTRUCT16to32A( const MDICREATESTRUCT16*, MDICREATESTRUCT32A*); - -#pragma pack(1) - -typedef struct { - BYTE bWidth; - BYTE bHeight; - BYTE bColorCount; - BYTE bReserved; - WORD wPlanes; - WORD wBitCount; - DWORD dwBytesInRes; - WORD wResId WINE_PACKED; - /*WORD padding; Spec is wrong, no padding here*/ -} ICONDIRENTRY32; - -typedef struct { - WORD wWidth; - WORD wHeight; - WORD wPlanes; - WORD wBitCount; - DWORD dwBytesInRes; - WORD wResId WINE_PACKED; - /*WORD padding;*/ -} CURSORDIRENTRY32; - -typedef union{ - ICONDIRENTRY32 icon; - CURSORDIRENTRY32 cursor; -} CURSORICONDIRENTRY32; - -typedef struct { - WORD idReserved; - WORD idType; - WORD idCount; - /*WORD padding;*/ - CURSORICONDIRENTRY32 idEntries[1]; -} CURSORICONDIR32; - - -#pragma pack(4) - #endif /* __WINE_STRUCT32_H */ diff --git a/include/syscolor.h b/include/syscolor.h index f8bd654e9c7..a212336c991 100644 --- a/include/syscolor.h +++ b/include/syscolor.h @@ -32,6 +32,10 @@ struct SysColorObjects /* COLOR_BTNTEXT */ /* COLOR_INACTIVECAPTIONTEXT */ HBRUSH32 hbrushBtnHighlight; /* COLOR_BTNHIGHLIGHT */ + /* COLOR_3DDKSHADOW */ + /* COLOR_3DLIGHT */ + /* COLOR_INFOTEXT */ + /* COLOR_INFOBK */ }; extern void SYSCOLOR_Init(void); diff --git a/include/task.h b/include/task.h index 57129790e08..1fe0a2c2c9d 100644 --- a/include/task.h +++ b/include/task.h @@ -51,11 +51,15 @@ typedef struct struct _THDB; struct _WSINFO; + /* signal proc typedef */ +typedef void (CALLBACK *USERSIGNALPROC)(HANDLE16, UINT16, UINT16, + HINSTANCE16, HQUEUE16); + /* Task database. See 'Windows Internals' p. 226. * Note that 16-bit OLE 2 libs like to read it directly * so we have to keep entry offsets as they are. */ -typedef struct +typedef struct _TDB { HTASK16 hNext; /* 00 Selector of next TDB */ DWORD ss_sp WINE_PACKED; /* 02 Stack pointer of task */ @@ -75,7 +79,7 @@ typedef struct HTASK16 hParent; /* 22 Selector of TDB of parent */ WORD signal_flags; /* 24 Flags for signal handler */ FARPROC16 sighandler WINE_PACKED; /* 26 Signal handler */ - FARPROC16 userhandler WINE_PACKED; /* 2a USER signal handler */ + USERSIGNALPROC userhandler WINE_PACKED; /* 2a USER signal handler */ FARPROC16 discardhandler WINE_PACKED; /* 2e Handler for GlobalNotify() */ DWORD int0 WINE_PACKED; /* 32 int 0 (divide by 0) handler */ DWORD int2 WINE_PACKED; /* 36 int 2 (NMI) handler */ @@ -112,6 +116,12 @@ typedef struct #define TDBF_OS2APP 0x0008 #define TDBF_WIN32 0x0010 + /* USER signals */ +#define USIG_TERMINATION 0x0020 +#define USIG_DLL_LOAD 0x0040 +#define USIG_DLL_UNLOAD 0x0080 +#define USIG_GPF 0x0666 + #pragma pack(4) extern BOOL32 TASK_Init(void); diff --git a/include/thread.h b/include/thread.h index ec3fa4a6fca..347019e1d7c 100644 --- a/include/thread.h +++ b/include/thread.h @@ -79,6 +79,8 @@ typedef struct _THDB extern THDB *THREAD_Create( PDB32 *pdb, DWORD stack_size, LPTHREAD_START_ROUTINE start_addr ); extern void THREAD_Destroy( K32OBJ *ptr ); +extern THDB *THREAD_Current(void); +extern THDB *THREAD_SwitchThread( CONTEXT *context ); extern THDB *pCurrentThread; diff --git a/include/updown.h b/include/updown.h index 07b132e3304..bb56e13c82c 100644 --- a/include/updown.h +++ b/include/updown.h @@ -22,7 +22,14 @@ typedef struct INT32 Flags; /* Internal Flags FLAG_* */ } UPDOWN_INFO; -LRESULT WINAPI UpDownWindowProc( HWND32 hwnd, UINT32 message, WPARAM32 wParam, - LPARAM lParam); +typedef struct tagNM_UPDOWN +{ + NMHDR hdr; + int iPos; + int iDelta; +} NM_UPDOWN; + +LRESULT WINAPI UpDownWindowProc(HWND32 hwnd, UINT32 message, WPARAM32 wParam, + LPARAM lParam); #endif /* __WINE_UPDOWN_H */ diff --git a/include/user.h b/include/user.h index cfb068ba715..68e023f3ef5 100644 --- a/include/user.h +++ b/include/user.h @@ -23,4 +23,6 @@ extern WORD USER_HeapSel; #define USER_HEAP_SEG_ADDR(handle) \ ((handle) ? PTR_SEG_OFF_TO_SEGPTR(USER_HeapSel, (handle)) : (SEGPTR)0) +void USER_SignalProc(HANDLE16, UINT16, UINT16, HINSTANCE16, HQUEUE16); + #endif /* __WINE_USER_H */ diff --git a/include/win.h b/include/win.h index c9520000beb..128a20fe528 100644 --- a/include/win.h +++ b/include/win.h @@ -61,7 +61,7 @@ typedef struct tagWND HWINDOWPROC winproc; /* Window procedure */ DWORD dwMagic; /* Magic number (must be WND_MAGIC) */ HWND32 hwndSelf; /* Handle of this window */ - HINSTANCE16 hInstance; /* Window hInstance (from CreateWindow) */ + HINSTANCE32 hInstance; /* Window hInstance (from CreateWindow) */ RECT32 rectClient; /* Client area rel. to parent client area */ RECT32 rectWindow; /* Whole window rel. to parent client area */ LPSTR text; /* Window text */ @@ -119,14 +119,12 @@ extern Window WIN_GetXWindow( HWND32 hwnd ); extern BOOL32 WIN_UnlinkWindow( HWND32 hwnd ); extern BOOL32 WIN_LinkWindow( HWND32 hwnd, HWND32 hwndInsertAfter ); extern HWND32 WIN_FindWinToRepaint( HWND32 hwnd, HQUEUE16 hQueue ); -extern void WIN_SendParentNotify( HWND32 hwnd, WORD event, - WORD idChild, LPARAM lValue ); -extern void WIN_ResetQueueWindows( WND* wnd, HQUEUE16 hQueue, HQUEUE16 hNew ); +extern BOOL32 WIN_ResetQueueWindows( WND* wnd, HQUEUE16 hQueue, HQUEUE16 hNew); extern BOOL32 WIN_CreateDesktopWindow(void); extern HWND32 WIN_GetTopParent( HWND32 hwnd ); extern WND* WIN_GetTopParentPtr( WND* pWnd ); extern BOOL32 WIN_IsWindowDrawable(WND*, BOOL32 ); -extern HINSTANCE16 WIN_GetWindowInstance( HWND32 hwnd ); +extern HINSTANCE32 WIN_GetWindowInstance( HWND32 hwnd ); extern WND** WIN_BuildWinArray( WND *wndPtr, UINT32 bwa, UINT32* pnum ); extern void DEFWND_SetText( WND *wndPtr, LPCSTR text ); /* windows/defwnd.c */ diff --git a/include/windows.h b/include/windows.h index 139c33b1db2..e2afd4516a9 100644 --- a/include/windows.h +++ b/include/windows.h @@ -5,6 +5,7 @@ extern "C" { #endif +#include #include "wintypes.h" #pragma pack(1) @@ -904,6 +905,16 @@ typedef DWORD COLORREF; #define COLOR_BTNTEXT 18 #define COLOR_INACTIVECAPTIONTEXT 19 #define COLOR_BTNHIGHLIGHT 20 +#define COLOR_3DDKSHADOW 21 +#define COLOR_3DLIGHT 22 +#define COLOR_INFOTEXT 23 +#define COLOR_INFOBK 24 +#define COLOR_DESKTOP COLOR_BACKGROUND +#define COLOR_3DFACE COLOR_BTNFACE +#define COLOR_3DSHADOW COLOR_BTNSHADOW +#define COLOR_3DHIGHLIGHT COLOR_BTNHIGHLIGHT +#define COLOR_3DHILIGHT COLOR_BTNHIGHLIGHT +#define COLOR_BTNHILIGHT COLOR_BTNHIGHLIGHT /* WM_CTLCOLOR values */ #define CTLCOLOR_MSGBOX 0 @@ -968,6 +979,10 @@ DECL_WINELIB_TYPE(LPLOGBRUSH); #define BS_PATTERN 3 #define BS_INDEXED 4 #define BS_DIBPATTERN 5 +#define BS_DIBPATTERNPT 6 +#define BS_PATTERN8X8 7 +#define BS_DIBPATTERN8X8 8 +#define BS_MONOPATTERN 9 /* Hatch styles */ #define HS_HORIZONTAL 0 @@ -1875,6 +1890,15 @@ typedef struct #define DIB_PAL_COLORS 1 #define CBM_INIT 4 +typedef struct +{ + BITMAP32 dsBm; + BITMAPINFOHEADER dsBmih; + DWORD dsBitfields[3]; + HANDLE32 dshSection; + DWORD dsOffset; +} DIBSECTION,*LPDIBSECTION; + /* Cursors / Icons */ @@ -4618,6 +4642,15 @@ typedef struct { #define HELP_PARTIALKEY 0x0105 #define HELP_MULTIKEY 0x0201 #define HELP_SETWINPOS 0x0203 +#define HELP_CONTEXTMENU 0x000a +#define HELP_FINDER 0x000b +#define HELP_WM_HELP 0x000c +#define HELP_SETPOPUP_POS 0x000d + +#define HELP_TCARD 0x8000 +#define HELP_TCARD_DATA 0x0010 +#define HELP_TCARD_OTHER_CALLER 0x0011 + /* ExitWindows() flags */ #define EW_RESTARTWINDOWS 0x0042 @@ -5168,6 +5201,15 @@ typedef struct tagNMHDR UINT32 code; } NMHDR, *LPNMHDR; +typedef struct +{ + UINT32 cbSize; + INT32 iTabLength; + INT32 iLeftMargin; + INT32 iRightMargin; + UINT32 uiLengthDrawn; +} DRAWTEXTPARAMS,*LPDRAWTEXTPARAMS; + #pragma pack(4) /* Declarations for functions that exist only in Win16 */ @@ -5260,9 +5302,13 @@ BOOL16 WINAPI IsGDIObject(HGDIOBJ16); BOOL16 WINAPI IsSharedSelector(HANDLE16); BOOL16 WINAPI IsTask(HTASK16); HTASK16 WINAPI IsTaskLocked(void); +BOOL16 WINAPI IsUserIdle(void); BOOL16 WINAPI IsValidMetaFile(HMETAFILE16); VOID WINAPI LogError(UINT16, LPVOID); VOID WINAPI LogParamError(UINT16,FARPROC16,LPVOID); +HGLOBAL16 WINAPI LoadCursorIconHandler(HGLOBAL16,HMODULE16,HRSRC16); +HGLOBAL16 WINAPI LoadDIBCursorHandler(HGLOBAL16,HMODULE16,HRSRC16); +HGLOBAL16 WINAPI LoadDIBIconHandler(HGLOBAL16,HMODULE16,HRSRC16); WORD WINAPI LocalCountFree(void); WORD WINAPI LocalHandleDelta(WORD); WORD WINAPI LocalHeapSize(void); @@ -5290,7 +5336,7 @@ WORD WINAPI SelectorAccessRights(WORD,WORD,WORD); INT16 WINAPI SelectVisRgn(HDC16,HRGN16); DWORD WINAPI SetBitmapDimension(HBITMAP16,INT16,INT16); DWORD WINAPI SetBrushOrg(HDC16,INT16,INT16); -UINT16* WINAPI SetCommEventMask(INT16,UINT16); +SEGPTR WINAPI SetCommEventMask(INT16,UINT16); BOOL16 WINAPI SetDCHook(HDC16,FARPROC16,DWORD); DWORD WINAPI SetDCOrg(HDC16,INT16,INT16); VOID WINAPI SetDCState(HDC16,HDC16); @@ -5582,7 +5628,11 @@ DWORD WINAPI GetMenuCheckMarkDimensions(void); LONG WINAPI GetMessageExtraInfo(void); DWORD WINAPI GetMessagePos(void); LONG WINAPI GetMessageTime(void); +LANGID WINAPI GetSystemDefaultLangID(void); +LCID WINAPI GetSystemDefaultLCID(void); DWORD WINAPI GetTickCount(void); +LANGID WINAPI GetUserDefaultLangID(void); +LCID WINAPI GetUserDefaultLCID(void); ATOM WINAPI GlobalDeleteAtom(ATOM); VOID WINAPI LZDone(void); DWORD WINAPI OemKeyScan(WORD); @@ -5752,7 +5802,7 @@ BOOL32 WINAPI Chord32(HDC32,INT32,INT32,INT32,INT32,INT32,INT32,INT32,INT32 INT16 WINAPI ClearCommBreak16(INT16); BOOL32 WINAPI ClearCommBreak32(INT32); #define ClearCommBreak WINELIB_NAME(ClearCommBreak) -BOOL16 WINAPI ClientToScreen16(HWND16,LPPOINT16); +VOID WINAPI ClientToScreen16(HWND16,LPPOINT16); BOOL32 WINAPI ClientToScreen32(HWND32,LPPOINT32); #define ClientToScreen WINELIB_NAME(ClientToScreen) BOOL16 WINAPI ClipCursor16(const RECT16*); @@ -5889,6 +5939,9 @@ HDC32 WINAPI CreateIC32W(LPCWSTR,LPCWSTR,LPCWSTR,const DEVMODE32W*); HICON16 WINAPI CreateIcon16(HINSTANCE16,INT16,INT16,BYTE,BYTE,LPCVOID,LPCVOID); HICON32 WINAPI CreateIcon32(HINSTANCE32,INT32,INT32,BYTE,BYTE,LPCVOID,LPCVOID); #define CreateIcon WINELIB_NAME(CreateIcon) +HICON16 WINAPI CreateIconFromResourceEx16(LPBYTE,UINT16,BOOL16,DWORD,INT16,INT16,UINT16); +HICON32 WINAPI CreateIconFromResourceEx32(LPBYTE,UINT32,BOOL32,DWORD,INT32,INT32,UINT32); +#define CreateIconFromResourceEx WINELIB_NAME(CreateIconFromResourceEx) HMENU16 WINAPI CreateMenu16(void); HMENU32 WINAPI CreateMenu32(void); #define CreateMenu WINELIB_NAME(CreateMenu) @@ -6477,7 +6530,7 @@ DWORD WINAPI GetModuleFileName32W(HMODULE32,LPWSTR,DWORD); #define GetModuleFileName WINELIB_NAME_AW(GetModuleFileName) HMODULE16 WINAPI GetModuleHandle16(LPCSTR); HMODULE32 WINAPI GetModuleHandle32A(LPCSTR); -HMODULE32 WINAPI GetModuleHandle32W(LPCSTR); +HMODULE32 WINAPI GetModuleHandle32W(LPCWSTR); #define GetModuleHandle WINELIB_NAME_AW(GetModuleHandle) DWORD WINAPI GetNearestColor16(HDC16,DWORD); DWORD WINAPI GetNearestColor32(HDC32,DWORD); @@ -6910,9 +6963,12 @@ HICON32 WINAPI LoadIcon32A(HINSTANCE32,LPCSTR); HICON32 WINAPI LoadIcon32W(HINSTANCE32,LPCWSTR); #define LoadIcon WINELIB_NAME_AW(LoadIcon) HINSTANCE16 WINAPI LoadLibrary16(LPCSTR); -HINSTANCE32 WINAPI LoadLibrary32A(LPCSTR); -HINSTANCE32 WINAPI LoadLibrary32W(LPCWSTR); +HMODULE32 WINAPI LoadLibrary32A(LPCSTR); +HMODULE32 WINAPI LoadLibrary32W(LPCWSTR); #define LoadLibrary WINELIB_NAME_AW(LoadLibrary) +HMODULE32 WINAPI LoadLibraryEx32A(LPCSTR,HFILE32,DWORD); +HMODULE32 WINAPI LoadLibraryEx32W(LPCWSTR,HFILE32,DWORD); +#define LoadLibraryEx WINELIB_NAME_AW(LoadLibraryEx) HMENU16 WINAPI LoadMenu16(HINSTANCE16,SEGPTR); HMENU32 WINAPI LoadMenu32A(HINSTANCE32,LPCSTR); HMENU32 WINAPI LoadMenu32W(HINSTANCE32,LPCWSTR); @@ -7699,12 +7755,12 @@ INT32 WINAPIV wsprintf32A(LPSTR,LPCSTR,...); INT32 WINAPIV wsprintf32W(LPWSTR,LPCWSTR,...); #define wsprintf WINELIB_NAME_AW(wsprintf) INT16 WINAPI wvsnprintf16(LPSTR,UINT16,LPCSTR,LPCVOID); -INT32 WINAPI wvsnprintf32A(LPSTR,UINT32,LPCSTR,LPCVOID); -INT32 WINAPI wvsnprintf32W(LPWSTR,UINT32,LPCWSTR,LPCVOID); +INT32 WINAPI wvsnprintf32A(LPSTR,UINT32,LPCSTR,va_list); +INT32 WINAPI wvsnprintf32W(LPWSTR,UINT32,LPCWSTR,va_list); #define wvsnprintf WINELIB_NAME_AW(wvsnprintf) INT16 WINAPI wvsprintf16(LPSTR,LPCSTR,LPCVOID); -INT32 WINAPI wvsprintf32A(LPSTR,LPCSTR,LPCVOID); -INT32 WINAPI wvsprintf32W(LPWSTR,LPCWSTR,LPCVOID); +INT32 WINAPI wvsprintf32A(LPSTR,LPCSTR,va_list); +INT32 WINAPI wvsprintf32W(LPWSTR,LPCWSTR,va_list); #define wvsprintf WINELIB_NAME_AW(wvsprintf) LONG WINAPI _hread16(HFILE16,LPVOID,LONG); LONG WINAPI _hread32(HFILE32,LPVOID,LONG); diff --git a/include/winnls.h b/include/winnls.h index b0bb86b6173..11704abb156 100644 --- a/include/winnls.h +++ b/include/winnls.h @@ -1,6 +1,10 @@ #ifndef __WINE_WINNLS_H #define __WINE_WINNLS_H +/* flags to GetLocaleInfo */ +#define LOCALE_NOUSEROVERRIDE 0x80000000 +#define LOCALE_USE_CP_ACP 0x40000000 + /* When adding new defines, don't forget to add an entry to the * locale2id map in misc/ole2nls.c */ @@ -103,6 +107,8 @@ #define LOCALE_IPOSSEPBYSPACE 0x00000055 #define LOCALE_INEGSYMPRECEDES 0x00000056 #define LOCALE_INEGSEPBYSPACE 0x00000057 +#define LOCALE_FONTSIGNATURE 0x00000058 + #define NORM_IGNORECASE 1 #define NORM_IGNORENONSPACE 2 @@ -129,4 +135,15 @@ #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT)) #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT)) +/* Locale Dependent Mapping Flags */ +#define LCMAP_LOWERCASE 0x00000100 /* lower case letters */ +#define LCMAP_UPPERCASE 0x00000200 /* upper case letters */ +#define LCMAP_SORTKEY 0x00000400 /* WC sort key (normalize) */ +#define LCMAP_BYTEREV 0x00000800 /* byte reversal */ + +#define LCMAP_HIRAGANA 0x00100000 /* map katakana to hiragana */ +#define LCMAP_KATAKANA 0x00200000 /* map hiragana to katakana */ +#define LCMAP_HALFWIDTH 0x00400000 /* map double byte to single byte */ +#define LCMAP_FULLWIDTH 0x00800000 /* map single byte to double byte */ + #endif /* __WINE_WINNLS_H */ diff --git a/include/winnt.h b/include/winnt.h index dc6b7cd8dfe..666452703fc 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -278,7 +278,7 @@ typedef struct _EXCEPTION_POINTERS * function pointer to a exception filter */ -typedef LONG (*PTOP_LEVEL_EXCEPTION_FILTER)(PEXCEPTION_POINTERS ExceptionInfo); +typedef LONG (CALLBACK *PTOP_LEVEL_EXCEPTION_FILTER)(PEXCEPTION_POINTERS ExceptionInfo); typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER; DWORD WINAPI UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers ); diff --git a/include/winproc.h b/include/winproc.h index c6018988c44..592b3570302 100644 --- a/include/winproc.h +++ b/include/winproc.h @@ -77,8 +77,6 @@ extern void WINPROC_UnmapMsg32WTo16( UINT32 msg, WPARAM32 wParam, LPARAM lParam, MSGPARAM16* pm16 ); typedef LRESULT (*WINPROC_CALLWNDPROC16)(WNDPROC16,HWND16,UINT16,WPARAM16,LPARAM); -typedef LRESULT (*WINPROC_CALLWNDPROC32)(WNDPROC32,HWND32,UINT32,WPARAM32,LPARAM); extern void WINPROC_SetCallWndProc16( WINPROC_CALLWNDPROC16 proc ); -extern void WINPROC_SetCallWndProc32( WINPROC_CALLWNDPROC32 proc ); #endif /* __WINE_WINPROC_H */ diff --git a/include/wintypes.h b/include/wintypes.h index 26269212d4e..f420b394dae 100644 --- a/include/wintypes.h +++ b/include/wintypes.h @@ -66,27 +66,20 @@ /* Calling conventions definitions */ -#ifdef not_used_yet - #ifdef __i386__ # if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ >= 7) # define __stdcall __attribute__((__stdcall__)) # define __cdecl __attribute__((__cdecl__)) +# define __RESTORE_ES __asm__ __volatile__("pushw %ds\n\tpopw %es") # else # error You need gcc >= 2.7 to build Wine on a 386 # endif /* __GNUC__ */ #else /* __i386__ */ -# define __stdcall /* nothing */ -# define __cdecl /* nothing */ +# define __stdcall +# define __cdecl +# define __RESTORE_ES #endif /* __i386__ */ -#else /* not_used_yet */ - -# define __stdcall /* nothing */ -# define __cdecl /* nothing */ - -#endif /* not_used_yet */ - #define CALLBACK __stdcall #define WINAPI __stdcall #define APIPRIVATE __stdcall @@ -131,6 +124,7 @@ typedef HANDLE32 HHOOK; typedef HANDLE32 HKEY; typedef HANDLE32 HMIXEROBJ; typedef DWORD LCID; +typedef WORD LANGID; typedef DWORD LCTYPE; /* Pointers types. These are the same for emulator and library. */ @@ -195,6 +189,7 @@ DECLARE_HANDLE(HWAVE); DECLARE_HANDLE(HWAVEIN); DECLARE_HANDLE(HWAVEOUT); DECLARE_HANDLE(HWND); +DECLARE_HANDLE(HKL); #undef DECLARE_HANDLE /* Callback function pointers types */ diff --git a/library/Makefile.in b/library/Makefile.in index dce38c735f0..c2bd7e8bbd8 100644 --- a/library/Makefile.in +++ b/library/Makefile.in @@ -9,8 +9,7 @@ LIBMODULE = library LIB_SRCS = \ arch.c \ libres.c \ - miscstubs.c \ - sup.c + miscstubs.c STUB_SRCS = winestub.c diff --git a/library/miscstubs.c b/library/miscstubs.c index c472441c5cb..091a4b176f7 100644 --- a/library/miscstubs.c +++ b/library/miscstubs.c @@ -15,7 +15,6 @@ /* for windows/winproc.c */ void CallFrom16_long_wwwll(void) {} -void CallFrom32_stdcall_5(void) {} extern LRESULT ColorDlgProc(HWND16,UINT16,WPARAM16,LPARAM); extern LRESULT FileOpenDlgProc(HWND16,UINT16,WPARAM16,LPARAM); diff --git a/library/sup.c b/library/sup.c deleted file mode 100644 index 52456181140..00000000000 --- a/library/sup.c +++ /dev/null @@ -1,104 +0,0 @@ -#include -#include -#include "windows.h" -#include "arch.h" -#include "neexe.h" - -/* - * Header loading routines for WineLib. - */ - -/* LOADSHORT Calls LOAD and swaps the high and the low bytes */ - -#define LOAD(x) read (fd, &TAB->x, sizeof (TAB->x)) -#define LOADSHORT(x) LOAD(x); TAB->x = CONV_SHORT (TAB->x); -#define LOADLONG(x) LOAD(x); TAB->x = CONV_LONG (TAB->x); - -void load_mz_header (int fd, LPIMAGE_DOS_HEADER mz_header) -{ -#define TAB mz_header - LOAD(e_magic); - LOADSHORT(e_cblp); - LOADSHORT(e_cp); - LOADSHORT(e_crlc); - LOADSHORT(e_cparhdr); - LOADSHORT(e_minalloc); - LOADSHORT(e_maxalloc); - LOADSHORT(e_ss); - LOADSHORT(e_sp); - LOADSHORT(e_csum); - LOADSHORT(e_ip); - LOADSHORT(e_cs); - LOADSHORT(e_lfarlc); - LOADSHORT(e_ovno); - LOAD(e_res); - LOADSHORT(e_oemid); - LOADSHORT(e_oeminfo); - LOAD(e_res2); - LOADLONG(e_lfanew); -} - -void load_ne_header (int fd, LPIMAGE_OS2_HEADER ne_header) -{ -#undef TAB -#define TAB ne_header - LOAD (ne_magic); - LOADSHORT (linker_version); - LOADSHORT (linker_revision); - LOADSHORT (entry_tab_offset); - LOADSHORT (entry_tab_length); - LOAD (reserved1); - LOADSHORT (format_flags); - LOADSHORT (auto_data_seg); - LOADSHORT (local_heap_length); - LOADSHORT (stack_length); - LOADSHORT (ip); - LOADSHORT (cs); - LOADSHORT (sp); - LOADSHORT (ss); - LOADSHORT (n_segment_tab); - LOADSHORT (n_mod_ref_tab); - LOADSHORT (nrname_tab_length); - LOADSHORT (segment_tab_offset); - LOADSHORT (resource_tab_offset); - LOADSHORT (rname_tab_offset); - LOADSHORT (moduleref_tab_offset); - LOADSHORT (iname_tab_offset); - LOADLONG (nrname_tab_offset); - LOADSHORT (n_mov_entry_points); - LOADSHORT (align_shift_count); - LOADSHORT (n_resource_seg); - LOAD (operating_system); - LOAD (additional_flags); - LOADSHORT (fastload_offset); - LOADSHORT (fastload_length); - LOADSHORT (reserved2); - LOADSHORT (expect_version); -} - -/* - * Typeinfo loading routines for non PC-architectures. - */ - -int load_typeinfo (int fd, struct resource_typeinfo_s *typeinfo) -{ -#undef TAB -#define TAB typeinfo - LOADSHORT (type_id); - LOADSHORT (count); - LOADLONG (reserved); - return 1; -} - -int load_nameinfo (int fd, struct resource_nameinfo_s *nameinfo) -{ -#undef TAB -#define TAB nameinfo - LOADSHORT (offset); - LOADSHORT (length); - LOADSHORT (flags); - LOADSHORT (id); - LOADSHORT (handle); - LOADSHORT (usage); - return 0; -} diff --git a/loader/module.c b/loader/module.c index a41ce3749ab..c40d240454b 100644 --- a/loader/module.c +++ b/loader/module.c @@ -18,6 +18,7 @@ #include "hook.h" #include "module.h" #include "neexe.h" +#include "resource.h" #include "selectors.h" #include "stackframe.h" #include "task.h" @@ -26,7 +27,7 @@ #include "debug.h" #include "callback.h" -extern HINSTANCE16 PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params ); +extern HINSTANCE16 PE_LoadModule( HFILE32 hf, OFSTRUCT *ofs, LOADPARAMS* params ); static HMODULE16 hFirstModule = 0; static HMODULE16 hCachedModule = 0; /* Module cached by MODULE_OpenFile */ @@ -35,19 +36,70 @@ static HMODULE16 hCachedModule = 0; /* Module cached by MODULE_OpenFile */ /*********************************************************************** * MODULE_GetPtr */ -NE_MODULE *MODULE_GetPtr( HMODULE16 hModule ) +NE_MODULE *MODULE_GetPtr( HMODULE32 hModule ) { - NE_MODULE *pModule = (NE_MODULE *)GlobalLock16( hModule ); - if (!pModule || (pModule->magic != IMAGE_OS2_SIGNATURE) || - (pModule->self != hModule)) return NULL; - return pModule; + HMODULE16 hnd =MODULE_HANDLEtoHMODULE16(hModule); + + if (!hnd) + return NULL; + return (NE_MODULE*)GlobalLock16(hnd); } +/*********************************************************************** + * MODULE_HANDLEtoHMODULE16 + */ +HMODULE16 +MODULE_HANDLEtoHMODULE16(HANDLE32 handle) { + NE_MODULE *pModule; + + if (HIWORD(handle)) { + /* this is a HMODULE32 aka pe->mappeddll */ + + /* walk the list looking for the correct startaddress */ + pModule = (NE_MODULE *)GlobalLock16( hFirstModule ); + while (pModule) { + if ( ((pModule->flags&(NE_FFLAGS_BUILTIN|NE_FFLAGS_WIN32))==NE_FFLAGS_WIN32) && + pModule->pe_module && + ((HMODULE32)pModule->pe_module->mappeddll == handle) + ) + return pModule->self; + pModule=(NE_MODULE*)GlobalLock16(pModule->next); + } + return 0; + } + return GetExePtr(handle); +} + +/*********************************************************************** + * MODULE_HANDLEtoHMODULE32 + * return HMODULE32, if possible, HMODULE16 otherwise + */ +HMODULE32 +MODULE_HANDLEtoHMODULE32(HANDLE32 handle) { + NE_MODULE *pModule; + + if (HIWORD(handle)) + return (HMODULE32)handle; + else { + handle = GetExePtr(handle); + if (!handle) + return 0; + pModule = (NE_MODULE *)GlobalLock16( handle ); + if (!pModule) + return 0; + + if ( ((pModule->flags&(NE_FFLAGS_BUILTIN|NE_FFLAGS_WIN32))==NE_FFLAGS_WIN32) && + pModule->pe_module + ) + return (HMODULE32)pModule->pe_module->mappeddll; + return handle; + } +} /*********************************************************************** * MODULE_DumpModule */ -void MODULE_DumpModule( HMODULE16 hModule ) +void MODULE_DumpModule( HMODULE32 hModule ) { int i, ordinal; SEGTABLEENTRY *pSeg; @@ -210,7 +262,7 @@ void MODULE_WalkModules(void) /*********************************************************************** * MODULE_OpenFile */ -int MODULE_OpenFile( HMODULE16 hModule ) +int MODULE_OpenFile( HMODULE32 hModule ) { NE_MODULE *pModule; DOS_FULL_NAME full_name; @@ -218,7 +270,7 @@ int MODULE_OpenFile( HMODULE16 hModule ) static int cachedfd = -1; - hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ + hModule = MODULE_HANDLEtoHMODULE16(hModule); dprintf_module( stddeb, "MODULE_OpenFile(%04x) cache: mod=%04x fd=%d\n", hModule, hCachedModule, cachedfd ); if (!(pModule = MODULE_GetPtr( hModule ))) return -1; @@ -275,7 +327,7 @@ DWORD WINAPI MODULE_AllocateSegment(WORD wFlags, WORD wSize, WORD wElem) /*********************************************************************** * MODULE_CreateSegments */ -static BOOL32 MODULE_CreateSegments( HMODULE16 hModule ) +static BOOL32 MODULE_CreateSegments( HMODULE32 hModule ) { SEGTABLEENTRY *pSegment; NE_MODULE *pModule; @@ -306,7 +358,7 @@ static BOOL32 MODULE_CreateSegments( HMODULE16 hModule ) /*********************************************************************** * MODULE_GetInstance */ -HINSTANCE16 MODULE_GetInstance( HMODULE16 hModule ) +HINSTANCE16 MODULE_GetInstance( HMODULE32 hModule ) { SEGTABLEENTRY *pSegment; NE_MODULE *pModule; @@ -359,12 +411,13 @@ HINSTANCE16 MODULE_CreateInstance( HMODULE16 hModule, LOADPARAMS *params ) * * Create a dummy NE module for Win32 or Winelib. */ -HMODULE16 MODULE_CreateDummyModule( const OFSTRUCT *ofs ) +HMODULE32 MODULE_CreateDummyModule( const OFSTRUCT *ofs ) { - HMODULE16 hModule; + HMODULE32 hModule; NE_MODULE *pModule; SEGTABLEENTRY *pSegment; - char *pStr,*basename,*s; + char *pStr,*s; + const char* basename; INT32 of_size = sizeof(OFSTRUCT) - sizeof(ofs->szPathName) + strlen(ofs->szPathName) + 1; @@ -379,7 +432,7 @@ HMODULE16 MODULE_CreateDummyModule( const OFSTRUCT *ofs ) 8; hModule = GlobalAlloc16( GMEM_MOVEABLE | GMEM_ZEROINIT, size ); - if (!hModule) return (HMODULE16)11; /* invalid exe */ + if (!hModule) return (HMODULE32)11; /* invalid exe */ FarSetOwner( hModule, hModule ); pModule = (NE_MODULE *)GlobalLock16( hModule ); @@ -432,7 +485,7 @@ HMODULE16 MODULE_CreateDummyModule( const OFSTRUCT *ofs ) *pStr = strlen(basename); if (*pStr>8) *pStr=8; strncpy( pStr+1, basename, 8 ); - free(basename); + free((void*)basename); pStr += 9; /* All tables zero terminated */ @@ -447,12 +500,12 @@ HMODULE16 MODULE_CreateDummyModule( const OFSTRUCT *ofs ) /*********************************************************************** * MODULE_LoadExeHeader */ -static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs ) +static HMODULE32 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs ) { IMAGE_DOS_HEADER mz_header; IMAGE_OS2_HEADER ne_header; int size; - HMODULE16 hModule; + HMODULE32 hModule; NE_MODULE *pModule; BYTE *pData; char *buffer, *fastload = NULL; @@ -469,18 +522,18 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs ) _llseek32( hFile, 0, SEEK_SET ); if ((_lread32(hFile,&mz_header,sizeof(mz_header)) != sizeof(mz_header)) || (mz_header.e_magic != IMAGE_DOS_SIGNATURE)) - return (HMODULE16)11; /* invalid exe */ + return (HMODULE32)11; /* invalid exe */ _llseek32( hFile, mz_header.e_lfanew, SEEK_SET ); if (_lread32( hFile, &ne_header, sizeof(ne_header) ) != sizeof(ne_header)) - return (HMODULE16)11; /* invalid exe */ + return (HMODULE32)11; /* invalid exe */ - if (ne_header.ne_magic == IMAGE_NT_SIGNATURE) return (HMODULE16)21; /* win32 exe */ - if (ne_header.ne_magic != IMAGE_OS2_SIGNATURE) return (HMODULE16)11; /* invalid exe */ + if (ne_header.ne_magic == IMAGE_NT_SIGNATURE) return (HMODULE32)21; /* win32 exe */ + if (ne_header.ne_magic != IMAGE_OS2_SIGNATURE) return (HMODULE32)11; /* invalid exe */ if (ne_header.ne_magic == IMAGE_OS2_SIGNATURE_LX) { fprintf(stderr, "Sorry, this is an OS/2 linear executable (LX) file !\n"); - return (HMODULE16)11; + return (HMODULE32)11; } /* We now have a valid NE header */ @@ -501,7 +554,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs ) ne_header.entry_tab_length; hModule = GlobalAlloc16( GMEM_MOVEABLE | GMEM_ZEROINIT, size ); - if (!hModule) return (HMODULE16)11; /* invalid exe */ + if (!hModule) return (HMODULE32)11; /* invalid exe */ FarSetOwner( hModule, hModule ); pModule = (NE_MODULE *)GlobalLock16( hModule ); memcpy( pModule, &ne_header, sizeof(ne_header) ); @@ -560,7 +613,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs ) HeapFree( SystemHeap, 0, buffer ); if (fastload) HeapFree( SystemHeap, 0, fastload ); GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return (HMODULE32)11; /* invalid exe */ } pSeg = (struct ne_segment_table_entry_s *)buffer; for (i = ne_header.n_segment_tab; i > 0; i--, pSeg++) @@ -574,7 +627,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs ) { if (fastload) HeapFree( SystemHeap, 0, fastload ); GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return (HMODULE32)11; /* invalid exe */ } /* Get the resource table */ @@ -584,8 +637,9 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs ) pModule->res_table = (int)pData - (int)pModule; if (!READ(mz_header.e_lfanew + ne_header.resource_tab_offset, ne_header.rname_tab_offset - ne_header.resource_tab_offset, - pData )) return (HMODULE16)11; /* invalid exe */ + pData )) return (HMODULE32)11; /* invalid exe */ pData += ne_header.rname_tab_offset - ne_header.resource_tab_offset; + NE_InitResourceHandler( hModule ); } else pModule->res_table = 0; /* No resource table */ @@ -598,7 +652,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs ) { if (fastload) HeapFree( SystemHeap, 0, fastload ); GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return (HMODULE32)11; /* invalid exe */ } pData += ne_header.moduleref_tab_offset - ne_header.rname_tab_offset; @@ -613,7 +667,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs ) { if (fastload) HeapFree( SystemHeap, 0, fastload ); GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return (HMODULE32)11; /* invalid exe */ } pData += ne_header.n_mod_ref_tab * sizeof(WORD); } @@ -628,7 +682,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs ) { if (fastload) HeapFree( SystemHeap, 0, fastload ); GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return (HMODULE32)11; /* invalid exe */ } pData += ne_header.entry_tab_offset - ne_header.iname_tab_offset; @@ -641,7 +695,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs ) { if (fastload) HeapFree( SystemHeap, 0, fastload ); GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return (HMODULE32)11; /* invalid exe */ } pData += ne_header.entry_tab_length; @@ -659,7 +713,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs ) if (!pModule->nrname_handle) { GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return (HMODULE32)11; /* invalid exe */ } buffer = GlobalLock16( pModule->nrname_handle ); _llseek32( hFile, ne_header.nrname_tab_offset, SEEK_SET ); @@ -668,7 +722,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs ) { GlobalFree16( pModule->nrname_handle ); GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return (HMODULE32)11; /* invalid exe */ } } else pModule->nrname_handle = 0; @@ -678,13 +732,13 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs ) if (pModule->modref_count) { pModule->dlls_to_init = GLOBAL_Alloc(GMEM_ZEROINIT, - (pModule->modref_count+1)*sizeof(HMODULE16), + (pModule->modref_count+1)*sizeof(HMODULE32), hModule, FALSE, FALSE, FALSE ); if (!pModule->dlls_to_init) { if (pModule->nrname_handle) GlobalFree16( pModule->nrname_handle ); GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return (HMODULE32)11; /* invalid exe */ } } else pModule->dlls_to_init = 0; @@ -699,7 +753,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs ) * * Lookup the ordinal for a given name. */ -WORD MODULE_GetOrdinal( HMODULE16 hModule, const char *name ) +WORD MODULE_GetOrdinal( HMODULE32 hModule, const char *name ) { unsigned char buffer[256], *cpnt; BYTE len; @@ -763,7 +817,7 @@ WORD MODULE_GetOrdinal( HMODULE16 hModule, const char *name ) * * Return the entry point for a given ordinal. */ -FARPROC16 MODULE_GetEntryPoint( HMODULE16 hModule, WORD ordinal ) +FARPROC16 MODULE_GetEntryPoint( HMODULE32 hModule, WORD ordinal ) { NE_MODULE *pModule; WORD curOrdinal = 1; @@ -823,7 +877,7 @@ FARPROC16 WINAPI EntryAddrProc( HMODULE16 hModule, WORD ordinal ) * Change the value of an entry point. Use with caution! * It can only change the offset value, not the selector. */ -BOOL16 MODULE_SetEntryPoint( HMODULE16 hModule, WORD ordinal, WORD offset ) +BOOL16 MODULE_SetEntryPoint( HMODULE32 hModule, WORD ordinal, WORD offset ) { NE_MODULE *pModule; WORD curOrdinal = 1; @@ -872,7 +926,7 @@ FARPROC16 MODULE_GetWndProcEntry16( const char *name ) { WORD ordinal; FARPROC16 ret; - static HMODULE16 hModule = 0; + static HMODULE32 hModule = 0; if (!hModule) hModule = GetModuleHandle16( "WPROCS" ); ordinal = MODULE_GetOrdinal( hModule, name ); @@ -886,7 +940,7 @@ FARPROC16 MODULE_GetWndProcEntry16( const char *name ) /*********************************************************************** * MODULE_GetModuleName */ -LPSTR MODULE_GetModuleName( HMODULE16 hModule ) +LPSTR MODULE_GetModuleName( HMODULE32 hModule ) { NE_MODULE *pModule; BYTE *p, len; @@ -916,9 +970,9 @@ void MODULE_RegisterModule( NE_MODULE *pModule ) * * Find a module from a path name. */ -HMODULE16 MODULE_FindModule( LPCSTR path ) +HMODULE32 MODULE_FindModule( LPCSTR path ) { - HMODULE16 hModule = hFirstModule; + HMODULE32 hModule = hFirstModule; LPCSTR filename, dotptr, modulepath, modulename; BYTE len, *name_table; @@ -973,7 +1027,7 @@ static BOOL16 MODULE_CallWEP( HMODULE16 hModule ) * * Remove a module from memory. */ -static void MODULE_FreeModule( HMODULE16 hModule ) +BOOL16 MODULE_FreeModule( HMODULE32 hModule, TDB* pTaskContext ) { HMODULE16 *hPrevModule; NE_MODULE *pModule; @@ -981,17 +1035,28 @@ static void MODULE_FreeModule( HMODULE16 hModule ) HMODULE16 *pModRef; int i; - if (!(pModule = MODULE_GetPtr( hModule ))) return; + if (!(pModule = MODULE_GetPtr( hModule ))) return FALSE; + hModule = pModule->self; + + if (((INT16)(--pModule->count)) > 0 ) return TRUE; + else pModule->count = 0; + if (pModule->flags & NE_FFLAGS_BUILTIN) - return; /* Can't free built-in module */ + return FALSE; /* Can't free built-in module */ - if (pModule->flags & NE_FFLAGS_LIBMODULE) MODULE_CallWEP( hModule ); + if (pModule->flags & NE_FFLAGS_LIBMODULE) + { + MODULE_CallWEP( hModule ); - /* Free the objects owned by the module */ - - HOOK_FreeModuleHooks( hModule ); - CLASS_FreeModuleClasses( hModule ); + /* Free the objects owned by the DLL module */ + if( pTaskContext && pTaskContext->userhandler ) + { + pTaskContext->userhandler( hModule, USIG_DLL_UNLOAD, 0, + pTaskContext->hInstance, + pTaskContext->hQueue ); + } + } /* Clear magic number just in case */ pModule->magic = pModule->self = 0; @@ -1030,6 +1095,8 @@ static void MODULE_FreeModule( HMODULE16 hModule ) /* Remove module from cache */ if (hCachedModule == hModule) hCachedModule = 0; + + return TRUE; } @@ -1038,7 +1105,7 @@ static void MODULE_FreeModule( HMODULE16 hModule ) * * Implementation of LoadModule() */ -HINSTANCE16 MODULE_Load( LPCSTR name, LPVOID paramBlock, BOOL32 first ) +HINSTANCE16 MODULE_Load( LPCSTR name, LPVOID paramBlock, UINT16 uFlags) { HMODULE16 hModule; HINSTANCE16 hInstance, hPrevInstance; @@ -1080,10 +1147,9 @@ HINSTANCE16 MODULE_Load( LPCSTR name, LPVOID paramBlock, BOOL32 first ) hModule = MODULE_LoadExeHeader( hFile, &ofs ); if (hModule < 32) { - /* Note: PE_LoadModule closes the file */ if (hModule == 21) hModule = PE_LoadModule( hFile, &ofs, paramBlock ); - else _lclose32( hFile ); + else _lclose32( hFile ); if (hModule < 32) fprintf( stderr, "LoadModule: can't load '%s', error=%d\n", @@ -1092,6 +1158,7 @@ HINSTANCE16 MODULE_Load( LPCSTR name, LPVOID paramBlock, BOOL32 first ) } _lclose32( hFile ); pModule = MODULE_GetPtr( hModule ); + pModule->flags |= uFlags; /* stamp implicitly loaded modules */ /* Allocate the segments for this module */ @@ -1117,7 +1184,7 @@ HINSTANCE16 MODULE_Load( LPCSTR name, LPVOID paramBlock, BOOL32 first ) /* its handle in the list of DLLs to initialize. */ HMODULE16 hDLL; - if ((hDLL = MODULE_Load( buffer, (LPVOID)-1, FALSE )) == 2) + if ((hDLL = MODULE_Load( buffer, (LPVOID)-1, NE_FFLAGS_IMPLICIT )) == 2) { /* file not found */ char *p; @@ -1127,15 +1194,17 @@ HINSTANCE16 MODULE_Load( LPCSTR name, LPVOID paramBlock, BOOL32 first ) if (!(p = strrchr( buffer, '\\' ))) p = buffer; memcpy( p + 1, pstr + 1, *pstr ); strcpy( p + 1 + *pstr, ".dll" ); - hDLL = MODULE_Load( buffer, (LPVOID)-1, FALSE ); + hDLL = MODULE_Load( buffer, (LPVOID)-1, NE_FFLAGS_IMPLICIT ); } if (hDLL < 32) { + /* FIXME: cleanup what was done */ + fprintf( stderr, "Could not load '%s' required by '%s', error = %d\n", buffer, name, hDLL ); return 2; /* file not found */ } - *pModRef = GetExePtr( hDLL ); + *pModRef = MODULE_HANDLEtoHMODULE16( hDLL ); *pDLLs++ = *pModRef; } else /* Increment the reference count of the DLL */ @@ -1158,11 +1227,12 @@ HINSTANCE16 MODULE_Load( LPCSTR name, LPVOID paramBlock, BOOL32 first ) HMODULE16 hselfload = GetModuleHandle16("WPROCS"); DWORD oldstack; WORD saved_dgroup = pSegTable[pModule->dgroup - 1].selector; - fprintf (stderr, "Warning: %*.*s is a self-loading module\n" - "Support for self-loading modules is very experimental\n", - *((BYTE*)pModule + pModule->name_table), - *((BYTE*)pModule + pModule->name_table), - (char *)pModule + pModule->name_table + 1); + + dprintf_module(stddeb, "MODULE_Load: %*.*s is a self-loading module!\n", + *((BYTE*)pModule + pModule->name_table), + *((BYTE*)pModule + pModule->name_table), + (char *)pModule + pModule->name_table + 1); + NE_LoadSegment( hModule, 1 ); selfloadheader = (SELFLOADHEADER *) PTR_SEG_OFF_TO_LIN(pSegTable->selector, 0); @@ -1210,7 +1280,8 @@ HINSTANCE16 MODULE_Load( LPCSTR name, LPVOID paramBlock, BOOL32 first ) frame32->ecx = 0; frame32->ebx = 0; frame32->ebp = 0; - frame32->retaddr = 0; + frame32->restore_addr = 0; + frame32->retaddr = 0; frame32->codeselector = WINE_CODE_SELECTOR; /* pTask->esp = (DWORD)frame32; */ } @@ -1242,10 +1313,14 @@ HINSTANCE16 MODULE_Load( LPCSTR name, LPVOID paramBlock, BOOL32 first ) pModule->count = 1; - if (first && (pModule->flags & NE_FFLAGS_LIBMODULE)) - NE_InitializeDLLs( hModule ); + /* Call initialization rountines for all loaded DLLs. Note that + * when we load implicitly linked DLLs this will be done by the InitTask(). + */ + + if ((pModule->flags & (NE_FFLAGS_LIBMODULE | NE_FFLAGS_IMPLICIT)) == + NE_FFLAGS_LIBMODULE ) NE_InitializeDLLs( hModule ); } - else + else /* module is already loaded, just create a new data segment if it's a task */ { pModule = MODULE_GetPtr( hModule ); hPrevInstance = MODULE_GetInstance( hModule ); @@ -1254,6 +1329,7 @@ HINSTANCE16 MODULE_Load( LPCSTR name, LPVOID paramBlock, BOOL32 first ) NE_LoadSegment( hModule, pModule->dgroup ); pModule->count++; } + #else lstrcpyn32A( ofs.szPathName, name, sizeof(ofs.szPathName) ); if ((hModule = MODULE_CreateDummyModule( &ofs )) < 32) return hModule; @@ -1269,6 +1345,8 @@ HINSTANCE16 MODULE_Load( LPCSTR name, LPVOID paramBlock, BOOL32 first ) HTASK16 hTask; WORD showcmd; + pModule->flags |= NE_FFLAGS_GUI; + /* PowerPoint passes NULL as showCmd */ if (params->showCmd) showcmd = *((WORD *)PTR_SEG_TO_LIN(params->showCmd)+1); @@ -1292,7 +1370,7 @@ HINSTANCE16 MODULE_Load( LPCSTR name, LPVOID paramBlock, BOOL32 first ) */ HINSTANCE16 LoadModule16( LPCSTR name, LPVOID paramBlock ) { - return MODULE_Load( name, paramBlock, TRUE ); + return MODULE_Load( name, paramBlock, 0 ); } @@ -1303,13 +1381,11 @@ BOOL16 WINAPI FreeModule16( HMODULE16 hModule ) { NE_MODULE *pModule; - hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ if (!(pModule = MODULE_GetPtr( hModule ))) return FALSE; - dprintf_module( stddeb, "FreeModule16: %s count %d\n", MODULE_GetModuleName(hModule), pModule->count ); - if (--pModule->count == 0) MODULE_FreeModule( hModule ); - return TRUE; + + return MODULE_FreeModule( hModule, GlobalLock16(GetCurrentTask()) ); } @@ -1318,7 +1394,7 @@ BOOL16 WINAPI FreeModule16( HMODULE16 hModule ) */ HMODULE16 WINAPI WIN16_GetModuleHandle( SEGPTR name ) { - if (HIWORD(name) == 0) return GetExePtr( (HINSTANCE16)name ); + if (HIWORD(name) == 0) return MODULE_HANDLEtoHMODULE16( (HINSTANCE16)name ); return MODULE_FindModule( PTR_SEG_TO_LIN(name) ); } @@ -1327,6 +1403,33 @@ HMODULE16 WINAPI GetModuleHandle16( LPCSTR name ) return MODULE_FindModule( name ); } +/*********************************************************************** + * GetModuleHandle (KERNEL32.237) + */ +HMODULE32 WINAPI GetModuleHandle32A(LPCSTR module) +{ + HMODULE32 hModule; + + dprintf_win32(stddeb, "GetModuleHandleA: %s\n", module ? module : "NULL"); +/* Freecell uses the result of GetModuleHandleA(0) as the hInstance in +all calls to e.g. CreateWindowEx. */ + if (module == NULL) { + TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() ); + hModule = pTask->hInstance; + } else + hModule = MODULE_FindModule(module); + return MODULE_HANDLEtoHMODULE32(hModule); +} + +HMODULE32 WINAPI GetModuleHandle32W(LPCWSTR module) +{ + HMODULE32 hModule; + LPSTR modulea = HEAP_strdupWtoA( GetProcessHeap(), 0, module ); + hModule = GetModuleHandle32A( modulea ); + HeapFree( GetProcessHeap(), 0, modulea ); + return hModule; +} + /********************************************************************** * GetModuleUsage (KERNEL.48) @@ -1335,7 +1438,6 @@ INT16 WINAPI GetModuleUsage( HINSTANCE16 hModule ) { NE_MODULE *pModule; - hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ if (!(pModule = MODULE_GetPtr( hModule ))) return 0; dprintf_module( stddeb, "GetModuleUsage(%04x): returning %d\n", hModule, pModule->count ); @@ -1352,7 +1454,6 @@ INT16 WINAPI GetModuleFileName16( HINSTANCE16 hModule, LPSTR lpFileName, NE_MODULE *pModule; if (!hModule) hModule = GetCurrentTask(); - hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ if (!(pModule = MODULE_GetPtr( hModule ))) return 0; lstrcpyn32A( lpFileName, NE_MODULE_NAME(pModule), nSize ); dprintf_module( stddeb, "GetModuleFileName16: %s\n", lpFileName ); @@ -1373,7 +1474,6 @@ DWORD WINAPI GetModuleFileName32A( HMODULE32 hModule, LPSTR lpFileName, TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() ); hModule = pTask->hInstance; } - hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ if (!(pModule = MODULE_GetPtr( hModule ))) return 0; lstrcpyn32A( lpFileName, NE_MODULE_NAME(pModule), size ); dprintf_module( stddeb, "GetModuleFileName32A: %s\n", lpFileName ); @@ -1410,16 +1510,72 @@ BOOL16 WINAPI GetModuleName( HINSTANCE16 hinst, LPSTR buf, INT16 nSize ) /*********************************************************************** * LoadLibraryEx32W (KERNEL.513) + * FIXME */ -HINSTANCE16 WINAPI LoadLibraryEx32W16( LPCSTR libname, HANDLE16 hf, +HMODULE32 WINAPI LoadLibraryEx32W16( LPCSTR libname, HANDLE16 hf, DWORD flags ) { fprintf(stderr,"LoadLibraryEx32W(%s,%d,%08lx)\n",libname,hf,flags); - if (!flags && !hf) - return LoadLibrary32A(libname); - return 0; + return LoadLibraryEx32A(libname,hf,flags); } +/*********************************************************************** + * LoadLibraryEx32A (KERNEL32) + */ +HMODULE32 WINAPI LoadLibraryEx32A(LPCSTR libname,HFILE32 hfile,DWORD flags) +{ + HMODULE32 hmod; + + hmod = PE_LoadLibraryEx32A(libname,hfile,flags); + if (hmod <= 32) { + char buffer[256]; + + strcpy( buffer, libname ); + strcat( buffer, ".dll" ); + hmod = PE_LoadLibraryEx32A(buffer,hfile,flags); + } + /* initialize all DLLs, which haven't been initialized yet. */ + PE_InitializeDLLs( GetCurrentProcessId(), DLL_PROCESS_ATTACH, NULL); + return hmod; +} + +/*********************************************************************** + * LoadLibraryA (KERNEL32) + */ +HMODULE32 WINAPI LoadLibrary32A(LPCSTR libname) { + return LoadLibraryEx32A(libname,0,0); +} + +/*********************************************************************** + * LoadLibraryW (KERNEL32) + */ +HMODULE32 WINAPI LoadLibrary32W(LPCWSTR libnameW) +{ + return LoadLibraryEx32W(libnameW,0,0); +} + +/*********************************************************************** + * LoadLibraryExW (KERNEL32) + */ +HMODULE32 WINAPI LoadLibraryEx32W(LPCWSTR libnameW,HFILE32 hfile,DWORD flags) +{ + LPSTR libnameA = HEAP_strdupWtoA( GetProcessHeap(), 0, libnameW ); + HMODULE32 ret = LoadLibraryEx32A( libnameA , hfile, flags ); + + HeapFree( GetProcessHeap(), 0, libnameA ); + return ret; +} + +/*********************************************************************** + * FreeLibrary + */ +BOOL32 WINAPI FreeLibrary32(HINSTANCE32 hLibModule) +{ + fprintf(stderr,"FreeLibrary: empty stub\n"); + return TRUE; +} + + /*********************************************************************** * LoadLibrary (KERNEL.95) */ @@ -1434,17 +1590,13 @@ HINSTANCE16 WINAPI LoadLibrary16( LPCSTR libname ) } dprintf_module( stddeb, "LoadLibrary: (%08x) %s\n", (int)libname, libname); - /* This does not increment the module reference count, and will - * therefore cause crashes on FreeLibrary calls. - if ((handle = MODULE_FindModule( libname )) != 0) return handle; - */ - handle = MODULE_Load( libname, (LPVOID)-1, TRUE ); + handle = MODULE_Load( libname, (LPVOID)-1, 0 ); if (handle == (HINSTANCE16)2) /* file not found */ { char buffer[256]; lstrcpyn32A( buffer, libname, 252 ); strcat( buffer, ".dll" ); - handle = MODULE_Load( buffer, (LPVOID)-1, TRUE ); + handle = MODULE_Load( buffer, (LPVOID)-1, 0 ); } return handle; } @@ -1486,7 +1638,7 @@ HINSTANCE32 WINAPI WinExec32( LPCSTR lpCmdLine, UINT32 nCmdShow ) return 2; /* File not found */ if (!(cmdShowHandle = GlobalAlloc16( 0, 2 * sizeof(WORD) ))) return 8; /* Out of memory */ - if (!(cmdLineHandle = GlobalAlloc16( 0, 256 ))) + if (!(cmdLineHandle = GlobalAlloc16( 0, 1024 ))) { GlobalFree16( cmdShowHandle ); return 8; /* Out of memory */ @@ -1531,7 +1683,7 @@ HINSTANCE32 WINAPI WinExec32( LPCSTR lpCmdLine, UINT32 nCmdShow ) } if (*p) - lstrcpyn32A( cmdline + 1, p + 1, 127 ); + lstrcpyn32A( cmdline + 1, p + 1, 1023 ); else cmdline[1] = '\0'; @@ -1645,7 +1797,7 @@ HINSTANCE32 WINAPI WinExec32( LPCSTR lpCmdLine, UINT32 nCmdShow ) * WIN32_GetProcAddress16 (KERNEL32.36) * Get procaddress in 16bit module from win32... (kernel32 undoc. ordinal func) */ -FARPROC16 WINAPI WIN32_GetProcAddress16( HMODULE16 hModule, LPSTR name ) +FARPROC16 WINAPI WIN32_GetProcAddress16( HMODULE32 hModule, LPSTR name ) { WORD ordinal; FARPROC16 ret; @@ -1654,7 +1806,7 @@ FARPROC16 WINAPI WIN32_GetProcAddress16( HMODULE16 hModule, LPSTR name ) fprintf(stderr,"WIN32_GetProcAddress16: hModule may not be 0!\n"); return (FARPROC16)0; } - hModule = GetExePtr(hModule); + hModule = MODULE_HANDLEtoHMODULE16(hModule); if (HIWORD(name)) { ordinal = MODULE_GetOrdinal( hModule, name ); dprintf_module( stddeb, "WIN32_GetProcAddress16: %04x '%s'\n", @@ -1679,7 +1831,7 @@ FARPROC16 WINAPI GetProcAddress16( HMODULE16 hModule, SEGPTR name ) FARPROC16 ret; if (!hModule) hModule = GetCurrentTask(); - hModule = GetExePtr( hModule ); + hModule = MODULE_HANDLEtoHMODULE16( hModule ); if (HIWORD(name) != 0) { @@ -1714,13 +1866,16 @@ FARPROC32 WINAPI GetProcAddress32( HMODULE32 hModule, LPCSTR function ) dprintf_win32(stddeb,"GetProcAddress32(%08lx,%s)\n",(DWORD)hModule,function); else dprintf_win32(stddeb,"GetProcAddress32(%08lx,%p)\n",(DWORD)hModule,function); - hModule = GetExePtr( hModule ); if (!(pModule = MODULE_GetPtr( hModule ))) return (FARPROC32)0; - if (!(pModule->flags & NE_FFLAGS_WIN32) || !pModule->pe_module) - return (FARPROC32)0; if (pModule->flags & NE_FFLAGS_BUILTIN) return BUILTIN_GetProcAddress32( pModule, function ); + if (!pModule->pe_module) { + fprintf(stderr,"Oops, Module 0x%08lx has got no pe_module?\n", + (DWORD)MODULE_HANDLEtoHMODULE32(hModule) + ); + return (FARPROC32)0; + } return PE_FindExportedFunction( pModule->pe_module, function ); #else return NULL; @@ -1732,14 +1887,20 @@ FARPROC32 WINAPI GetProcAddress32( HMODULE32 hModule, LPCSTR function ) */ LPIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE32 hModule) { + /* basically: + * return hModule+(((IMAGE_DOS_HEADER*)hModule)->e_lfanew); + * but we could get HMODULE16 or the like (think builtin modules) + */ + #ifndef WINELIB NE_MODULE *pModule; - hModule = GetExePtr( hModule ); if (!(pModule = MODULE_GetPtr( hModule ))) return (LPIMAGE_NT_HEADERS)0; if (!(pModule->flags & NE_FFLAGS_WIN32) || !pModule->pe_module) return (LPIMAGE_NT_HEADERS)0; + if (pModule->flags & NE_FFLAGS_BUILTIN) + return (LPIMAGE_NT_HEADERS)0; return pModule->pe_module->pe_header; #else return NULL; @@ -1763,7 +1924,7 @@ WORD WINAPI GetExpWinVer( HMODULE16 hModule ) BOOL16 WINAPI IsSharedSelector( HANDLE16 selector ) { /* Check whether the selector belongs to a DLL */ - NE_MODULE *pModule = MODULE_GetPtr( GetExePtr( selector )); + NE_MODULE *pModule = MODULE_GetPtr( selector ); if (!pModule) return FALSE; return (pModule->flags & NE_FFLAGS_LIBMODULE) != 0; } @@ -1815,7 +1976,7 @@ BOOL16 WINAPI ModuleFindName( MODULEENTRY *lpme, LPCSTR name ) */ BOOL16 WINAPI ModuleFindHandle( MODULEENTRY *lpme, HMODULE16 hModule ) { - hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ + hModule = MODULE_HANDLEtoHMODULE16( hModule ); lpme->wNext = hModule; return ModuleNext( lpme ); } diff --git a/loader/ne_image.c b/loader/ne_image.c index dd0ff092948..e1631e9c477 100644 --- a/loader/ne_image.c +++ b/loader/ne_image.c @@ -17,6 +17,7 @@ #include #include "neexe.h" #include "windows.h" +#include "task.h" #include "arch.h" #include "selectors.h" #include "callback.h" @@ -455,7 +456,7 @@ void NE_FixupPrologs( NE_MODULE *pModule ) * * Call the DLL initialization code */ -static BOOL32 NE_InitDLL( HMODULE16 hModule ) +static BOOL32 NE_InitDLL( TDB* pTask, HMODULE16 hModule ) { NE_MODULE *pModule; SEGTABLEENTRY *pSegTable; @@ -473,6 +474,17 @@ static BOOL32 NE_InitDLL( HMODULE16 hModule ) if (!(pModule->flags & NE_FFLAGS_LIBMODULE) || (pModule->flags & NE_FFLAGS_WIN32)) return TRUE; /*not a library*/ + + /* Call USER signal handler. This is necessary to install a + * proper loader for HICON and HCURSOR resources that this DLL + * may contain. InitApp() does this for task modules. */ + + if (pTask && pTask->userhandler) + { + pTask->userhandler( hModule, USIG_DLL_LOAD, 0, pTask->hInstance, + pTask->hQueue ); + } + if (!pModule->cs) return TRUE; /* no initialization code */ memset( &context, 0, sizeof(context) ); @@ -516,10 +528,12 @@ static BOOL32 NE_InitDLL( HMODULE16 hModule ) /*********************************************************************** * NE_InitializeDLLs * - * Initialize the loaded DLLs. + * Recursively initialize all DLLs (according to the order in which + * they where loaded). */ void NE_InitializeDLLs( HMODULE16 hModule ) { + TDB* pTask = (TDB*)GlobalLock16(GetCurrentTask()); NE_MODULE *pModule; HMODULE16 *pDLL; @@ -529,6 +543,7 @@ void NE_InitializeDLLs( HMODULE16 hModule ) /* PE_InitializeDLLs(hModule); */ return; } + if (pModule->dlls_to_init) { HGLOBAL16 to_init = pModule->dlls_to_init; @@ -539,7 +554,7 @@ void NE_InitializeDLLs( HMODULE16 hModule ) } GlobalFree16( to_init ); } - NE_InitDLL( hModule ); + NE_InitDLL( pTask, hModule ); } diff --git a/loader/ne_resource.c b/loader/ne_resource.c index cf885e8a910..7121b1896dd 100644 --- a/loader/ne_resource.c +++ b/loader/ne_resource.c @@ -3,6 +3,7 @@ * * Copyright 1993 Robert J. Amstadt * Copyright 1995 Alexandre Julliard + * 1997 Alex Korobka */ #include @@ -22,6 +23,8 @@ #include "stddebug.h" #include "debug.h" +#define NEXT_TYPEINFO(pTypeInfo) ((NE_TYPEINFO *)((char*)((pTypeInfo) + 1) + \ + (pTypeInfo)->count * sizeof(NE_NAMEINFO))) /*********************************************************************** * NE_FindNameTableId @@ -29,29 +32,26 @@ * Find the type and resource id from their names. * Return value is MAKELONG( typeId, resId ), or 0 if not found. */ -static DWORD NE_FindNameTableId( HMODULE16 hModule, SEGPTR typeId, SEGPTR resId ) +static DWORD NE_FindNameTableId( NE_MODULE *pModule, SEGPTR typeId, SEGPTR resId ) { - NE_MODULE *pModule; - NE_TYPEINFO *pTypeInfo; + NE_TYPEINFO *pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->res_table + 2); NE_NAMEINFO *pNameInfo; HGLOBAL16 handle; WORD *p; DWORD ret = 0; int count; - if (!(pModule = MODULE_GetPtr( hModule ))) return 0; - pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->res_table + 2); for (; pTypeInfo->type_id != 0; - pTypeInfo = (NE_TYPEINFO *)((char*)(pTypeInfo+1) + - pTypeInfo->count * sizeof(NE_NAMEINFO))) + pTypeInfo = (NE_TYPEINFO *)((char*)(pTypeInfo+1) + + pTypeInfo->count * sizeof(NE_NAMEINFO))) { - if (pTypeInfo->type_id != 0x800f) continue; - pNameInfo = (NE_NAMEINFO *)(pTypeInfo + 1); - for (count = pTypeInfo->count; count > 0; count--, pNameInfo++) - { + if (pTypeInfo->type_id != 0x800f) continue; + pNameInfo = (NE_NAMEINFO *)(pTypeInfo + 1); + for (count = pTypeInfo->count; count > 0; count--, pNameInfo++) + { dprintf_resource( stddeb, "NameTable entry: type=%04x id=%04x\n", pTypeInfo->type_id, pNameInfo->id ); - handle = LoadResource16( hModule, + handle = LoadResource16( pModule->self, (HRSRC16)((int)pNameInfo - (int)pModule) ); for(p = (WORD*)LockResource16(handle); p && *p; p = (WORD *)((char*)p+*p)) { @@ -89,11 +89,56 @@ static DWORD NE_FindNameTableId( HMODULE16 hModule, SEGPTR typeId, SEGPTR resId } FreeResource16( handle ); if (ret) return ret; - } + } } return 0; } +/*********************************************************************** + * NE_FindTypeSection + * + * Find header struct for a particular resource type. + */ +static NE_TYPEINFO* NE_FindTypeSection( NE_MODULE *pModule, + NE_TYPEINFO *pTypeInfo, SEGPTR typeId ) +{ + /* start from pTypeInfo */ + + if (HIWORD(typeId) != 0) /* Named type */ + { + char *str = (char *)PTR_SEG_TO_LIN( typeId ); + BYTE len = strlen( str ); + while (pTypeInfo->type_id) + { + if (!(pTypeInfo->type_id & 0x8000)) + { + BYTE *p = (BYTE*)pModule + pModule->res_table + pTypeInfo->type_id; + if ((*p == len) && !lstrncmpi32A( p+1, str, len )) + { + dprintf_resource( stddeb, " Found type '%s'\n", str ); + return pTypeInfo; + } + } + dprintf_resource( stddeb, " Skipping type %04x\n", pTypeInfo->type_id ); + pTypeInfo = NEXT_TYPEINFO(pTypeInfo); + } + } + else /* Numeric type id */ + { + WORD id = LOWORD(typeId) | 0x8000; + while (pTypeInfo->type_id) + { + if (pTypeInfo->type_id == id) + { + dprintf_resource( stddeb, " Found type %04x\n", id ); + return pTypeInfo; + } + dprintf_resource( stddeb, " Skipping type %04x\n", pTypeInfo->type_id ); + pTypeInfo = NEXT_TYPEINFO(pTypeInfo); + } + } + return NULL; +} /*********************************************************************** * NE_FindResourceFromType @@ -130,6 +175,83 @@ static HRSRC16 NE_FindResourceFromType( NE_MODULE *pModule, } +/*********************************************************************** + * NE_DefResourceHandler + * + * This is the default LoadProc() function. + */ +HGLOBAL16 WINAPI NE_DefResourceHandler( HGLOBAL16 hMemObj, HMODULE16 hModule, + HRSRC16 hRsrc ) +{ + int fd; + NE_MODULE* pModule = MODULE_GetPtr( hModule ); + if ( pModule && (fd = MODULE_OpenFile( hModule )) >= 0) + { + HGLOBAL16 handle; + WORD sizeShift = *(WORD *)((char *)pModule + pModule->res_table); + NE_NAMEINFO* pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc); + + dprintf_resource( stddeb, "NEResourceHandler: loading, pos=%d, len=%d\n", + (int)pNameInfo->offset << sizeShift, + (int)pNameInfo->length << sizeShift ); + if( hMemObj ) + handle = GlobalReAlloc16( hMemObj, pNameInfo->length << sizeShift, 0 ); + else + handle = NE_AllocResource( hModule, hRsrc, 0 ); + + if( handle ) + { + lseek( fd, (int)pNameInfo->offset << sizeShift, SEEK_SET ); + read( fd, GlobalLock16( handle ), (int)pNameInfo->length << sizeShift ); + } + return handle; + } + return (HGLOBAL16)0; +} + +/*********************************************************************** + * NE_InitResourceHandler + * + * Fill in 'resloader' fields in the resource table. + */ +BOOL32 NE_InitResourceHandler( HMODULE16 hModule ) +{ + NE_MODULE *pModule = MODULE_GetPtr( hModule ); + NE_TYPEINFO *pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->res_table + 2); + + dprintf_resource(stddeb,"InitResourceHandler[%04x]\n", hModule ); + + while(pTypeInfo->type_id) + { + pTypeInfo->resloader = (DWORD)&NE_DefResourceHandler; + pTypeInfo = NEXT_TYPEINFO(pTypeInfo); + } + return TRUE; +} + +/*********************************************************************** + * NE_SetResourceHandler + */ +FARPROC32 NE_SetResourceHandler( HMODULE16 hModule, SEGPTR typeId, + FARPROC32 resourceHandler ) +{ + NE_MODULE *pModule = MODULE_GetPtr( hModule ); + NE_TYPEINFO *pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->res_table + 2); + FARPROC32 prevHandler = NULL; + + do + { + pTypeInfo = NE_FindTypeSection( pModule, pTypeInfo, typeId ); + if( pTypeInfo ) + { + prevHandler = (FARPROC32)pTypeInfo->resloader; + pTypeInfo->resloader = (DWORD)resourceHandler; + pTypeInfo = NEXT_TYPEINFO(pTypeInfo); + } + } while( pTypeInfo ); + return prevHandler; +} + /*********************************************************************** * NE_FindResource */ @@ -142,10 +264,12 @@ HRSRC16 NE_FindResource( HMODULE16 hModule, SEGPTR typeId, SEGPTR resId ) if (!pModule || !pModule->res_table) return 0; pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->res_table + 2); - if (HIWORD(typeId) || HIWORD(resId)) + if ((pModule->expected_version < 0x030a) && (HIWORD(typeId) || HIWORD(resId))) { - /* Search the names in the nametable */ - DWORD id = NE_FindNameTableId( hModule, typeId, resId ); + /* Search the names in the nametable (which is not present + * since Windows 3.1). */ + + DWORD id = NE_FindNameTableId( pModule, typeId, resId ); if (id) /* found */ { typeId = LOWORD(id); @@ -153,60 +277,27 @@ HRSRC16 NE_FindResource( HMODULE16 hModule, SEGPTR typeId, SEGPTR resId ) } } - if (HIWORD(typeId) != 0) /* Named type */ + do { - char *str = (char *)PTR_SEG_TO_LIN( typeId ); - BYTE len = strlen( str ); - while (pTypeInfo->type_id) - { - if (!(pTypeInfo->type_id & 0x8000)) - { - BYTE *p = (BYTE*)pModule+pModule->res_table+pTypeInfo->type_id; - if ((*p == len) && !lstrncmpi32A( p+1, str, len )) - { - dprintf_resource( stddeb, " Found type '%s'\n", str ); - hRsrc = NE_FindResourceFromType(pModule, pTypeInfo, resId); - if (hRsrc) - { - dprintf_resource( stddeb, " Found id %08lx\n", resId ); - return hRsrc; - } - dprintf_resource( stddeb, " Not found, going on\n" ); - } - } - dprintf_resource( stddeb, " Skipping type %04x\n", - pTypeInfo->type_id ); - pTypeInfo = (NE_TYPEINFO *)((char*)(pTypeInfo+1) + - pTypeInfo->count * sizeof(NE_NAMEINFO)); - } - } - else /* Numeric type id */ - { - WORD id = LOWORD(typeId) | 0x8000; - while (pTypeInfo->type_id) - { - if (pTypeInfo->type_id == id) - { - dprintf_resource( stddeb, " Found type %04x\n", id ); - hRsrc = NE_FindResourceFromType( pModule, pTypeInfo, resId ); - if (hRsrc) - { - dprintf_resource( stddeb, " Found id %08lx\n", resId ); - return hRsrc; - } - dprintf_resource( stddeb, " Not found, going on\n" ); - } - dprintf_resource( stddeb, " Skipping type %04x\n", - pTypeInfo->type_id ); - pTypeInfo = (NE_TYPEINFO *)((char*)(pTypeInfo+1) + - pTypeInfo->count * sizeof(NE_NAMEINFO)); - } - } + pTypeInfo = NE_FindTypeSection( pModule, pTypeInfo, typeId ); + if( pTypeInfo ) + { + hRsrc = NE_FindResourceFromType(pModule, pTypeInfo, resId); + if( hRsrc ) + { + dprintf_resource( stddeb, " Found id %08lx\n", resId ); + return hRsrc; + } + dprintf_resource( stddeb, " Not found, going on\n" ); + pTypeInfo = NEXT_TYPEINFO(pTypeInfo); + } + } while( pTypeInfo ); + + dprintf_resource( stddeb, "failed!\n"); return 0; } - /*********************************************************************** * NE_AllocResource */ @@ -273,33 +364,67 @@ DWORD NE_SizeofResource( HMODULE16 hModule, HRSRC16 hRsrc ) */ HGLOBAL16 NE_LoadResource( HMODULE16 hModule, HRSRC16 hRsrc ) { - NE_NAMEINFO *pNameInfo=NULL; - WORD sizeShift; - int fd; - + NE_TYPEINFO *pTypeInfo; + NE_NAMEINFO *pNameInfo = NULL; NE_MODULE *pModule = MODULE_GetPtr( hModule ); - if (!pModule || !pModule->res_table) return 0; + int d; + + if (!hRsrc || !pModule || !pModule->res_table) return 0; + + /* First, verify hRsrc (just an offset from pModule to the needed pNameInfo) */ + + d = pModule->res_table + 2; + pTypeInfo = (NE_TYPEINFO *)((char *)pModule + d); #ifndef WINELIB - pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc); -#endif - if (pNameInfo->handle) + while( hRsrc > d ) { - pNameInfo->usage++; - dprintf_resource( stddeb, " Already loaded, new count=%d\n", - pNameInfo->usage ); - return pNameInfo->handle; + if (pTypeInfo->type_id == 0) + break; /* terminal entry */ + d += sizeof(NE_TYPEINFO) + pTypeInfo->count * sizeof(NE_NAMEINFO); + if (hRsrc < d) + { + if( ((d - hRsrc)%sizeof(NE_NAMEINFO)) == 0 ) + { + pNameInfo = (NE_NAMEINFO *)(((char *)pModule) + hRsrc); + break; + } + else + break; /* NE_NAMEINFO boundary mismatch */ + } + pTypeInfo = (NE_TYPEINFO *)(((char *)pModule) + d); } - sizeShift = *(WORD *)((char *)pModule + pModule->res_table); - dprintf_resource( stddeb, " Loading, pos=%d, len=%d\n", - (int)pNameInfo->offset << sizeShift, - (int)pNameInfo->length << sizeShift ); - if ((fd = MODULE_OpenFile( hModule )) == -1) return 0; - pNameInfo->handle = NE_AllocResource( hModule, hRsrc, 0 ); - pNameInfo->usage = 1; - lseek( fd, (int)pNameInfo->offset << sizeShift, SEEK_SET ); - read( fd, GlobalLock16( pNameInfo->handle ), - (int)pNameInfo->length << sizeShift ); - return pNameInfo->handle; +#endif + if (pNameInfo) + { + RESOURCEHANDLER16 __r16loader; + if (pNameInfo->handle + && !(GlobalFlags16(pNameInfo->handle) & GMEM_DISCARDED)) + { + pNameInfo->usage++; + dprintf_resource( stddeb, " Already loaded, new count=%d\n", + pNameInfo->usage ); + } + else + { + if (pTypeInfo->resloader) + __r16loader = (RESOURCEHANDLER16)pTypeInfo->resloader; + else /* this is really bad */ + { + fprintf( stderr, "[%04x]: Missing resource handler!!!...\n", hModule); + __r16loader = NE_DefResourceHandler; + } + + /* Finally call resource loader */ + + if ((pNameInfo->handle = __r16loader(pNameInfo->handle, hModule, hRsrc))) + { + pNameInfo->usage++; + pNameInfo->flags |= NE_SEGFLAGS_LOADED; + } + } + return pNameInfo->handle; + } + return 0; } @@ -324,7 +449,7 @@ BOOL32 NE_FreeResource( HMODULE16 hModule, HGLOBAL16 handle ) WORD count; NE_MODULE *pModule = MODULE_GetPtr( hModule ); - if (!pModule || !pModule->res_table) return handle; + if (!handle || !pModule || !pModule->res_table) return handle; pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->res_table + 2); while (pTypeInfo->type_id) { @@ -345,7 +470,10 @@ BOOL32 NE_FreeResource( HMODULE16 hModule, HGLOBAL16 handle ) } pTypeInfo = (NE_TYPEINFO *)pNameInfo; } - fprintf( stderr, "NE_FreeResource: %04x %04x not found!\n", hModule, handle ); + + dprintf_resource(stddeb, "NE_FreeResource[%04x]: no intrinsic resource for %04x\n", + hModule, handle ); + GlobalFree16( handle ); /* it could have been DirectResAlloc()'ed */ return handle; } #endif /* WINELIB */ diff --git a/loader/pe_image.c b/loader/pe_image.c index 223348b9747..415094f8950 100644 --- a/loader/pe_image.c +++ b/loader/pe_image.c @@ -17,11 +17,14 @@ #include #include #include +#include +#include #include "windows.h" #include "winbase.h" #include "callback.h" #include "neexe.h" #include "peexe.h" +#include "process.h" #include "pe_image.h" #include "module.h" #include "global.h" @@ -33,8 +36,7 @@ #include "debugger.h" #include "xmalloc.h" -static void PE_InitDLL(HMODULE16 hModule, DWORD type, LPVOID lpReserved); - +static void PE_InitDLL(PE_MODREF* modref, DWORD type, LPVOID lpReserved); /* convert PE image VirtualAddress to Real Address */ #define RVA(x) ((unsigned int)load_addr+(unsigned int)(x)) @@ -91,25 +93,40 @@ void dump_exports(IMAGE_EXPORT_DIRECTORY * pe_exports, unsigned int load_addr) */ FARPROC32 PE_FindExportedFunction(struct pe_data *pe, LPCSTR funcName) { - IMAGE_EXPORT_DIRECTORY * exports = pe->pe_export; - unsigned load_addr = pe->load_addr; - u_short * ordinal; - u_long * function; - u_char ** name, *ename; - int i; + IMAGE_EXPORT_DIRECTORY *exports; + unsigned load_addr; + u_short * ordinal; + u_long * function; + u_char ** name, *ename; + int i; + PDB32 *process=(PDB32*)GetCurrentProcessId(); + PE_MODREF *pem; + + pem = process->modref_list; + while (pem && (pem->pe_module != pe)) + pem=pem->next; + if (!pem) { + fprintf(stderr,"No MODREF found for PE_MODULE %p in process %p\n",pe,process); + return NULL; + } + load_addr = pem->load_addr; + exports = pem->pe_export; if (HIWORD(funcName)) dprintf_win32(stddeb,"PE_FindExportedFunction(%s)\n",funcName); else dprintf_win32(stddeb,"PE_FindExportedFunction(%d)\n",(int)funcName); - if (!exports) + if (!exports) { + fprintf(stderr,"Module %p/MODREF %p doesn't have a exports table.\n",pe,pem); return NULL; - ordinal=(u_short*) RVA(exports->AddressOfNameOrdinals); - function=(u_long*) RVA(exports->AddressOfFunctions); - name=(u_char **) RVA(exports->AddressOfNames); + } + ordinal = (u_short*) RVA(exports->AddressOfNameOrdinals); + function= (u_long*) RVA(exports->AddressOfFunctions); + name = (u_char **) RVA(exports->AddressOfNames); + if (HIWORD(funcName)) { for(i=0; iNumberOfNames; i++) { - ename=(char*) RVA(*name); + ename=(char*)RVA(*name); if(!strcmp(ename,funcName)) return (FARPROC32) RVA(function[*ordinal]); ordinal++; @@ -127,18 +144,17 @@ FARPROC32 PE_FindExportedFunction(struct pe_data *pe, LPCSTR funcName) } void -fixup_imports (struct pe_data *pe, HMODULE16 hModule) +fixup_imports (PDB32 *process,PE_MODREF *pem) { - IMAGE_IMPORT_DESCRIPTOR *pe_imp; - int fixup_failed = 0; - unsigned int load_addr = pe->load_addr; - int i; - NE_MODULE *ne_mod; - HMODULE16 *mod_ptr; - char *modname; + PE_MODULE *pe = pem->pe_module; + IMAGE_IMPORT_DESCRIPTOR *pe_imp; + int fixup_failed = 0; + unsigned int load_addr = pem->load_addr; + int i; + char *modname; - if (pe->pe_export) - modname = (char*) RVA(pe->pe_export->Name); + if (pem->pe_export) + modname = (char*) RVA(pem->pe_export->Name); else modname = ""; @@ -146,40 +162,77 @@ fixup_imports (struct pe_data *pe, HMODULE16 hModule) dprintf_win32 (stddeb, "\nDumping imports list\n"); /* first, count the number of imported non-internal modules */ - pe_imp = pe->pe_import; + pe_imp = pem->pe_import; + if (!pe_imp) + fprintf(stderr,"no import directory????\n"); /* FIXME: should terminate on 0 Characteristics */ for (i = 0; pe_imp->Name; pe_imp++) i++; - /* Now, allocate memory for dlls_to_init */ - ne_mod = GlobalLock16 (hModule); - ne_mod->dlls_to_init = GLOBAL_Alloc(GMEM_ZEROINIT, (i+1)*sizeof(HMODULE16), - hModule, FALSE, FALSE, FALSE); - mod_ptr = GlobalLock16 (ne_mod->dlls_to_init); - /* load the modules and put their handles into the list */ + /* load the imported modules. They are automatically + * added to the modref list of the process. + */ - /* FIXME: should terminate on 0 Characteristics */ - for (i = 0, pe_imp = pe->pe_import; pe_imp->Name; pe_imp++) { + /* FIXME: should terminate on 0 Characteristics */ + for (i = 0, pe_imp = pem->pe_import; pe_imp->Name; pe_imp++) { + HMODULE32 res; + PE_MODREF *xpem,**ypem; + + char *name = (char *) RVA(pe_imp->Name); - mod_ptr[i] = MODULE_Load( name, (LPVOID)-1, FALSE ); - if (mod_ptr[i] <= (HMODULE16) 32) { + + /* don't use MODULE_Load, Win32 creates new task differently */ + res = PE_LoadLibraryEx32A( name, 0, 0 ); + if (res <= (HMODULE32) 32) { char *p, buffer[256]; /* Try with prepending the path of the current module */ - GetModuleFileName16 (hModule, buffer, sizeof (buffer)); + GetModuleFileName32A (pe->mappeddll, buffer, sizeof (buffer)); if (!(p = strrchr (buffer, '\\'))) p = buffer; strcpy (p + 1, name); - mod_ptr[i] = MODULE_Load( buffer, (LPVOID)-1, FALSE ); + res = PE_LoadLibraryEx32A( buffer, 0, 0 ); } - if (mod_ptr[i] <= (HMODULE16) 32) { + if (res <= (HMODULE32) 32) { fprintf (stderr, "Module %s not found\n", name); exit (0); } + res = MODULE_HANDLEtoHMODULE32(res); + xpem = pem->next; + while (xpem) { + if (xpem->pe_module->mappeddll == res) + break; + xpem = xpem->next; + } + if (xpem) { + /* it has been loaded *BEFORE* us, so we have to init + * it before us. we just swap the two modules which should + * work. + */ + /* unlink xpem from chain */ + ypem = &(process->modref_list); + while (*ypem) { + if ((*ypem)==xpem) + break; + ypem = &((*ypem)->next); + } + *ypem = xpem->next; + + /* link it directly before pem */ + ypem = &(process->modref_list); + while (*ypem) { + if ((*ypem)==pem) + break; + ypem = &((*ypem)->next); + } + *ypem = xpem; + xpem->next = pem; + + } i++; } - pe_imp = pe->pe_import; + pe_imp = pem->pe_import; while (pe_imp->Name) { char *Module; IMAGE_IMPORT_BY_NAME *pe_name; @@ -269,9 +322,9 @@ fixup_imports (struct pe_data *pe, HMODULE16 hModule) if (fixup_failed) exit(1); } -static void calc_vma_size(struct pe_data *pe) +static int calc_vma_size(struct pe_data *pe) { - int i; + int i,vma_size = 0; dprintf_win32(stddeb, "Dump of segment table\n"); dprintf_win32(stddeb, " Name VSz Vaddr SzRaw Fileadr *Reloc *Lineum #Reloc #Linum Char\n"); @@ -288,19 +341,21 @@ static void calc_vma_size(struct pe_data *pe) pe->pe_seg[i].NumberOfRelocations, pe->pe_seg[i].NumberOfLinenumbers, pe->pe_seg[i].Characteristics); - pe->vma_size = MAX(pe->vma_size, + vma_size = MAX(vma_size, pe->pe_seg[i].VirtualAddress + pe->pe_seg[i].SizeOfRawData); } + return vma_size; } -static void do_relocations(struct pe_data *pe) +static void do_relocations(PE_MODREF *pem) { - int delta = pe->load_addr - pe->base_addr; - unsigned int load_addr = pe->load_addr; - IMAGE_BASE_RELOCATION *r = pe->pe_reloc; - int hdelta = (delta >> 16) & 0xFFFF; - int ldelta = delta & 0xFFFF; + int delta = pem->load_addr - pem->pe_module->pe_header->OptionalHeader.ImageBase; + + unsigned int load_addr= pem->load_addr; + IMAGE_BASE_RELOCATION *r = pem->pe_reloc; + int hdelta = (delta >> 16) & 0xFFFF; + int ldelta = delta & 0xFFFF; /* int reloc_size = */ @@ -360,27 +415,47 @@ static void do_relocations(struct pe_data *pe) /********************************************************************** * PE_LoadImage - * Load one PE format executable into memory + * Load one PE format DLL/EXE into memory + * + * Unluckily we can't just mmap the sections where we want them, for + * (at least) Linux does only support offset with are multiples of the + * underlying filesystemblocksize, but PE DLLs usually have alignments of 512 + * byte. This fails for instance when you try to map from CDROM (bsize 2048). + * + * BUT we have to map the whole image anyway, for Win32 programs sometimes + * want to access them. (HMODULE32 point to the start of it) */ -static void PE_LoadImage( struct pe_data **ret_pe, int fd, HMODULE16 hModule, WORD offset, OFSTRUCT *ofs ) +static PE_MODULE *PE_LoadImage( int fd ) { struct pe_data *pe; - int i, result; - int load_addr; - IMAGE_DATA_DIRECTORY dir; - char buffer[200]; DBG_ADDR daddr; - char *modname; + struct stat stbuf; daddr.seg=0; daddr.type = NULL; + if (-1==fstat(fd,&stbuf)) { + perror("PE_LoadImage:fstat"); + return NULL; + } pe = xmalloc(sizeof(struct pe_data)); memset(pe,0,sizeof(struct pe_data)); - pe->pe_header = xmalloc(sizeof(IMAGE_NT_HEADERS)); - /* read PE header */ - lseek( fd, offset, SEEK_SET); - read( fd, pe->pe_header, sizeof(IMAGE_NT_HEADERS)); + /* map the PE image somewhere */ + pe->mappeddll = (HMODULE32)mmap(NULL,stbuf.st_size,PROT_READ,MAP_SHARED,fd,0); + if (!pe->mappeddll || pe->mappeddll==-1) { + perror("PE_LoadImage:mmap"); + free(pe); + return NULL; + } + /* link PE header */ + pe->pe_header = (IMAGE_NT_HEADERS*)(pe->mappeddll+(((IMAGE_DOS_HEADER*)pe->mappeddll)->e_lfanew)); + if (pe->pe_header->Signature!=IMAGE_NT_SIGNATURE) { + fprintf(stderr,"image doesn't have PE signature, but 0x%08lx\n", + pe->pe_header->Signature + ); + free(pe); + return NULL; + } if (pe->pe_header->FileHeader.Machine != IMAGE_FILE_MACHINE_I386) { fprintf(stderr,"trying to load PE image for unsupported architecture ("); @@ -403,48 +478,66 @@ static void PE_LoadImage( struct pe_data **ret_pe, int fd, HMODULE16 hModule, WO fprintf(stderr,"Unknown-%04x",pe->pe_header->FileHeader.Machine);break; } fprintf(stderr,")\n"); - return; + return NULL; } -/* FIXME: this is a *horrible* hack to make COMDLG32.DLL load OK. The - * problem needs to be fixed properly at some stage + pe->pe_seg = (IMAGE_SECTION_HEADER*)(((LPBYTE)(pe->pe_header+1))- + (16 - pe->pe_header->OptionalHeader.NumberOfRvaAndSizes) * sizeof(IMAGE_DATA_DIRECTORY)); + +/* FIXME: the (16-...) is a *horrible* hack to make COMDLG32.DLL load OK. The + * problem needs to be fixed properly at some stage. */ - if (pe->pe_header->OptionalHeader.NumberOfRvaAndSizes != 16) { - printf("Short PE Header!!!\n"); - lseek( fd, -(16 - pe->pe_header->OptionalHeader.NumberOfRvaAndSizes) * sizeof(IMAGE_DATA_DIRECTORY), SEEK_CUR); + return pe; +} + +/********************************************************************** + * This maps a loaded PE dll into the address space of the specified process. + */ +void +PE_MapImage(PE_MODULE *pe,PDB32 *process, OFSTRUCT *ofs, DWORD flags) { + PE_MODREF *pem; + int i, result; + int load_addr; + IMAGE_DATA_DIRECTORY dir; + char buffer[200]; + DBG_ADDR daddr; + char *modname; + int vma_size; + + pem = (PE_MODREF*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(*pem)); + /* NOTE: fixup_imports takes care of the correct order */ + pem->next = process->modref_list; + process->modref_list = pem; + + pem->pe_module = pe; + if (!(pe->pe_header->FileHeader.Characteristics & IMAGE_FILE_DLL)) { + if (process->exe_modref) + fprintf(stderr,"overwriting old exe_modref... arrgh\n"); + process->exe_modref = pem; } - /* read sections */ - pe->pe_seg = xmalloc(sizeof(IMAGE_SECTION_HEADER) * - pe->pe_header->FileHeader.NumberOfSections); - read( fd, pe->pe_seg, sizeof(IMAGE_SECTION_HEADER) * - pe->pe_header->FileHeader.NumberOfSections); - - load_addr = pe->pe_header->OptionalHeader.ImageBase; - pe->base_addr=load_addr; - pe->vma_size=0; + load_addr = pe->pe_header->OptionalHeader.ImageBase; dprintf_win32(stddeb, "Load addr is %x\n",load_addr); - calc_vma_size(pe); - load_addr = (int) VirtualAlloc( (void*)pe->base_addr, pe->vma_size, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE ); - pe->load_addr = load_addr; + vma_size = calc_vma_size(pe); + load_addr = (int) VirtualAlloc( (void*)load_addr, vma_size, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE ); + pem->load_addr = load_addr; - dprintf_win32(stddeb, "Load addr is really %x, range %x\n", - pe->load_addr, pe->vma_size); + dprintf_win32(stddeb, "Load addr is really %lx, range %x\n", + pem->load_addr, vma_size); for(i=0; i < pe->pe_header->FileHeader.NumberOfSections; i++) { - /* load only non-BSS segments */ - if(!(pe->pe_seg[i].Characteristics & - IMAGE_SCN_CNT_UNINITIALIZED_DATA)) - { - if(lseek(fd,pe->pe_seg[i].PointerToRawData,SEEK_SET) == -1 - || read(fd,(char*)RVA(pe->pe_seg[i].VirtualAddress), - pe->pe_seg[i].SizeOfRawData) != pe->pe_seg[i].SizeOfRawData) - { - fprintf(stderr,"Failed to load section %x\n", i); - exit(0); - } - } + /* memcpy only non-BSS segments */ + /* FIXME: this should be done by mmap(..MAP_PRIVATE|MAP_FIXED..) + * but it is not possible for (at least) Linux needs an offset + * aligned to a block on the filesystem. + */ + if(!(pe->pe_seg[i].Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA)) + memcpy((char*)RVA(pe->pe_seg[i].VirtualAddress), + (char*)(pe->mappeddll+pe->pe_seg[i].PointerToRawData), + pe->pe_seg[i].SizeOfRawData + ); + result = RVA (pe->pe_seg[i].VirtualAddress); #if 1 /* not needed, memory is zero */ @@ -456,16 +549,16 @@ static void PE_LoadImage( struct pe_data **ret_pe, int fd, HMODULE16 hModule, WO #endif if(strcmp(pe->pe_seg[i].Name, ".idata") == 0) - pe->pe_import = (LPIMAGE_IMPORT_DESCRIPTOR) result; + pem->pe_import = (LPIMAGE_IMPORT_DESCRIPTOR) result; if(strcmp(pe->pe_seg[i].Name, ".edata") == 0) - pe->pe_export = (LPIMAGE_EXPORT_DIRECTORY) result; + pem->pe_export = (LPIMAGE_EXPORT_DIRECTORY) result; if(strcmp(pe->pe_seg[i].Name, ".rsrc") == 0) - pe->pe_resource = (LPIMAGE_RESOURCE_DIRECTORY) result; + pem->pe_resource = (LPIMAGE_RESOURCE_DIRECTORY) result; if(strcmp(pe->pe_seg[i].Name, ".reloc") == 0) - pe->pe_reloc = (LPIMAGE_BASE_RELOCATION) result; + pem->pe_reloc = (LPIMAGE_BASE_RELOCATION) result; } /* There is word that the actual loader does not care about the @@ -473,26 +566,26 @@ static void PE_LoadImage( struct pe_data **ret_pe, int fd, HMODULE16 hModule, WO dir=pe->pe_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT]; if(dir.Size) { - if(pe->pe_export && (int)pe->pe_export!=RVA(dir.VirtualAddress)) + if(pem->pe_export && (int)pem->pe_export!=RVA(dir.VirtualAddress)) fprintf(stderr,"wrong export directory??\n"); /* always trust the directory */ - pe->pe_export = (LPIMAGE_EXPORT_DIRECTORY) RVA(dir.VirtualAddress); + pem->pe_export = (LPIMAGE_EXPORT_DIRECTORY) RVA(dir.VirtualAddress); } dir=pe->pe_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT]; if(dir.Size) { - if(pe->pe_import && (int)pe->pe_import!=RVA(dir.VirtualAddress)) + if(pem->pe_import && (int)pem->pe_import!=RVA(dir.VirtualAddress)) fprintf(stderr,"wrong import directory??\n"); - pe->pe_import = (LPIMAGE_IMPORT_DESCRIPTOR) RVA(dir.VirtualAddress); + pem->pe_import = (LPIMAGE_IMPORT_DESCRIPTOR) RVA(dir.VirtualAddress); } dir=pe->pe_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE]; if(dir.Size) { - if(pe->pe_resource && (int)pe->pe_resource!=RVA(dir.VirtualAddress)) + if(pem->pe_resource && (int)pem->pe_resource!=RVA(dir.VirtualAddress)) fprintf(stderr,"wrong resource directory??\n"); - pe->pe_resource = (LPIMAGE_RESOURCE_DIRECTORY) RVA(dir.VirtualAddress); + pem->pe_resource = (LPIMAGE_RESOURCE_DIRECTORY) RVA(dir.VirtualAddress); } if(pe->pe_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXCEPTION].Size) @@ -506,15 +599,15 @@ static void PE_LoadImage( struct pe_data **ret_pe, int fd, HMODULE16 hModule, WO dir=pe->pe_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC]; if(dir.Size) { - if(pe->pe_reloc && (int)pe->pe_reloc!= RVA(dir.VirtualAddress)) + if(pem->pe_reloc && (int)pem->pe_reloc!= RVA(dir.VirtualAddress)) fprintf(stderr,"wrong relocation list??\n"); - pe->pe_reloc = (void *) RVA(dir.VirtualAddress); + pem->pe_reloc = (void *) RVA(dir.VirtualAddress); } if(pe->pe_header->OptionalHeader.DataDirectory [IMAGE_DIRECTORY_ENTRY_DEBUG].Size) { - DEBUG_RegisterDebugInfo(fd, pe, load_addr, + DEBUG_RegisterDebugInfo(pe, load_addr, pe->pe_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress, pe->pe_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size); } @@ -549,18 +642,12 @@ static void PE_LoadImage( struct pe_data **ret_pe, int fd, HMODULE16 hModule, WO if(pe->pe_header->OptionalHeader.DataDirectory[15].Size) dprintf_win32(stdnimp,"Unknown directory 15 ignored\n"); - if(pe->pe_reloc) do_relocations(pe); - - /* Do exports before imports because fixup_imports - * may load a module that references this module. - */ - - if(pe->pe_export) dump_exports(pe->pe_export,load_addr); - *ret_pe = pe; /* make export list available for GetProcAddress */ - if(pe->pe_import) fixup_imports(pe, hModule); + if(pem->pe_reloc) do_relocations(pem); + if(pem->pe_export) dump_exports(pem->pe_export,load_addr); + if(pem->pe_import) fixup_imports(process,pem); - if (pe->pe_export) - modname = (char*)RVA(pe->pe_export->Name); + if (pem->pe_export) + modname = (char*)RVA(pem->pe_export->Name); else { char *s; modname = s = ofs->szPathName; @@ -587,31 +674,70 @@ static void PE_LoadImage( struct pe_data **ret_pe, int fd, HMODULE16 hModule, WO HINSTANCE16 MODULE_CreateInstance(HMODULE16 hModule,LOADPARAMS *params); +/****************************************************************************** + * The PE Library Loader frontend. + * FIXME: handle the flags. + */ +HMODULE32 PE_LoadLibraryEx32A (LPCSTR name, HFILE32 hFile, DWORD flags) { + OFSTRUCT ofs; + HMODULE32 hModule; + NE_MODULE *pModule; + + if ((hModule = MODULE_FindModule( name ))) + return hModule; + + /* try to load builtin, enabled modules first */ + if ((hModule = BUILTIN_LoadModule( name, FALSE ))) + return hModule; + + /* try to open the specified file */ + if (HFILE_ERROR32==(hFile=OpenFile32(name,&ofs,OF_READ))) { + /* Now try the built-in even if disabled */ + if ((hModule = BUILTIN_LoadModule( name, TRUE ))) { + fprintf( stderr, "Warning: could not load Windows DLL '%s', using built-in module.\n", name ); + return hModule; + } + return 1; + } + if ((hModule = MODULE_CreateDummyModule( &ofs )) < 32) { + _lclose32(hFile); + return hModule; + } + + pModule = (NE_MODULE *)GlobalLock16( hModule ); + pModule->flags = NE_FFLAGS_WIN32; + + /* FIXME: check if pe image loaded already ... */ + pModule->pe_module = PE_LoadImage( FILE_GetUnixHandle(hFile) ); + _lclose32(hFile); + if (!pModule->pe_module) + return 21; + /* recurse */ + PE_MapImage(pModule->pe_module,(PDB32*)GetCurrentProcessId(),&ofs,flags); + return pModule->pe_module->mappeddll; +} + +/***************************************************************************** + * Load the PE main .EXE. All other loading is done by PE_LoadLibraryEx32A + * FIXME: this function should use PE_LoadLibraryEx32A, but currently can't + * due to the TASK_CreateTask stuff. + */ HINSTANCE16 PE_LoadModule( HFILE32 hFile, OFSTRUCT *ofs, LOADPARAMS* params ) { HMODULE16 hModule; HINSTANCE16 hInstance; NE_MODULE *pModule; - IMAGE_DOS_HEADER mz_header; - int fd; if ((hModule = MODULE_CreateDummyModule( ofs )) < 32) return hModule; pModule = (NE_MODULE *)GlobalLock16( hModule ); pModule->flags = NE_FFLAGS_WIN32; - /* FIXME: Hack because PE_LoadModule is recursive */ - fd = dup( FILE_GetUnixHandle(hFile) ); - _lclose32( hFile ); - lseek( fd, 0, SEEK_SET ); - read( fd, &mz_header, sizeof(mz_header) ); - - PE_LoadImage( &pModule->pe_module, fd, hModule, mz_header.e_lfanew, ofs ); + pModule->pe_module = PE_LoadImage( FILE_GetUnixHandle(hFile) ); + _lclose32(hFile); if (!pModule->pe_module) return 21; - close( fd ); hInstance = MODULE_CreateInstance( hModule, params ); - if (!(pModule->pe_module->pe_header->FileHeader.Characteristics & IMAGE_FILE_DLL)) { TASK_CreateTask( hModule, hInstance, 0, @@ -619,10 +745,11 @@ HINSTANCE16 PE_LoadModule( HFILE32 hFile, OFSTRUCT *ofs, LOADPARAMS* params ) (LPSTR)PTR_SEG_TO_LIN( params->cmdLine ), *((WORD*)PTR_SEG_TO_LIN(params->showCmd) + 1) ); } + PE_MapImage(pModule->pe_module,(PDB32*)GetCurrentProcessId(),ofs,0); return hInstance; } -int PE_UnloadImage( HMODULE16 hModule ) +int PE_UnloadImage( HMODULE32 hModule ) { printf("PEunloadImage() called!\n"); /* free resources, image, unmap */ @@ -634,19 +761,13 @@ int PE_UnloadImage( HMODULE16 hModule ) * DLL_PROCESS_ATTACH. Only new created threads do DLL_THREAD_ATTACH * (SDK) */ -static void PE_InitDLL(HMODULE16 hModule, DWORD type,LPVOID lpReserved) +static void PE_InitDLL(PE_MODREF *pem, DWORD type,LPVOID lpReserved) { - NE_MODULE *pModule; - PE_MODULE *pe; - unsigned int load_addr; - - hModule = GetExePtr(hModule); - if (!(pModule = MODULE_GetPtr(hModule))) return; - if (!(pModule->flags & NE_FFLAGS_WIN32) || !(pe = pModule->pe_module)) - return; - - load_addr = pe->load_addr; + PE_MODULE *pe = pem->pe_module; + unsigned int load_addr = pem->load_addr; + if (type==DLL_PROCESS_ATTACH) + pem->flags |= PE_MODREF_PROCESS_ATTACHED; #ifndef WINELIB if (Options.debug) { DBG_ADDR addr = { NULL, 0, RVA(pe->pe_header->OptionalHeader.AddressOfEntryPoint) }; @@ -666,58 +787,81 @@ static void PE_InitDLL(HMODULE16 hModule, DWORD type,LPVOID lpReserved) if ( (pe->pe_header->FileHeader.Characteristics & IMAGE_FILE_DLL) && (pe->pe_header->OptionalHeader.AddressOfEntryPoint) ) { - printf("InitPEDLL() called!\n"); - CallDLLEntryProc32( - (FARPROC32)RVA(pe->pe_header->OptionalHeader.AddressOfEntryPoint), - hModule, - type, - (DWORD)lpReserved - ); + FARPROC32 entry = (FARPROC32)RVA(pe->pe_header->OptionalHeader.AddressOfEntryPoint); + dprintf_relay( stddeb, "CallTo32(entryproc=%p,module=%d,type=%ld,res=%p)\n", + entry, pe->mappeddll, type, lpReserved ); + entry( pe->mappeddll, type, lpReserved ); } } -void PE_InitializeDLLs(HMODULE16 hModule,DWORD type,LPVOID lpReserved) -{ - NE_MODULE *pModule; - HMODULE16 *pDLL; - pModule = MODULE_GetPtr( GetExePtr(hModule) ); - if (pModule->dlls_to_init) - { - HGLOBAL16 to_init = pModule->dlls_to_init; - pModule->dlls_to_init = 0; - - for (pDLL = (HMODULE16 *)GlobalLock16( to_init ); *pDLL; pDLL++) - { - PE_InitializeDLLs( *pDLL, type, lpReserved); +/* Call the DLLentry function of all dlls used by that process. + * (NOTE: this may recursively call this function (if a library calls + * LoadLibrary) ... but it won't matter) + */ +void PE_InitializeDLLs(PDB32 *process,DWORD type,LPVOID lpReserved) { + PE_MODREF *pem; + + pem = process->modref_list; + while (pem) { + if (pem->flags & PE_MODREF_NO_DLL_CALLS) { + pem = pem->next; + continue; } - GlobalFree16( to_init ); + if (type==DLL_PROCESS_ATTACH) { + if (pem->flags & PE_MODREF_PROCESS_ATTACHED) { + pem = pem->next; + continue; + } + } + PE_InitDLL( pem, type, lpReserved ); + pem = pem->next; } - PE_InitDLL( hModule, type, lpReserved ); } -void PE_InitTls( PE_MODULE *module ) +void PE_InitTls(PDB32 *pdb) { - /* FIXME: tls callbacks ??? */ - DWORD index; - DWORD datasize; - DWORD size; - LPVOID mem; - LPIMAGE_TLS_DIRECTORY pdir; + /* FIXME: tls callbacks ??? */ + PE_MODREF *pem; + IMAGE_NT_HEADERS *peh; + DWORD size,datasize,index; + LPVOID mem; + LPIMAGE_TLS_DIRECTORY pdir; - if (!module->pe_header->OptionalHeader.DataDirectory[IMAGE_FILE_THREAD_LOCAL_STORAGE].VirtualAddress) - return; + pem = pdb->modref_list; + while (pem) { + peh = pem->pe_module->pe_header; + if (!peh->OptionalHeader.DataDirectory[IMAGE_FILE_THREAD_LOCAL_STORAGE].VirtualAddress) { + pem = pem->next; + continue; + } + pdir = (LPVOID)(pem->load_addr + peh->OptionalHeader. + DataDirectory[IMAGE_FILE_THREAD_LOCAL_STORAGE].VirtualAddress); + index = TlsAlloc(); + datasize= pdir->EndAddressOfRawData-pdir->StartAddressOfRawData; + size = datasize + pdir->SizeOfZeroFill; + mem=VirtualAlloc(0,size,MEM_RESERVE|MEM_COMMIT,PAGE_READWRITE); + memcpy(mem,(LPVOID) pdir->StartAddressOfRawData, datasize); + TlsSetValue(index,mem); + *(pdir->AddressOfIndex)=index; + pem=pem->next; + } +} - pdir = (LPVOID)(module->load_addr + module->pe_header->OptionalHeader. - DataDirectory[IMAGE_FILE_THREAD_LOCAL_STORAGE].VirtualAddress); - index = TlsAlloc(); - datasize = pdir->EndAddressOfRawData-pdir->StartAddressOfRawData; - size = datasize + pdir->SizeOfZeroFill; - - mem = VirtualAlloc(0,size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE ); - - memcpy(mem,(LPVOID) pdir->StartAddressOfRawData, datasize); - TlsSetValue(index,mem); - *(pdir->AddressOfIndex)=index; +/**************************************************************************** + * DisableThreadLibraryCalls (KERNEL32.74) + * Don't call DllEntryPoint for DLL_THREAD_{ATTACH,DETACH} if set. + */ +BOOL32 WINAPI DisableThreadLibraryCalls(HMODULE32 hModule) +{ + PDB32 *process = (PDB32*)GetCurrentProcessId(); + PE_MODREF *pem = process->modref_list; + + while (pem) { + if (pem->pe_module->mappeddll == hModule) + pem->flags|=PE_MODREF_NO_DLL_CALLS; + pem = pem->next; + } + return TRUE; } #endif /* WINELIB */ diff --git a/loader/pe_resource.c b/loader/pe_resource.c index 2d2bbaff921..9b8ae7ecc16 100644 --- a/loader/pe_resource.c +++ b/loader/pe_resource.c @@ -18,6 +18,8 @@ #include "pe_image.h" #include "module.h" #include "heap.h" +#include "task.h" +#include "process.h" #include "libres.h" #include "stackframe.h" #include "neexe.h" @@ -25,20 +27,24 @@ #include "debug.h" /********************************************************************** - * HMODULE32toPE_MODULE + * HMODULE32toPE_MODREF * - * small helper function to get a PE_MODULE from a passed HMODULE32 + * small helper function to get a PE_MODREF from a passed HMODULE32 */ -static PE_MODULE* -HMODULE32toPE_MODULE(HMODULE32 hmod) { +static PE_MODREF* +HMODULE32toPE_MODREF(HMODULE32 hmod) { NE_MODULE *pModule; + PDB32 *pdb = (PDB32*)GetCurrentProcessId(); + PE_MODREF *pem; if (!hmod) hmod = GetTaskDS(); /* FIXME: correct? */ - hmod = GetExePtr( hmod ); /* In case we were passed an hInstance */ - + hmod = MODULE_HANDLEtoHMODULE32( hmod ); + if (!hmod) return NULL; if (!(pModule = MODULE_GetPtr( hmod ))) return 0; - if (!(pModule->flags & NE_FFLAGS_WIN32)) return 0; - return pModule->pe_module; + pem = pdb->modref_list; + while (pem && pem->pe_module->mappeddll != hmod) + pem=pem->next; + return pem; } /********************************************************************** @@ -106,12 +112,12 @@ HANDLE32 PE_FindResourceEx32W( LPIMAGE_RESOURCE_DIRECTORY resdirptr; DWORD root; HANDLE32 result; - PE_MODULE *pe = HMODULE32toPE_MODULE(hModule); + PE_MODREF *pem = HMODULE32toPE_MODREF(hModule); - if (!pe || !pe->pe_resource) + if (!pem || !pem->pe_resource) return 0; - resdirptr = pe->pe_resource; + resdirptr = pem->pe_resource; root = (DWORD) resdirptr; if ((resdirptr = GetResDirEntryW(resdirptr, type, root)) == NULL) return 0; @@ -130,13 +136,13 @@ HANDLE32 PE_FindResourceEx32W( */ HANDLE32 PE_LoadResource32( HINSTANCE32 hModule, HANDLE32 hRsrc ) { - PE_MODULE *pe = HMODULE32toPE_MODULE(hModule); + PE_MODREF *pem = HMODULE32toPE_MODREF(hModule); - if (!pe || !pe->pe_resource) + if (!pem || !pem->pe_resource) return 0; if (!hRsrc) return 0; - return (HANDLE32) (pe->load_addr+((LPIMAGE_RESOURCE_DATA_ENTRY)hRsrc)->OffsetToData); + return (HANDLE32) (pem->load_addr+((LPIMAGE_RESOURCE_DATA_ENTRY)hRsrc)->OffsetToData); } @@ -169,21 +175,21 @@ walk_resdir(DWORD loadaddr,DWORD rootresdir,DWORD xres,DWORD data,DWORD lvl,LPDW DWORD PE_SizeofResource32( HINSTANCE32 hModule, HANDLE32 hRsrc ) { - PE_MODULE *pe = HMODULE32toPE_MODULE(hModule); + PE_MODREF *pem = HMODULE32toPE_MODREF(hModule); DWORD max,data; IMAGE_DATA_DIRECTORY dir; - if (!pe || !pe->pe_resource) + if (!pem || !pem->pe_resource) return 0; if (!hRsrc) return 0; max=(DWORD)-1; - dir=pe->pe_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE]; + dir=pem->pe_module->pe_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE]; if(dir.Size) - max=(DWORD)pe->pe_resource+dir.Size; + max=(DWORD)pem->pe_resource+dir.Size; - data=((DWORD)pe->load_addr+((LPIMAGE_RESOURCE_DATA_ENTRY)hRsrc)->OffsetToData); - walk_resdir(pe->load_addr,(DWORD)pe->pe_resource,0,data,0,&max); + data=((DWORD)pem->load_addr+((LPIMAGE_RESOURCE_DATA_ENTRY)hRsrc)->OffsetToData); + walk_resdir(pem->load_addr,(DWORD)pem->pe_resource,0,data,0,&max); return max-data; } @@ -192,24 +198,24 @@ DWORD PE_SizeofResource32( HINSTANCE32 hModule, HANDLE32 hRsrc ) */ BOOL32 PE_EnumResourceTypes32A(HMODULE32 hmod,ENUMRESTYPEPROC32A lpfun,LONG lparam) { - PE_MODULE *pe = HMODULE32toPE_MODULE(hmod); + PE_MODREF *pem = HMODULE32toPE_MODREF(hmod); int i; LPIMAGE_RESOURCE_DIRECTORY resdir; LPIMAGE_RESOURCE_DIRECTORY_ENTRY et; BOOL32 ret; HANDLE32 heap = GetProcessHeap(); - if (!pe || !pe->pe_resource) + if (!pem || !pem->pe_resource) return FALSE; - resdir = (LPIMAGE_RESOURCE_DIRECTORY)pe->pe_resource; + resdir = (LPIMAGE_RESOURCE_DIRECTORY)pem->pe_resource; et =(LPIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY)); ret = FALSE; for (i=0;iNumberOfNamedEntries+resdir->NumberOfIdEntries;i++) { LPSTR name; if (HIWORD(et[i].u1.Name)) - name = HEAP_strdupWtoA(heap,0,(LPWSTR)((LPBYTE)pe->pe_resource+et[i].u1.Name)); + name = HEAP_strdupWtoA(heap,0,(LPWSTR)((LPBYTE)pem->pe_resource+et[i].u1.Name)); else name = (LPSTR)et[i].u1.Name; ret = lpfun(hmod,name,lparam); @@ -226,22 +232,22 @@ PE_EnumResourceTypes32A(HMODULE32 hmod,ENUMRESTYPEPROC32A lpfun,LONG lparam) { */ BOOL32 PE_EnumResourceTypes32W(HMODULE32 hmod,ENUMRESTYPEPROC32W lpfun,LONG lparam) { - PE_MODULE *pe = HMODULE32toPE_MODULE(hmod); + PE_MODREF *pem = HMODULE32toPE_MODREF(hmod); int i; LPIMAGE_RESOURCE_DIRECTORY resdir; LPIMAGE_RESOURCE_DIRECTORY_ENTRY et; BOOL32 ret; - if (!pe || !pe->pe_resource) + if (!pem || !pem->pe_resource) return FALSE; - resdir = (LPIMAGE_RESOURCE_DIRECTORY)pe->pe_resource; + resdir = (LPIMAGE_RESOURCE_DIRECTORY)pem->pe_resource; et =(LPIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY)); ret = FALSE; for (i=0;iNumberOfNamedEntries+resdir->NumberOfIdEntries;i++) { LPWSTR type; if (HIWORD(et[i].u1.Name)) - type = (LPWSTR)((LPBYTE)pe->pe_resource+et[i].u1.Name); + type = (LPWSTR)((LPBYTE)pem->pe_resource+et[i].u1.Name); else type = (LPWSTR)et[i].u1.Name; @@ -259,7 +265,7 @@ BOOL32 PE_EnumResourceNames32A( HMODULE32 hmod,LPCSTR type,ENUMRESNAMEPROC32A lpfun,LONG lparam ) { - PE_MODULE *pe = HMODULE32toPE_MODULE(hmod); + PE_MODREF *pem = HMODULE32toPE_MODREF(hmod); int i; LPIMAGE_RESOURCE_DIRECTORY resdir; LPIMAGE_RESOURCE_DIRECTORY_ENTRY et; @@ -267,14 +273,14 @@ PE_EnumResourceNames32A( HANDLE32 heap = GetProcessHeap(); LPWSTR typeW; - if (!pe || !pe->pe_resource) + if (!pem || !pem->pe_resource) return FALSE; - resdir = (LPIMAGE_RESOURCE_DIRECTORY)pe->pe_resource; + resdir = (LPIMAGE_RESOURCE_DIRECTORY)pem->pe_resource; if (HIWORD(type)) typeW = HEAP_strdupAtoW(heap,0,type); else typeW = (LPWSTR)type; - resdir = GetResDirEntryW(resdir,typeW,(DWORD)pe->pe_resource); + resdir = GetResDirEntryW(resdir,typeW,(DWORD)pem->pe_resource); if (HIWORD(typeW)) HeapFree(heap,0,typeW); if (!resdir) @@ -285,7 +291,7 @@ PE_EnumResourceNames32A( LPSTR name; if (HIWORD(et[i].u1.Name)) - name = HEAP_strdupWtoA(heap,0,(LPWSTR)((LPBYTE)pe->pe_resource+et[i].u1.Name)); + name = HEAP_strdupWtoA(heap,0,(LPWSTR)((LPBYTE)pem->pe_resource+et[i].u1.Name)); else name = (LPSTR)et[i].u1.Name; ret = lpfun(hmod,type,name,lparam); @@ -303,17 +309,17 @@ BOOL32 PE_EnumResourceNames32W( HMODULE32 hmod,LPCWSTR type,ENUMRESNAMEPROC32W lpfun,LONG lparam ) { - PE_MODULE *pe = HMODULE32toPE_MODULE(hmod); + PE_MODREF *pem = HMODULE32toPE_MODREF(hmod); int i; LPIMAGE_RESOURCE_DIRECTORY resdir; LPIMAGE_RESOURCE_DIRECTORY_ENTRY et; BOOL32 ret; - if (!pe || !pe->pe_resource) + if (!pem || !pem->pe_resource) return FALSE; - resdir = (LPIMAGE_RESOURCE_DIRECTORY)pe->pe_resource; - resdir = GetResDirEntryW(resdir,type,(DWORD)pe->pe_resource); + resdir = (LPIMAGE_RESOURCE_DIRECTORY)pem->pe_resource; + resdir = GetResDirEntryW(resdir,type,(DWORD)pem->pe_resource); if (!resdir) return FALSE; et =(LPIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY)); @@ -321,7 +327,7 @@ PE_EnumResourceNames32W( for (i=0;iNumberOfNamedEntries+resdir->NumberOfIdEntries;i++) { LPWSTR name; if (HIWORD(et[i].u1.Name)) - name = (LPWSTR)((LPBYTE)pe->pe_resource+et[i].u1.Name); + name = (LPWSTR)((LPBYTE)pem->pe_resource+et[i].u1.Name); else name = (LPWSTR)et[i].u1.Name; ret = lpfun(hmod,type,name,lparam); @@ -339,7 +345,7 @@ PE_EnumResourceLanguages32A( HMODULE32 hmod,LPCSTR name,LPCSTR type,ENUMRESLANGPROC32A lpfun, LONG lparam ) { - PE_MODULE *pe = HMODULE32toPE_MODULE(hmod); + PE_MODREF *pem = HMODULE32toPE_MODREF(hmod); int i; LPIMAGE_RESOURCE_DIRECTORY resdir; LPIMAGE_RESOURCE_DIRECTORY_ENTRY et; @@ -347,15 +353,15 @@ PE_EnumResourceLanguages32A( HANDLE32 heap = GetProcessHeap(); LPWSTR nameW,typeW; - if (!pe || !pe->pe_resource) + if (!pem || !pem->pe_resource) return FALSE; - resdir = (LPIMAGE_RESOURCE_DIRECTORY)pe->pe_resource; + resdir = (LPIMAGE_RESOURCE_DIRECTORY)pem->pe_resource; if (HIWORD(name)) nameW = HEAP_strdupAtoW(heap,0,name); else nameW = (LPWSTR)name; - resdir = GetResDirEntryW(resdir,nameW,(DWORD)pe->pe_resource); + resdir = GetResDirEntryW(resdir,nameW,(DWORD)pem->pe_resource); if (HIWORD(nameW)) HeapFree(heap,0,nameW); if (!resdir) @@ -364,7 +370,7 @@ PE_EnumResourceLanguages32A( typeW = HEAP_strdupAtoW(heap,0,type); else typeW = (LPWSTR)type; - resdir = GetResDirEntryW(resdir,typeW,(DWORD)pe->pe_resource); + resdir = GetResDirEntryW(resdir,typeW,(DWORD)pem->pe_resource); if (HIWORD(typeW)) HeapFree(heap,0,typeW); if (!resdir) @@ -372,7 +378,7 @@ PE_EnumResourceLanguages32A( et =(LPIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY)); ret = FALSE; for (i=0;iNumberOfNamedEntries+resdir->NumberOfIdEntries;i++) { - /* languages are just ids... I hope */ + /* languages are just ids... I hopem */ ret = lpfun(hmod,name,type,et[i].u1.Id,lparam); if (!ret) break; @@ -388,20 +394,20 @@ PE_EnumResourceLanguages32W( HMODULE32 hmod,LPCWSTR name,LPCWSTR type,ENUMRESLANGPROC32W lpfun, LONG lparam ) { - PE_MODULE *pe = HMODULE32toPE_MODULE(hmod); + PE_MODREF *pem = HMODULE32toPE_MODREF(hmod); int i; LPIMAGE_RESOURCE_DIRECTORY resdir; LPIMAGE_RESOURCE_DIRECTORY_ENTRY et; BOOL32 ret; - if (!pe || !pe->pe_resource) + if (!pem || !pem->pe_resource) return FALSE; - resdir = (LPIMAGE_RESOURCE_DIRECTORY)pe->pe_resource; - resdir = GetResDirEntryW(resdir,name,(DWORD)pe->pe_resource); + resdir = (LPIMAGE_RESOURCE_DIRECTORY)pem->pe_resource; + resdir = GetResDirEntryW(resdir,name,(DWORD)pem->pe_resource); if (!resdir) return FALSE; - resdir = GetResDirEntryW(resdir,type,(DWORD)pe->pe_resource); + resdir = GetResDirEntryW(resdir,type,(DWORD)pem->pe_resource); if (!resdir) return FALSE; et =(LPIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY)); diff --git a/loader/resource.c b/loader/resource.c index 31c645344ad..2654396b9fe 100644 --- a/loader/resource.c +++ b/loader/resource.c @@ -18,6 +18,7 @@ #include "global.h" #include "heap.h" #include "neexe.h" +#include "task.h" #include "accel.h" #include "module.h" #include "resource.h" @@ -33,6 +34,11 @@ extern WORD WINE_LanguageId; +/* error message when 16-bit resource function is called for Win32 module */ +static const char* NEWin32FailureString = "fails with Win32 module\n"; +/* error message when 32-bit resource function is called for Win16 module */ +static const char* PEWin16FailureString = "fails with Win16 module\n"; + /********************************************************************** * FindResource16 (KERNEL.60) */ @@ -40,9 +46,10 @@ HRSRC16 WINAPI FindResource16( HMODULE16 hModule, SEGPTR name, SEGPTR type ) { NE_MODULE *pModule; - hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ + hModule = MODULE_HANDLEtoHMODULE16( hModule ); dprintf_resource(stddeb, "FindResource16: module=%04x type=", hModule ); PrintId( type ); + if (HIWORD(name)) /* Check for '#xxx' name */ { char *ptr = PTR_SEG_TO_LIN( name ); @@ -50,20 +57,23 @@ HRSRC16 WINAPI FindResource16( HMODULE16 hModule, SEGPTR name, SEGPTR type ) if (!(name = (SEGPTR)atoi( ptr + 1 ))) return 0; } } + dprintf_resource( stddeb, " name=" ); PrintId( name ); dprintf_resource( stddeb, "\n" ); - if (!(pModule = MODULE_GetPtr( hModule ))) return 0; -#ifndef WINELIB - if (pModule->flags & NE_FFLAGS_WIN32) + + if ((pModule = MODULE_GetPtr( hModule ))) { - fprintf(stderr,"Don't know how to FindResource16() for Win32 module\n"); - return 0; - } - return NE_FindResource( hModule, type, name ); +#ifndef WINELIB + if (pModule->flags & NE_FFLAGS_WIN32) + fprintf(stderr,"FindResource16: %s", NEWin32FailureString); + else + return NE_FindResource( hModule, type, name ); #else - return LIBRES_FindResource16( hModule, name, type ); + return LIBRES_FindResource16( hModule, name, type ); #endif + } + return 0; } @@ -109,7 +119,7 @@ HRSRC32 WINAPI FindResourceEx32W( HINSTANCE32 hModule, LPCWSTR name, NE_MODULE *pModule; if (!hModule) hModule = GetTaskDS(); - hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ + hModule = MODULE_HANDLEtoHMODULE32( hModule ); dprintf_resource(stddeb, "FindResource32W: module=%08x type=", hModule ); if (HIWORD(type)) dprintf_resource(stddeb,"%p",type); @@ -145,21 +155,22 @@ HGLOBAL16 WINAPI LoadResource16( HMODULE16 hModule, HRSRC16 hRsrc ) { NE_MODULE *pModule; - hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ + hModule = MODULE_HANDLEtoHMODULE16( hModule ); dprintf_resource(stddeb, "LoadResource16: module=%04x res=%04x\n", hModule, hRsrc ); if (!hRsrc) return 0; - if (!(pModule = MODULE_GetPtr( hModule ))) return 0; -#ifndef WINELIB - if (pModule->flags & NE_FFLAGS_WIN32) + if ((pModule = MODULE_GetPtr( hModule ))) { - fprintf(stderr,"Don't know how to LoadResource16() for Win32 module\n"); - return 0; - } - return NE_LoadResource( hModule, hRsrc ); +#ifndef WINELIB + if (pModule->flags & NE_FFLAGS_WIN32) + fprintf(stderr,"LoadResource16: %s", NEWin32FailureString); + else + return NE_LoadResource( hModule, hRsrc ); #else - return LIBRES_LoadResource( hModule, hRsrc ); + return LIBRES_LoadResource( hModule, hRsrc ); #endif + } + return 0; } /********************************************************************** @@ -171,7 +182,7 @@ HGLOBAL32 WINAPI LoadResource32( HINSTANCE32 hModule, HRSRC32 hRsrc ) NE_MODULE *pModule; if (!hModule) hModule = GetTaskDS(); /* FIXME: see FindResource32W */ - hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ + hModule = MODULE_HANDLEtoHMODULE32( hModule ); dprintf_resource(stddeb, "LoadResource32: module=%04x res=%04x\n", hModule, hRsrc ); if (!hRsrc) return 0; @@ -179,7 +190,7 @@ HGLOBAL32 WINAPI LoadResource32( HINSTANCE32 hModule, HRSRC32 hRsrc ) if (!(pModule = MODULE_GetPtr( hModule ))) return 0; if (!(pModule->flags & NE_FFLAGS_WIN32)) { - fprintf(stderr,"LoadResource32: tried to load a non win32 resource.\n"); + fprintf(stderr,"LoadResource32: %s", PEWin16FailureString ); return 0; /* FIXME? */ } return PE_LoadResource32(hModule,hRsrc); @@ -201,11 +212,11 @@ SEGPTR WINAPI WIN16_LockResource16(HGLOBAL16 handle) dprintf_resource(stddeb, "LockResource: handle=%04x\n", handle ); if (!handle) return (SEGPTR)0; - hModule = GetExePtr( handle ); + hModule = MODULE_HANDLEtoHMODULE16( handle ); if (!(pModule = MODULE_GetPtr( hModule ))) return 0; if (pModule->flags & NE_FFLAGS_WIN32) { - fprintf(stderr,"Don't know how to LockResource() for Win32 module\n"); + fprintf(stderr,"LockResource16: %s", NEWin32FailureString); return 0; } return NE_LockResource( hModule, handle ); @@ -223,11 +234,11 @@ LPVOID WINAPI LockResource16( HGLOBAL16 handle ) dprintf_resource(stddeb, "LockResource: handle=%04x\n", handle ); if (!handle) return NULL; - hModule = GetExePtr( handle ); + hModule = MODULE_HANDLEtoHMODULE16( handle ); if (!(pModule = MODULE_GetPtr( hModule ))) return 0; if (pModule->flags & NE_FFLAGS_WIN32) { - fprintf(stderr,"Don't know how to LockResource16() for Win32 module\n"); + fprintf(stderr,"LockResource16: %s", NEWin32FailureString); return 0; } return (LPSTR)PTR_SEG_TO_LIN( NE_LockResource( hModule, handle ) ); @@ -257,11 +268,11 @@ BOOL16 WINAPI FreeResource16( HGLOBAL16 handle ) dprintf_resource(stddeb, "FreeResource16: handle=%04x\n", handle ); if (!handle) return FALSE; - hModule = GetExePtr( handle ); + hModule = MODULE_HANDLEtoHMODULE16( handle ); if (!(pModule = MODULE_GetPtr( hModule ))) return 0; if (pModule->flags & NE_FFLAGS_WIN32) { - fprintf(stderr,"Don't know how to FreeResource16() for Win32 module\n"); + fprintf(stderr,"FreeResource16: %s", NEWin32FailureString); return 0; } return NE_FreeResource( hModule, handle ); @@ -287,7 +298,7 @@ INT16 WINAPI AccessResource16( HINSTANCE16 hModule, HRSRC16 hRsrc ) { NE_MODULE *pModule; - hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ + hModule = MODULE_HANDLEtoHMODULE16( hModule ); dprintf_resource(stddeb, "AccessResource16: module=%04x res=%04x\n", hModule, hRsrc ); if (!hRsrc) return 0; @@ -295,7 +306,7 @@ INT16 WINAPI AccessResource16( HINSTANCE16 hModule, HRSRC16 hRsrc ) #ifndef WINELIB if (pModule->flags & NE_FFLAGS_WIN32) { - fprintf(stderr,"Don't know how to AccessResource16() for Win32 module\n"); + fprintf(stderr,"AccessResource16: %s", NEWin32FailureString); return 0; } return NE_AccessResource( hModule, hRsrc ); @@ -310,7 +321,7 @@ INT16 WINAPI AccessResource16( HINSTANCE16 hModule, HRSRC16 hRsrc ) */ INT32 WINAPI AccessResource32( HINSTANCE32 hModule, HRSRC32 hRsrc ) { - hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ + hModule = MODULE_HANDLEtoHMODULE32( hModule ); dprintf_resource(stddeb, "AccessResource: module=%04x res=%04x\n", hModule, hRsrc ); if (!hRsrc) return 0; @@ -326,14 +337,14 @@ DWORD WINAPI SizeofResource16( HMODULE16 hModule, HRSRC16 hRsrc ) { NE_MODULE *pModule; - hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ + hModule = MODULE_HANDLEtoHMODULE16( hModule ); dprintf_resource(stddeb, "SizeofResource16: module=%04x res=%04x\n", hModule, hRsrc ); if (!(pModule = MODULE_GetPtr( hModule ))) return 0; #ifndef WINELIB if (pModule->flags & NE_FFLAGS_WIN32) { - fprintf(stderr,"Don't know how to SizeOfResource16() for Win32 module\n"); + fprintf(stderr,"SizeOfResource16: %s", NEWin32FailureString); return 0; } return NE_SizeofResource( hModule, hRsrc ); @@ -348,7 +359,7 @@ DWORD WINAPI SizeofResource16( HMODULE16 hModule, HRSRC16 hRsrc ) */ DWORD WINAPI SizeofResource32( HINSTANCE32 hModule, HRSRC32 hRsrc ) { - hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ + hModule = MODULE_HANDLEtoHMODULE32( hModule ); dprintf_resource(stddeb, "SizeofResource32: module=%04x res=%04x\n", hModule, hRsrc ); #ifndef WINELIB @@ -367,7 +378,7 @@ HGLOBAL16 WINAPI AllocResource16( HMODULE16 hModule, HRSRC16 hRsrc, DWORD size) { NE_MODULE *pModule; - hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ + hModule = MODULE_HANDLEtoHMODULE16( hModule ); dprintf_resource(stddeb, "AllocResource: module=%04x res=%04x size=%ld\n", hModule, hRsrc, size ); if (!hRsrc) return 0; @@ -375,7 +386,7 @@ HGLOBAL16 WINAPI AllocResource16( HMODULE16 hModule, HRSRC16 hRsrc, DWORD size) #ifndef WINELIB if (pModule->flags & NE_FFLAGS_WIN32) { - fprintf(stderr,"Don't know how to AllocResource() for Win32 module\n"); + fprintf(stderr,"AllocResource16: %s", NEWin32FailureString); return 0; } return NE_AllocResource( hModule, hRsrc, size ); @@ -394,7 +405,7 @@ HGLOBAL16 WINAPI DirectResAlloc( HINSTANCE16 hInstance, WORD wType, { dprintf_resource(stddeb,"DirectResAlloc(%04x,%04x,%04x)\n", hInstance, wType, wSize ); - hInstance = GetExePtr(hInstance); + hInstance = MODULE_HANDLEtoHMODULE16(hInstance); if(!hInstance)return 0; if(wType != 0x10) /* 0x10 is the only observed value, passed from CreateCursorIndirect. */ @@ -405,6 +416,9 @@ HGLOBAL16 WINAPI DirectResAlloc( HINSTANCE16 hInstance, WORD wType, /********************************************************************** * LoadAccelerators16 [USER.177] + * + * FIXME: this code leaks memory because HACCEL must be a result of LoadResource() + * (see TWIN for hints). */ HACCEL16 WINAPI LoadAccelerators16(HINSTANCE16 instance, SEGPTR lpTableName) { @@ -578,6 +592,8 @@ INT32 WINAPI LoadString32W( HINSTANCE32 instance, UINT32 resource_id, int string_num; int i; + if (HIWORD(resource_id)==0xFFFF) /* netscape 3 passes this */ + resource_id = (UINT32)(-((INT32)resource_id)); dprintf_resource(stddeb, "LoadString: instance = %04x, id = %04x, buffer = %08x, " "length = %d\n", instance, (int)resource_id, (int) buffer, buflen); @@ -747,15 +763,24 @@ INT32 LoadMessage32W( HINSTANCE32 instance, UINT32 id, WORD lang, /********************************************************************** * SetResourceHandler (KERNEL.43) */ -FARPROC16 WINAPI SetResourceHandler( HINSTANCE16 instance, SEGPTR s, - FARPROC16 farproc ) +FARPROC16 WINAPI SetResourceHandler( HMODULE16 hModule, SEGPTR s, + FARPROC16 resourceHandler ) { - if (HIWORD(s)) - 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); + NE_MODULE *pModule; + + hModule = GetExePtr( hModule ); + + dprintf_resource(stddeb, "SetResourceHandler: module=%04x type=", hModule ); + PrintId( s ); + dprintf_resource( stddeb, "\n" ); + + if ((pModule = MODULE_GetPtr( hModule ))) + { + if (pModule->flags & NE_FFLAGS_WIN32) + fprintf(stderr,"SetResourceHandler: %s", NEWin32FailureString); + else if (pModule->res_table) + return NE_SetResourceHandler( hModule, s, resourceHandler ); + } return NULL; } diff --git a/loader/task.c b/loader/task.c index 467548c8743..32669769779 100644 --- a/loader/task.c +++ b/loader/task.c @@ -9,7 +9,7 @@ #include #include "windows.h" -#include "task.h" +#include "user.h" #include "callback.h" #include "file.h" #include "global.h" @@ -40,9 +40,9 @@ /* Min. number of thunks allocated when creating a new segment */ #define MIN_THUNKS 32 -extern INT32 WINSOCK_DeleteTaskWSI( TDB* pTask, struct _WSINFO* pwsi ); -extern void USER_AppExit( HTASK16, HINSTANCE16, HQUEUE16 ); -extern void PE_InitTls( PE_MODULE *module ); +extern INT32 WINSOCK_DeleteTaskWSI( TDB* pTask, struct _WSINFO* ); +extern BOOL32 MODULE_FreeModule( HMODULE16 hModule, TDB* ptaskContext ); +extern void PE_InitTls( PDB32 *pdb32 ); /* Saved 16-bit stack for current process (Win16 only) */ DWORD IF1632_Saved16_ss_sp = 0; @@ -370,12 +370,16 @@ static void TASK_CallToStart(void) extern void InitTask( CONTEXT *context ); + FARPROC32 entry = (FARPROC32)(pCurrentProcess->exe_modref->load_addr + + pCurrentProcess->exe_modref->pe_module->pe_header->OptionalHeader.AddressOfEntryPoint); + InitTask( NULL ); InitApp( pTask->hModule ); __asm__ __volatile__("movw %w0,%%fs"::"r" (pCurrentThread->teb_sel)); - PE_InitializeDLLs( pTask->hModule, DLL_PROCESS_ATTACH, (LPVOID)-1 ); - exit_code = CallTaskStart32((FARPROC32)(pModule->pe_module->load_addr + - pModule->pe_module->pe_header->OptionalHeader.AddressOfEntryPoint) ); + + PE_InitializeDLLs( pCurrentProcess, DLL_PROCESS_ATTACH, (LPVOID)-1 ); + dprintf_relay( stddeb, "CallTo32(entryproc=%p)\n", entry ); + exit_code = entry(); TASK_KillCurrentTask( exit_code ); } else @@ -437,6 +441,7 @@ HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance, STACK32FRAME *frame32; #ifndef WINELIB32 extern DWORD CALLTO16_RetAddr_word; + extern void CALLTO16_Restore(); #endif if (!(pModule = MODULE_GetPtr( hModule ))) return 0; @@ -546,18 +551,21 @@ HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance, /* Create the Win32 part of the task */ - pdb32 = PROCESS_Create( pTask ); + pCurrentProcess = pdb32 = PROCESS_Create( pTask, cmdLine ); pdb32->task = hTask; if (pModule->flags & NE_FFLAGS_WIN32) { + /* LPTHREAD_START_ROUTINE start = - (LPTHREAD_START_ROUTINE)(pModule->pe_module->load_addr + - pModule->pe_module->pe_header->OptionalHeader.AddressOfEntryPoint); - pTask->thdb = THREAD_Create( pdb32, 0, start ); + (LPTHREAD_START_ROUTINE)( + pCurrentProcess->exe_modref->load_addr + + pCurrentProcess->exe_modref->pe_module->pe_header->OptionalHeader.AddressOfEntryPoint); + */ + pTask->thdb = THREAD_Create( pdb32, 0, 0 ); #ifndef WINELIB /* FIXME: should not be done here */ pCurrentThread = pTask->thdb; - PE_InitTls( pModule->pe_module ); + PE_InitTls( pdb32 ); #endif } else @@ -575,6 +583,7 @@ HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance, frame32->ebx = 0; frame32->ebp = 0; #ifndef WINELIB + frame32->restore_addr = (DWORD)CALLTO16_Restore; frame32->retaddr = (DWORD)TASK_CallToStart; frame32->codeselector = WINE_CODE_SELECTOR; #endif @@ -613,10 +622,12 @@ HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance, { if (pModule->flags & NE_FFLAGS_WIN32) { - DBG_ADDR addr = { NULL, 0, pModule->pe_module->load_addr + - pModule->pe_module->pe_header->OptionalHeader.AddressOfEntryPoint }; + /* + DBG_ADDR addr = { NULL, 0, pCurrentProcess->exe_modref->load_addr + + pCurrentProcess->exe_modref->pe_module->pe_header->OptionalHeader.AddressOfEntryPoint }; fprintf( stderr, "Win32 task '%s': ", name ); DEBUG_AddBreakpoint( &addr ); + */ } else { @@ -656,7 +667,7 @@ static void TASK_DeleteTask( HTASK16 hTask ) /* Free the task module */ - FreeModule16( pTask->hModule ); + MODULE_FreeModule( pTask->hModule, pTask ); /* Free the selector aliases */ @@ -691,17 +702,16 @@ void TASK_KillCurrentTask( INT16 exitCode ) dprintf_task(stddeb, "Killing task %04x\n", hCurrentTask ); - /* Clean up sockets */ + /* Delete active sockets */ - if( pTask->pwsi ) - { - dprintf_task(stddeb, "\tremoving socket table\n"); + if( pTask->pwsi ) WINSOCK_DeleteTaskWSI( pTask, pTask->pwsi ); - } /* Perform USER cleanup */ - USER_AppExit( hCurrentTask, pTask->hInstance, pTask->hQueue ); + if (pTask->userhandler) + pTask->userhandler( hCurrentTask, USIG_TERMINATION, 0, + pTask->hInstance, pTask->hQueue ); if (hTaskToKill && (hTaskToKill != hCurrentTask)) { @@ -867,6 +877,8 @@ void TASK_YieldToSystem(TDB* pTask) /*********************************************************************** * InitTask (KERNEL.91) + * + * Called by the application startup code. */ void WINAPI InitTask( CONTEXT *context ) { @@ -880,7 +892,13 @@ void WINAPI InitTask( CONTEXT *context ) if (!(pTask = (TDB *)GlobalLock16( hCurrentTask ))) return; if (!(pModule = MODULE_GetPtr( pTask->hModule ))) return; + /* This is a hack to install task USER signal handler before + * implicitly loaded DLLs are initialized (see windows/user.c) */ + + pTask->userhandler = (USERSIGNALPROC)&USER_SignalProc; + #ifndef WINELIB + /* Initialize implicitly loaded DLLs */ NE_InitializeDLLs( pTask->hModule ); #endif @@ -1374,6 +1392,8 @@ BOOL16 WINAPI IsTask( HTASK16 hTask ) /*********************************************************************** * SetTaskSignalProc (KERNEL.38) + * + * Real 16-bit interface is provided by the THUNK_SetTaskSignalProc. */ FARPROC16 WINAPI SetTaskSignalProc( HTASK16 hTask, FARPROC16 proc ) { @@ -1382,8 +1402,8 @@ FARPROC16 WINAPI SetTaskSignalProc( HTASK16 hTask, FARPROC16 proc ) if (!hTask) hTask = hCurrentTask; if (!(pTask = (TDB *)GlobalLock16( hTask ))) return NULL; - oldProc = pTask->userhandler; - pTask->userhandler = proc; + oldProc = (FARPROC16)pTask->userhandler; + pTask->userhandler = (USERSIGNALPROC)proc; return oldProc; } @@ -1464,7 +1484,6 @@ HMODULE16 WINAPI GetExePtr( HANDLE16 handle ) return 0; } - /*********************************************************************** * TaskFirst (TOOLHELP.63) */ diff --git a/memory/global.c b/memory/global.c index 45088c25c34..ce11ed27bc0 100644 --- a/memory/global.c +++ b/memory/global.c @@ -17,6 +17,7 @@ #include "miscemu.h" #include "dde_mem.h" #include "stackframe.h" +#include "module.h" #include "options.h" #include "stddebug.h" #include "debug.h" @@ -206,6 +207,7 @@ HGLOBAL16 GLOBAL_Alloc( UINT16 flags, DWORD size, HGLOBAL16 hOwner, { ptr = HeapAlloc( SystemHeap, 0, size ); } + /* FIXME: free discardable blocks and try again? */ if (!ptr) return 0; /* Allocate the selector(s) */ @@ -274,7 +276,7 @@ HGLOBAL16 WINAPI GlobalAlloc16( UINT16 flags, DWORD size ) HANDLE16 owner = GetCurrentPDB(); if (flags & GMEM_DDESHARE) - owner = GetExePtr(owner); /* Make it a module handle */ + owner = MODULE_HANDLEtoHMODULE16(owner); /* Make it a module handle */ return GLOBAL_Alloc( flags, size, owner, FALSE, FALSE, FALSE ); } @@ -313,8 +315,11 @@ HGLOBAL16 WINAPI GlobalReAlloc16( HGLOBAL16 handle, DWORD size, UINT16 flags ) (pArena->lockCount > 0) || (pArena->pageLockCount > 0)) return 0; HeapFree( SystemHeap, 0, (void *)pArena->base ); pArena->base = 0; - /* Note: we rely on the fact that SELECTOR_ReallocBlock won't */ - /* change the selector if we are shrinking the block */ + + /* Note: we rely on the fact that SELECTOR_ReallocBlock won't + * change the selector if we are shrinking the block. + * FIXME: shouldn't we keep selectors until the block is deleted? + */ SELECTOR_ReallocBlock( sel, 0, 1, SEGMENT_DATA, 0, 0 ); return handle; } @@ -411,15 +416,20 @@ SEGPTR WINAPI WIN16_GlobalLock16( HGLOBAL16 handle ) { dprintf_global( stddeb, "WIN16_GlobalLock16(%04x) -> %08lx\n", handle, MAKELONG( 0, GlobalHandleToSel(handle)) ); - if (!handle) return 0; + if (handle) + { + if (handle == (HGLOBAL16)-1) handle = CURRENT_DS; #ifdef CONFIG_IPC - if (is_dde_handle(handle)) - return PTR_SEG_OFF_TO_SEGPTR( DDE_GlobalHandleToSel(handle), 0 ); + if (is_dde_handle(handle)) + return PTR_SEG_OFF_TO_SEGPTR( DDE_GlobalHandleToSel(handle), 0 ); #endif /* CONFIG_IPC */ - if (!GET_ARENA_PTR(handle)->base) return (SEGPTR)0; - return PTR_SEG_OFF_TO_SEGPTR( GlobalHandleToSel(handle), 0 ); + if (!GET_ARENA_PTR(handle)->base) return (SEGPTR)0; + return PTR_SEG_OFF_TO_SEGPTR( GlobalHandleToSel(handle), 0 ); + /* FIXME: put segment value in CX as well */ + } + return (SEGPTR)0; } diff --git a/memory/local.c b/memory/local.c index 894bebaa28a..c0062dccf0b 100644 --- a/memory/local.c +++ b/memory/local.c @@ -16,6 +16,7 @@ #include #include "windows.h" #include "ldt.h" +#include "task.h" #include "global.h" #include "heap.h" #include "instance.h" @@ -333,7 +334,7 @@ BOOL16 WINAPI LocalInit( HANDLE16 selector, WORD start, WORD end ) if (start == 0) { /* Check if the segment is the DGROUP of a module */ - if ((pModule = MODULE_GetPtr( GetExePtr( selector ) ))) + if ((pModule = MODULE_GetPtr( selector ))) { SEGTABLEENTRY *pSeg = NE_SEG_TABLE( pModule ) + pModule->dgroup - 1; if (pModule->dgroup && (pSeg->selector == selector)) { @@ -1582,7 +1583,6 @@ DWORD WINAPI GetHeapSpaces( HMODULE16 module ) NE_MODULE *pModule; WORD ds; - module = GetExePtr( module ); if (!(pModule = MODULE_GetPtr( module ))) return 0; ds = (NE_SEG_TABLE( pModule ) + pModule->dgroup - 1)->selector; return MAKELONG( LOCAL_CountFree( ds ), LOCAL_HeapSize( ds ) ); diff --git a/memory/string.c b/memory/string.c index 72efb864ec9..60194a36472 100644 --- a/memory/string.c +++ b/memory/string.c @@ -8,6 +8,7 @@ #include #include #include "windows.h" +#include "winerror.h" #include "ldt.h" #include "stddebug.h" #include "debug.h" @@ -147,6 +148,12 @@ INT16 WINAPI lstrcmp16( LPCSTR str1, LPCSTR str2 ) */ INT32 WINAPI lstrcmp32A( LPCSTR str1, LPCSTR str2 ) { + /* Win95 KERNEL32.DLL does it that way. Hands off! */ + if (!str1 || !str2) { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + dprintf_string(stddeb,"strcmp: '%s' and '%s'\n", (str1)?str1:"NULL",(str2)?str2:"NULL"); return (INT32)strcmp( str1, str2 ); @@ -158,6 +165,10 @@ INT32 WINAPI lstrcmp32A( LPCSTR str1, LPCSTR str2 ) */ INT32 WINAPI lstrcmp32W( LPCWSTR str1, LPCWSTR str2 ) { + if (!str1 || !str2) { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } while (*str1 && (*str1 == *str2)) { str1++; str2++; } return (INT32)(*str1 - *str2); } @@ -179,6 +190,10 @@ INT32 WINAPI lstrcmpi32A( LPCSTR str1, LPCSTR str2 ) { INT32 res; + if (!str1 || !str2) { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } dprintf_string(stddeb,"strcmpi '%s' and '%s'\n", (str1)?str1:"NULL",(str2)?str2:"NULL"); while (*str1) @@ -198,6 +213,10 @@ INT32 WINAPI lstrcmpi32W( LPCWSTR str1, LPCWSTR str2 ) { INT32 res; + if (!str1 || !str2) { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } while (*str1) { /* FIXME: Unicode */ diff --git a/memory/virtual.c b/memory/virtual.c index f3765b2e30c..0788836071a 100644 --- a/memory/virtual.c +++ b/memory/virtual.c @@ -118,19 +118,19 @@ static void VIRTUAL_DumpView( FILE_VIEW *view ) UINT32 addr = view->base; BYTE prot = view->prot[0]; - fprintf( stderr, "View: %08x - %08x%s", + dprintf_virtual( stddeb, "View: %08x - %08x%s", view->base, view->base + view->size - 1, (view->flags & VFLAG_SYSTEM) ? " (system)" : "" ); if (view->mapping && view->mapping->file) - fprintf( stderr, " %s @ %08x\n", + dprintf_virtual( stddeb, " %s @ %08x\n", view->mapping->file->unix_name, view->offset ); else - fprintf( stderr, " (anonymous)\n"); + dprintf_virtual( stddeb, " (anonymous)\n"); for (count = i = 1; i < view->size >> page_shift; i++, count++) { if (view->prot[i] == prot) continue; - fprintf( stderr, " %08x - %08x %s\n", + dprintf_virtual( stddeb, " %08x - %08x %s\n", addr, addr + (count << page_shift) - 1, VIRTUAL_GetProtStr(prot) ); addr += (count << page_shift); @@ -138,7 +138,7 @@ static void VIRTUAL_DumpView( FILE_VIEW *view ) count = 0; } if (count) - fprintf( stderr, " %08x - %08x %s\n", + dprintf_virtual( stddeb, " %08x - %08x %s\n", addr, addr + (count << page_shift) - 1, VIRTUAL_GetProtStr(prot) ); } @@ -150,7 +150,7 @@ static void VIRTUAL_DumpView( FILE_VIEW *view ) void VIRTUAL_Dump(void) { FILE_VIEW *view = VIRTUAL_FirstView; - fprintf( stderr, "\nDump of all virtual memory views:\n\n" ); + dprintf_virtual( stddeb, "\nDump of all virtual memory views:\n\n" ); while (view) { VIRTUAL_DumpView( view ); diff --git a/misc/comm.c b/misc/comm.c index f23666fc9f2..22e16c98d67 100644 --- a/misc/comm.c +++ b/misc/comm.c @@ -1,4 +1,4 @@ -/* + /* * DEC 93 Erik Bos * * Copyright 1996 Marcus Meissner @@ -11,6 +11,9 @@ * IMHO, they are still wrong, but they at least implement the RXCHAR * event and return I/O queue sizes, which makes the app I'm interested * in (analog devices EZKIT DSP development system) work. + * + * August 12, 1997. Take a bash at SetCommEventMask - Lawson Whitney + * */ #include @@ -38,7 +41,7 @@ #ifndef TIOCINQ #define TIOCINQ FIONREAD #endif - +#define msr 35 /* offset in unknown structure commMask */ /* * [RER] These are globals are wrong. They should be in DosDeviceStruct * on a per port basis. @@ -47,6 +50,7 @@ int commerror = 0, eventmask = 0; struct DosDeviceStruct COM[MAX_PORTS]; struct DosDeviceStruct LPT[MAX_PORTS]; +LPCVOID *unknown[MAX_PORTS]; void COMM_Init(void) { @@ -126,6 +130,18 @@ struct DosDeviceStruct *GetDeviceStruct(int fd) return NULL; } +int GetCommPort(int fd) +{ + int x; + + for (x=0; xfd = 0; /* [RER] Really, -1 would be a better value */ - if (close(fd) == -1) { commerror = WinError(); return -1; @@ -738,7 +756,17 @@ INT16 WINAPI FlushComm(INT16 fd,INT16 fnQueue) } } -/***************************************************************************** +/******************************************************************** + * PurgeComm (KERNEL32.557) + */ +BOOL32 WINAPI PurgeComm( HANDLE32 hFile, DWORD flags) +{ + dprintf_comm(stdnimp, "PurgeComm(%08x %08lx) unimplemented stub\n", + hFile, flags); + return 0; +} + +/******************************************************************** * GetCommError (USER.203) */ INT16 WINAPI GetCommError(INT16 fd,LPCOMSTAT lpStat) @@ -794,11 +822,26 @@ BOOL32 WINAPI ClearCommError(INT32 fd,LPDWORD errors,LPCOMSTAT lpStat) /***************************************************************************** * SetCommEventMask (USER.208) */ -UINT16* WINAPI SetCommEventMask(INT16 fd,UINT16 fuEvtMask) +SEGPTR WINAPI SetCommEventMask(INT16 fd,UINT16 fuEvtMask) { + unsigned char *stol; + int act; + int repid; + unsigned int mstat; dprintf_comm(stddeb,"SetCommEventMask:fd %d,mask %d\n",fd,fuEvtMask); eventmask |= fuEvtMask; - return (UINT16 *)&eventmask; /* FIXME, should be SEGPTR */ + if ((act = GetCommPort(fd)) == -1) { + dprintf_comm(stddeb," fd %d not comm port\n",act); + return NULL;} + stol = unknown[act]; + stol += msr; + repid = ioctl(fd,TIOCMGET,&mstat); + dprintf_comm(stddeb, + " ioctl %d, msr %x at %lx %lx\n",repid,mstat,stol,unknown[act]); + if ((mstat&TIOCM_CAR)) {*stol |= 0x80;} + else {*stol &=0x7f;} + dprintf_comm(stddeb," modem dcd construct %x\n",*stol); + return SEGPTR_GET(unknown[act]); } /***************************************************************************** @@ -845,6 +888,15 @@ UINT16 WINAPI GetCommEventMask(INT16 fd,UINT16 fnEvtClear) #endif } +/***************************************************************************** + * SetupComm (KERNEL32.676) + */ +BOOL32 WINAPI SetupComm( HANDLE32 hFile, DWORD insize, DWORD outsize) +{ + dprintf_comm(stdnimp, "SetupComm: insize %ld outsize %ld unimplemented stub\n", insize, outsize); + return FALSE; +} + /***************************************************************************** * GetCommMask (KERNEL32.156) */ @@ -1599,7 +1651,7 @@ INT16 WINAPI UngetCommChar(INT16 fd,CHAR chUnget) */ INT16 WINAPI ReadComm(INT16 fd,LPSTR lpvBuf,INT16 cbRead) { - int status, length; + int status, x, length; struct DosDeviceStruct *ptr; dprintf_comm(stddeb, @@ -1634,6 +1686,9 @@ INT16 WINAPI ReadComm(INT16 fd,LPSTR lpvBuf,INT16 cbRead) return length; } } else { + for (x=0; x < length+status; x++) + dprintf_comm(stddeb,"%c",*(lpvBuf+x)); + dprintf_comm(stddeb,"\nthus endeth\n"); commerror = 0; return length + status; } @@ -1661,7 +1716,7 @@ INT16 WINAPI WriteComm(INT16 fd, LPSTR lpvBuf, INT16 cbWrite) for (x=0; x != cbWrite ; x++) dprintf_comm(stddeb,"%c", *(lpvBuf + x) ); - + dprintf_comm(stddeb,"\n"); length = write(fd, (void *) lpvBuf, cbWrite); if (length == -1) { diff --git a/misc/commdlg.c b/misc/commdlg.c index 34f91a79dbf..f21978e3e78 100644 --- a/misc/commdlg.c +++ b/misc/commdlg.c @@ -58,7 +58,7 @@ static BOOL32 FileDlg_Init() */ BOOL16 WINAPI GetOpenFileName16( SEGPTR ofn ) { - HINSTANCE16 hInst; + HINSTANCE32 hInst; HANDLE32 hDlgTmpl = 0, hResInfo; BOOL32 bRet = FALSE, win32Format = FALSE; HWND32 hwndDialog; @@ -148,7 +148,7 @@ BOOL16 WINAPI GetOpenFileName16( SEGPTR ofn ) */ BOOL16 WINAPI GetSaveFileName16( SEGPTR ofn) { - HINSTANCE16 hInst; + HINSTANCE32 hInst; HANDLE32 hDlgTmpl = 0; BOOL32 bRet = FALSE, win32Format = FALSE; LPOPENFILENAME16 lpofn = (LPOPENFILENAME16)PTR_SEG_TO_LIN(ofn); @@ -3028,7 +3028,8 @@ BOOL32 WINAPI xxx##32A( LPOPENFILENAME32A ofn ) \ memset(ofn16,'\0',sizeof(*ofn16)); \ ofn16->lStructSize = sizeof(*ofn16); \ ofn16->hwndOwner = ofn->hwndOwner; \ - ofn16->hInstance = ofn->hInstance; \ + /* FIXME: OPENFILENAME16 got only 16 bit for HINSTANCE... */ \ + ofn16->hInstance = MODULE_HANDLEtoHMODULE16(ofn->hInstance); \ if (ofn->lpstrFilter) { \ LPSTR s,x; \ \ @@ -3107,7 +3108,8 @@ BOOL32 WINAPI xxx##32W( LPOPENFILENAME32W ofn ) \ memset(ofn16,'\0',sizeof(*ofn16)); \ ofn16->lStructSize = sizeof(*ofn16); \ ofn16->hwndOwner = ofn->hwndOwner; \ - ofn16->hInstance = ofn->hInstance; \ + /* FIXME: OPENFILENAME16 got only 16 bit for HINSTANCE... */ \ + ofn16->hInstance = MODULE_HANDLEtoHMODULE16(ofn->hInstance); \ if (ofn->lpstrFilter) { \ LPWSTR s; \ LPSTR x,y; \ @@ -3119,7 +3121,7 @@ BOOL32 WINAPI xxx##32W( LPOPENFILENAME32W ofn ) \ s = s+lstrlen32W(s)+1; \ s++; \ n = s - ofn->lpstrFilter; /* already divides by 2. ptr magic */\ - x = y = (LPSTR)SEGPTR_ALLOC(n); \ + x = y = (LPSTR)SEGPTR_ALLOC(n); \ s = (LPWSTR)ofn->lpstrFilter; \ while (*s) { \ lstrcpyWtoA(x,s); \ diff --git a/misc/compobj.c b/misc/compobj.c index 6fa4010f8cd..40c9444e00d 100644 --- a/misc/compobj.c +++ b/misc/compobj.c @@ -71,6 +71,14 @@ OLESTATUS WINAPI CoDisconnectObject( LPUNKNOWN lpUnk, DWORD reserved ) return OLE_OK; } +/*********************************************************************** + * IsEqualGUID [COMPOBJ.18] + */ +BOOL16 WINAPI IsEqualGUID(GUID* g1, GUID* g2) +{ + return !memcmp( g1, g2, sizeof(GUID) ); +} + /*********************************************************************** * CLSIDFromString [COMPOBJ.20] */ diff --git a/misc/crtdll.c b/misc/crtdll.c index 707e47936f4..7ba7d07a757 100644 --- a/misc/crtdll.c +++ b/misc/crtdll.c @@ -5,8 +5,21 @@ * * Copyright 1996 Marcus Meissner * Copyright 1996 Jukka Iivonen + * Copyright 1997 Uwe Bonnes */ +/* +Unresolved issues Uwe Bonnes 970904: +- Handling of Binary/Text Files is crude. If in doubt, use fromdos or recode +- Arguments in crtdll.spec for functions with double argument +- system-call calls another wine process, but without debugging arguments + and uses the first wine executable in the path +- tested with ftp://ftp.remcomp.com/pub/remcomp/lcc-win32.zip, a C-Compiler + for Win32, based on lcc, from Jacob Navia +*/ + +/* FIXME: all the file handling is hopelessly broken -- AJ */ + #include #include #include @@ -15,6 +28,7 @@ #include #include #include +#include #include "win.h" #include "windows.h" #include "stddebug.h" @@ -24,6 +38,11 @@ #include "heap.h" #include "crtdll.h" #include "drive.h" +#include "file.h" + +extern int FILE_GetUnixHandle( HFILE32 ); + +static DOS_FULL_NAME CRTDLL_tmpname; extern INT32 WIN32_wsprintf32W( DWORD *args ); @@ -49,18 +68,20 @@ static new_handler_type new_handler; /********************************************************************* * _GetMainArgs (CRTDLL.022) */ -DWORD -CRTDLL__GetMainArgs(LPDWORD argc,LPSTR **argv,LPSTR *environ,DWORD flag) +DWORD __cdecl CRTDLL__GetMainArgs(LPDWORD argc,LPSTR **argv, + LPSTR *environ,DWORD flag) { char *cmdline; char **xargv; int xargc,i,afterlastspace; DWORD version; - dprintf_crtdll(stderr,"__GetMainArgs(%p,%p,%p,%ld).\n", + dprintf_crtdll(stddeb,"CRTDLL__GetMainArgs(%p,%p,%p,%ld).\n", argc,argv,environ,flag ); CRTDLL_acmdln_dll = cmdline = xstrdup( GetCommandLine32A() ); + dprintf_crtdll(stddeb,"CRTDLL__GetMainArgs got \"%s\"\n", + cmdline); version = GetVersion32(); CRTDLL_osver_dll = version >> 16; @@ -98,6 +119,8 @@ CRTDLL__GetMainArgs(LPDWORD argc,LPSTR **argv,LPSTR *environ,DWORD flag) CRTDLL_argv_dll = xargv; *argv = xargv; + dprintf_crtdll(stddeb,"CRTDLL__GetMainArgs found %d arguments\n", + CRTDLL_argc_dll); /* FIXME ... use real environment */ *environ = xmalloc(sizeof(LPSTR)); CRTDLL_environ_dll = *environ; @@ -105,12 +128,13 @@ CRTDLL__GetMainArgs(LPDWORD argc,LPSTR **argv,LPSTR *environ,DWORD flag) return 0; } + typedef void (*_INITTERMFUN)(); /********************************************************************* * _initterm (CRTDLL.135) */ -DWORD CRTDLL__initterm(_INITTERMFUN *start,_INITTERMFUN *end) +DWORD __cdecl CRTDLL__initterm(_INITTERMFUN *start,_INITTERMFUN *end) { _INITTERMFUN *current; @@ -123,10 +147,209 @@ DWORD CRTDLL__initterm(_INITTERMFUN *start,_INITTERMFUN *end) return 0; } +/********************************************************************* + * _fdopen (CRTDLL.91) + */ +DWORD __cdecl CRTDLL__fdopen(INT32 handle, LPCSTR mode) +{ + FILE *file; + + switch (handle) + { + case 0 : file=stdin; + break; + case 1 : file=stdout; + break; + case 2 : file=stderr; + break; + default: + file=fdopen(handle,mode); + } + dprintf_crtdll(stddeb, + "CRTDLL_fdopen open handle %d mode %s got file %p\n", + handle, mode, file); + return (DWORD)file; +} + +/********************************************************************* + * fopen (CRTDLL.372) + */ +DWORD __cdecl CRTDLL_fopen(LPCSTR path, LPCSTR mode) +{ + FILE *file; + HFILE32 dos_fildes; +#if 0 + DOS_FULL_NAME full_name; + + if (!DOSFS_GetFullName( path, FALSE, &full_name )) { + dprintf_crtdll(stddeb,"CRTDLL_fopen file %s bad name\n",path); + return 0; + } + + file=fopen(full_name.long_name ,mode); +#endif + INT32 flagmode=0; + int unix_fildes=0; + + if ((strchr(mode,'r')&&strchr(mode,'a'))|| + (strchr(mode,'r')&&strchr(mode,'w'))|| + (strchr(mode,'w')&&strchr(mode,'a'))) + return 0; + + if (strstr(mode,"r+")) flagmode=O_RDWR; + else if (strchr(mode,'r')) flagmode = O_RDONLY; + else if (strstr(mode,"w+")) flagmode= O_RDWR | O_TRUNC | O_CREAT; + else if (strchr(mode,'w')) flagmode = O_WRONLY | O_TRUNC | O_CREAT; + else if (strstr(mode,"a+")) flagmode= O_RDWR | O_CREAT | O_APPEND; + else if (strchr(mode,'w')) flagmode = O_RDWR | O_CREAT | O_APPEND; + else if (strchr(mode,'b')) + dprintf_crtdll(stderr, + "CRTDLL_fopen %s in BINARY mode\n",path); + + dos_fildes=FILE_Open(path, flagmode); + unix_fildes=FILE_GetUnixHandle(dos_fildes); + file = fdopen(unix_fildes,mode); + + dprintf_crtdll(stddeb, + "CRTDLL_fopen file %s mode %s got ufh %d dfh %d file %p\n", + path,mode,unix_fildes,dos_fildes,file); + return (DWORD)file; +} + +/********************************************************************* + * fread (CRTDLL.377) + */ +DWORD __cdecl CRTDLL_fread(LPVOID ptr, INT32 size, INT32 nmemb, LPVOID file) +{ + size_t ret=1; +#if 0 + int i=0; + void *temp=ptr; + + /* If we would honour CR/LF <-> LF translation, we could do it like this. + We should keep track of all files opened, and probably files with \ + known binary extensions must be unchanged */ + while ( (i < (nmemb*size)) && (ret==1)) { + ret=fread(temp,1,1,file); + dprintf_crtdll(stddeb, + "CRTDLL_fread got %c 0x%02x ret %d\n", + (isalpha(*(unsigned char*)temp))? *(unsigned char*)temp: + ' ',*(unsigned char*)temp, ret); + if (*(unsigned char*)temp != 0xd) { /* skip CR */ + temp++; + i++; + } + else + dprintf_crtdll(stddeb, "CRTDLL_fread skipping ^M\n"); + } + dprintf_crtdll(stddeb, + "CRTDLL_fread 0x%08x items of size %d from file %p to %p%s\n", + nmemb,size,file,ptr,(i!=nmemb)?" failed":""); + return i; +#else + + ret=fread(ptr,size,nmemb,file); + dprintf_crtdll(stddeb, + "CRTDLL_fread 0x%08x items of size %d from file %p to %p%s\n", + nmemb,size,file,ptr,(ret!=nmemb)?" failed":""); + return ret; +#endif +} + +/********************************************************************* + * fseek (CRTDLL.382) + */ +LONG __cdecl CRTDLL_fseek(LPVOID stream, LONG offset, INT32 whence) +{ + long ret; + + ret=fseek(stream,offset,whence); + dprintf_crtdll(stddeb, + "CRTDLL_fseek file %p to 0x%08lx pos %s%s\n", + stream,offset,(whence==SEEK_SET)?"SEEK_SET": + (whence==SEEK_CUR)?"SEEK_CUR": + (whence==SEEK_END)?"SEEK_END":"UNKNOWN", + (ret)?"failed":""); + return ret; +} + +/********************************************************************* + * ftell (CRTDLL.384) + */ +LONG __cdecl CRTDLL_ftell(LPVOID stream) +{ + long ret; + + ret=ftell(stream); + dprintf_crtdll(stddeb, + "CRTDLL_ftell file %p at 0x%08lx\n", + stream,ret); + return ret; +} + +/********************************************************************* + * fwrite (CRTDLL.386) + */ +DWORD __cdecl CRTDLL_fwrite(LPVOID ptr, INT32 size, INT32 nmemb, LPVOID file) +{ + size_t ret; + + ret=fwrite(ptr,size,nmemb,file); + dprintf_crtdll(stddeb, + "CRTDLL_fwrite 0x%08x items of size %d from %p to file %p%s\n", + nmemb,size,ptr,file,(ret!=nmemb)?" failed":""); + return ret; +} + +/********************************************************************* + * setbuf (CRTDLL.452) + */ +INT32 __cdecl CRTDLL_setbuf(LPVOID file, LPSTR buf) +{ + dprintf_crtdll(stddeb, + "CRTDLL_setbuf(file %p buf %p)\n", + file,buf); + /* this doesn't work:"void value not ignored as it ought to be" + return setbuf(file,buf); + */ + setbuf(file,buf); + return 0; +} + +/********************************************************************* + * _open_osfhandle (CRTDLL.240) + */ +HFILE32 __cdecl CRTDLL__open_osfhandle(LONG osfhandle, INT32 flags) +{ +HFILE32 handle; + + switch (osfhandle) { + case STD_INPUT_HANDLE : + case 0 : + handle=0; + break; + case STD_OUTPUT_HANDLE: + case 1: + handle=1; + break; + case STD_ERROR_HANDLE: + case 2: + handle=2; + break; + default: + return (-1); + } + dprintf_crtdll(stddeb, + "CRTDLL_open_osfhandle(handle %08lx,flags %d) return %d\n", + osfhandle,flags,handle); + return handle; + +} + /********************************************************************* * srand (CRTDLL.460) */ -void CRTDLL_srand(DWORD seed) +void __cdecl CRTDLL_srand(DWORD seed) { /* FIXME: should of course be thread? process? local */ srand(seed); @@ -135,35 +358,29 @@ void CRTDLL_srand(DWORD seed) /********************************************************************* * fprintf (CRTDLL.373) */ -int CRTDLL_fprintf(DWORD *args) +INT32 __cdecl CRTDLL_fprintf( FILE *file, LPSTR format, ... ) { - /* FIXME: use args[0] */ - /* CMF - This makes a BIG assumption about va_list */ - return vfprintf(stderr, (LPSTR) args[1], (va_list) &args[2]); + va_list valist; + INT32 res; + + va_start( valist, format ); + res = vfprintf( file, format, valist ); + va_end( valist ); + return res; } /********************************************************************* - * printf (CRTDLL.440) + * vfprintf (CRTDLL.373) */ -int CRTDLL_printf(DWORD *args) +INT32 __cdecl CRTDLL_vfprintf( FILE *file, LPSTR format, va_list args ) { - /* CMF - This makes a BIG assumption about va_list */ - return vfprintf(stdout, (LPSTR) args[0], (va_list) &args[1]); -} - -/********************************************************************* - * sprintf (CRTDLL.458) - */ -int CRTDLL_sprintf(DWORD *args) -{ - /* CMF - This makes a BIG assumption about va_list */ - return vsprintf((LPSTR) args[0], (LPSTR) args[1], (va_list) &args[2]); + return vfprintf( file, format, args ); } /********************************************************************* * time (CRTDLL.488) */ -time_t CRTDLL_time(time_t *timeptr) +time_t __cdecl CRTDLL_time(time_t *timeptr) { time_t curtime = time(NULL); @@ -175,7 +392,7 @@ time_t CRTDLL_time(time_t *timeptr) /********************************************************************* * _isatty (CRTDLL.137) */ -BOOL32 CRTDLL__isatty(DWORD x) +BOOL32 __cdecl CRTDLL__isatty(DWORD x) { dprintf_crtdll(stderr,"CRTDLL__isatty(%ld)\n",x); return TRUE; @@ -184,22 +401,45 @@ BOOL32 CRTDLL__isatty(DWORD x) /********************************************************************* * _write (CRTDLL.332) */ -INT32 CRTDLL__write(DWORD x,LPVOID buf,DWORD len) +INT32 __cdecl CRTDLL__write(INT32 fd,LPCVOID buf,UINT32 count) { - if (x<=2) - return write(x,buf,len); - /* hmm ... */ - dprintf_crtdll(stderr,"CRTDLL__write(%ld,%p,%ld)\n",x,buf,len); + INT32 len=0; + + if (fd == -1) + len = -1; + else if (fd<=2) + len = (UINT32)write(fd,buf,(LONG)len); + else + len = _lwrite32(fd,buf,count); + dprintf_crtdll(stddeb,"CRTDLL_write %d/%d byte to dfh %d from %p,\n", + len,count,fd,buf); return len; } +/********************************************************************* + * _cexit (CRTDLL.49) + * + * FIXME: What the heck is the difference between + * FIXME _c_exit (CRTDLL.47) + * FIXME _cexit (CRTDLL.49) + * FIXME _exit (CRTDLL.87) + * FIXME exit (CRTDLL.359) + * + */ +void __cdecl CRTDLL__cexit(INT32 ret) +{ + dprintf_crtdll(stddeb,"CRTDLL__cexit(%d)\n",ret); + ExitProcess(ret); +} + + /********************************************************************* * exit (CRTDLL.359) */ -void CRTDLL_exit(DWORD ret) +void __cdecl CRTDLL_exit(DWORD ret) { - dprintf_crtdll(stderr,"CRTDLL_exit(%ld)\n",ret); + dprintf_crtdll(stddeb,"CRTDLL_exit(%ld)\n",ret); ExitProcess(ret); } @@ -207,16 +447,20 @@ void CRTDLL_exit(DWORD ret) /********************************************************************* * fflush (CRTDLL.365) */ -void CRTDLL_fflush(DWORD x) +INT32 __cdecl CRTDLL_fflush(LPVOID stream) { - dprintf_crtdll(stderr,"CRTDLL_fflush(%ld)\n",x); + int ret; + + ret = fflush(stream); + dprintf_crtdll(stddeb,"CRTDLL_fflush %p returnd %d %s\n",stream,ret,(ret)?"":" failed"); + return ret; } /********************************************************************* * gets (CRTDLL.391) */ -LPSTR CRTDLL_gets(LPSTR buf) +LPSTR __cdecl CRTDLL_gets(LPSTR buf) { /* BAD, for the whole WINE process blocks... just done this way to test * windows95's ftp.exe. @@ -225,336 +469,132 @@ LPSTR CRTDLL_gets(LPSTR buf) } -/********************************************************************* - * abs (CRTDLL.339) - */ -INT32 CRTDLL_abs(INT32 x) -{ - return abs(x); -} - - -/********************************************************************* - * acos (CRTDLL.340) - */ -float CRTDLL_acos(float x) -{ - return acos(x); -} - - -/********************************************************************* - * asin (CRTDLL.342) - */ -float CRTDLL_asin(float x) -{ - return asin(x); -} - - -/********************************************************************* - * atan (CRTDLL.343) - */ -float CRTDLL_atan(float x) -{ - return atan(x); -} - - -/********************************************************************* - * atan2 (CRTDLL.344) - */ -float CRTDLL_atan2(float x, float y) -{ - return atan2(x,y); -} - - -/********************************************************************* - * atof (CRTDLL.346) - */ -float CRTDLL_atof(LPCSTR x) -{ - return atof(x); -} - - -/********************************************************************* - * atoi (CRTDLL.347) - */ -INT32 CRTDLL_atoi(LPCSTR x) -{ - if (!x) return 0; - return atoi(x); -} - - -/********************************************************************* - * atol (CRTDLL.348) - */ -LONG CRTDLL_atol(LPCSTR x) -{ - if (!x) return 0; - return atol(x); -} - - -/********************************************************************* - * cos (CRTDLL.354) - */ -float CRTDLL_cos(float x) -{ - return cos(x); -} - - -/********************************************************************* - * cosh (CRTDLL.355) - */ -float CRTDLL_cosh(float x) -{ - return cosh(x); -} - - -/********************************************************************* - * exp (CRTDLL.360) - */ -float CRTDLL_exp(float x) -{ - return exp(x); -} - - -/********************************************************************* - * fabs (CRTDLL.361) - */ -float CRTDLL_fabs(float x) -{ - return fabs(x); -} - - -/********************************************************************* - * isalnum (CRTDLL.394) - */ -CHAR CRTDLL_isalnum(CHAR x) -{ - return isalnum(x); -} - - -/********************************************************************* - * isalpha (CRTDLL.395) - */ -CHAR CRTDLL_isalpha(CHAR x) -{ - return isalpha(x); -} - - -/********************************************************************* - * iscntrl (CRTDLL.396) - */ -CHAR CRTDLL_iscntrl(CHAR x) -{ - return iscntrl(x); -} - - -/********************************************************************* - * isdigit (CRTDLL.397) - */ -CHAR CRTDLL_isdigit(CHAR x) -{ - return isdigit(x); -} - - -/********************************************************************* - * isgraph (CRTDLL.398) - */ -CHAR CRTDLL_isgraph(CHAR x) -{ - return isgraph(x); -} - - -/********************************************************************* - * islower (CRTDLL.400) - */ -CHAR CRTDLL_islower(CHAR x) -{ - return islower(x); -} - - -/********************************************************************* - * isprint (CRTDLL.401) - */ -CHAR CRTDLL_isprint(CHAR x) -{ - return isprint(x); -} - - -/********************************************************************* - * ispunct (CRTDLL.402) - */ -CHAR CRTDLL_ispunct(CHAR x) -{ - return ispunct(x); -} - - -/********************************************************************* - * isspace (CRTDLL.403) - */ -CHAR CRTDLL_isspace(CHAR x) -{ - return isspace(x); -} - - -/********************************************************************* - * isupper (CRTDLL.404) - */ -CHAR CRTDLL_isupper(CHAR x) -{ - return isupper(x); -} - - -/********************************************************************* - * isxdigit (CRTDLL.418) - */ -CHAR CRTDLL_isxdigit(CHAR x) -{ - return isxdigit(x); -} - - -/********************************************************************* - * labs (CRTDLL.419) - */ -LONG CRTDLL_labs(LONG x) -{ - return labs(x); -} - - -/********************************************************************* - * log (CRTDLL.424) - */ -float CRTDLL_log(float x) -{ - return log(x); -} - - -/********************************************************************* - * log10 (CRTDLL.425) - */ -float CRTDLL_log10(float x) -{ - return log10(x); -} - - -/********************************************************************* - * pow (CRTDLL.439) - */ -float CRTDLL_pow(float x, float y) -{ - return pow(x,y); -} - - /********************************************************************* * rand (CRTDLL.446) */ -INT32 CRTDLL_rand() +INT32 __cdecl CRTDLL_rand() { return rand(); } -/********************************************************************* - * sin (CRTDLL.456) - */ -float CRTDLL_sin(float x) -{ - return sin(x); -} - - -/********************************************************************* - * sinh (CRTDLL.457) - */ -float CRTDLL_sinh(float x) -{ - return sinh(x); -} - - -/********************************************************************* - * sqrt (CRTDLL.459) - */ -double CRTDLL_sqrt(double x) -{ - return sqrt(x); -} - - -/********************************************************************* - * tan (CRTDLL.486) - */ -float CRTDLL_tan(float x) -{ - return tan(x); -} - - -/********************************************************************* - * tanh (CRTDLL.487) - */ -float CRTDLL_tanh(float x) -{ - return tanh(x); -} - - -/********************************************************************* - * tolower (CRTDLL.491) - */ -CHAR CRTDLL_tolower(CHAR x) -{ - return tolower(x); -} - - -/********************************************************************* - * toupper (CRTDLL.492) - */ -CHAR CRTDLL_toupper(CHAR x) -{ - return toupper(x); -} - - /********************************************************************* * putchar (CRTDLL.442) */ -void CRTDLL_putchar(INT32 x) +void __cdecl CRTDLL_putchar( INT32 x ) { putchar(x); } +/********************************************************************* + * fputc (CRTDLL.374) + */ +INT32 __cdecl CRTDLL_fputc( INT32 c, FILE *stream ) +{ + dprintf_crtdll(stddeb, + "CRTDLL_fputc %c to file %p\n",c,stream); + return fputc(c,stream); +} + + +/********************************************************************* + * fputs (CRTDLL.375) + */ +INT32 __cdecl CRTDLL_fputs( LPCSTR s, FILE *stream ) +{ + dprintf_crtdll(stddeb, + "CRTDLL_fputs %s to file %p\n",s,stream); + return fputs(s,stream); +} + + +/********************************************************************* + * puts (CRTDLL.443) + */ +INT32 __cdecl CRTDLL_puts(LPCSTR s) +{ + dprintf_crtdll(stddeb, + "CRTDLL_fputs %s \n",s); + return puts(s); +} + + +/********************************************************************* + * putc (CRTDLL.441) + */ +INT32 __cdecl CRTDLL_putc(INT32 c, FILE *stream) +{ + dprintf_crtdll(stddeb, + "CRTDLL_putc %c to file %p\n",c,stream); + return fputc(c,stream); +} +/********************************************************************* + * fgetc (CRTDLL.366) + */ +INT32 __cdecl CRTDLL_fgetc( FILE *stream ) +{ + int ret= fgetc(stream); + dprintf_crtdll(stddeb, + "CRTDLL_fgetc got %d\n",ret); + return ret; +} + + +/********************************************************************* + * getc (CRTDLL.388) + */ +INT32 __cdecl CRTDLL_getc( FILE *stream ) +{ + int ret= fgetc(stream); + dprintf_crtdll(stddeb, + "CRTDLL_getc got %d\n",ret); + return ret; +} + +/********************************************************************* + * _lrotl (CRTDLL.176) + */ +DWORD __cdecl CRTDLL__lrotl(DWORD x,INT32 shift) +{ + unsigned long ret = (x >> shift)|( x >>((sizeof(x))-shift)); + + dprintf_crtdll(stddeb, + "CRTDLL_lrotl got 0x%08lx rot %d ret 0x%08lx\n", + x,shift,ret); + return ret; + +} + + +/********************************************************************* + * fgets (CRTDLL.368) + */ +CHAR* __cdecl CRTDLL_fgets(LPSTR s,INT32 size, LPVOID stream) +{ + char * ret; + char * control_M; + + ret=fgets(s, size,stream); + /*FIXME: Control with CRTDLL_setmode */ + control_M= strrchr(s,'\r'); + /*delete CR if we read a DOS File */ + if (control_M) + { + *control_M='\n'; + *(control_M+1)=0; + } + dprintf_crtdll(stddeb, + "CRTDLL_fgets got %s for %d chars from file %p%s\n", + s,size,stream,(ret)?"":" failed"); + return ret; +} + + /********************************************************************* * _mbsicmp (CRTDLL.204) */ -int CRTDLL__mbsicmp(unsigned char *x,unsigned char *y) +int __cdecl CRTDLL__mbsicmp(unsigned char *x,unsigned char *y) { do { if (!*x) @@ -573,7 +613,7 @@ int CRTDLL__mbsicmp(unsigned char *x,unsigned char *y) /********************************************************************* * _mbsinc (CRTDLL.205) */ -unsigned char* CRTDLL__mbsinc(unsigned char *x) +unsigned char * __cdecl CRTDLL__mbsinc(unsigned char *x) { /* FIXME: mbcs */ return x++; @@ -583,27 +623,25 @@ unsigned char* CRTDLL__mbsinc(unsigned char *x) /********************************************************************* * vsprintf (CRTDLL.500) */ -int CRTDLL_vsprintf(DWORD *args) +INT32 __cdecl CRTDLL_vsprintf( LPSTR buffer, LPCSTR spec, va_list args ) { - /* CMF - This makes a BIG assumption about va_list */ - return vsprintf((char *) args[0], (char *) args[1], (va_list) &args[2]); + return wvsprintf32A( buffer, spec, args ); } /********************************************************************* - * vsprintf (CRTDLL.500) (NTDLL.913) + * vswprintf (CRTDLL.501) */ -int CRTDLL_sscanf(DWORD *args) +INT32 __cdecl CRTDLL_vswprintf( LPWSTR buffer, LPCWSTR spec, va_list args ) { - /* CMF - This makes a BIG assumption about va_list */ - return vsscanf((char *) args[0], (char *) args[1], (va_list) &args[2]); + return wvsprintf32W( buffer, spec, args ); } - /********************************************************************* * _mbscpy (CRTDLL.200) */ -unsigned char* CRTDLL__mbscpy(unsigned char *x,unsigned char *y) +unsigned char* __cdecl CRTDLL__mbscpy(unsigned char *x,unsigned char *y) { + dprintf_crtdll(stddeb,"CRTDLL_mbscpy %s and %s\n",x,y); return strcpy(x,y); } @@ -611,15 +649,96 @@ unsigned char* CRTDLL__mbscpy(unsigned char *x,unsigned char *y) /********************************************************************* * _mbscat (CRTDLL.197) */ -unsigned char* CRTDLL__mbscat(unsigned char *x,unsigned char *y) +unsigned char* __cdecl CRTDLL__mbscat(unsigned char *x,unsigned char *y) { return strcat(x,y); } + +/********************************************************************* + * _strcmpi (CRTDLL.282) (CRTDLL.287) + */ +INT32 __cdecl CRTDLL__strcmpi( LPCSTR s1, LPCSTR s2 ) +{ + return lstrcmpi32A( s1, s2 ); +} + + +/********************************************************************* + * _strnicmp (CRTDLL.293) + */ +INT32 __cdecl CRTDLL__strnicmp( LPCSTR s1, LPCSTR s2, INT32 n ) +{ + return lstrncmpi32A( s1, s2, n ); +} + + +/********************************************************************* + * _strlwr (CRTDLL.293) + * + * convert a string in place to lowercase + */ +LPSTR CRTDLL__strlwr(LPSTR x) +{ + unsigned char *y =x; + + dprintf_crtdll(stddeb, + "CRTDLL_strlwr got %s",x); + while (*y) { + if ((*y > 0x40) && (*y< 0x5b)) + *y = *y + 0x20; + y++; + } + dprintf_crtdll(stddeb," returned %s\n",x); + + return x; +} + +/********************************************************************* + * system (CRTDLL.485) + */ +INT32 CRTDLL_system(LPSTR x) +{ +#define SYSBUF_LENGTH 1500 + char buffer[SYSBUF_LENGTH]="wine \""; + unsigned char *y =x; + unsigned char *bp =buffer+strlen(buffer); + int i =strlen(buffer) + strlen(x) +2; + + /* Calculate needed buffer size tp prevent overflow*/ + while (*y) { + if (*y =='\\') i++; + y++; + } + /* if buffer to short, exit */ + if (i > SYSBUF_LENGTH) { + dprintf_crtdll(stddeb,"_system buffer to small\n"); + return 127; + } + + y =x; + + while (*y) { + *bp = *y; + bp++; y++; + if (*(y-1) =='\\') *bp++ = '\\'; + } + /* remove spaces from end of string */ + while (*(y-1) == ' ') { + bp--;y--; + } + *bp++ = '"'; + *bp = 0; + dprintf_crtdll(stddeb, + "_system got \"%s\", executing \"%s\"\n",x,buffer); + + return system(buffer); +} + /********************************************************************* * _strupr (CRTDLL.300) */ -LPSTR CRTDLL__strupr(LPSTR x) +LPSTR __cdecl CRTDLL__strupr(LPSTR x) { LPSTR y=x; @@ -633,7 +752,7 @@ LPSTR CRTDLL__strupr(LPSTR x) /********************************************************************* * _wcsupr (CRTDLL.328) */ -LPWSTR CRTDLL__wcsupr(LPWSTR x) +LPWSTR __cdecl CRTDLL__wcsupr(LPWSTR x) { LPWSTR y=x; @@ -647,7 +766,7 @@ LPWSTR CRTDLL__wcsupr(LPWSTR x) /********************************************************************* * _wcslwr (CRTDLL.323) */ -LPWSTR CRTDLL__wcslwr(LPWSTR x) +LPWSTR __cdecl CRTDLL__wcslwr(LPWSTR x) { LPWSTR y=x; @@ -662,7 +781,7 @@ LPWSTR CRTDLL__wcslwr(LPWSTR x) /********************************************************************* * malloc (CRTDLL.427) */ -VOID* CRTDLL_malloc(DWORD size) +VOID* __cdecl CRTDLL_malloc(DWORD size) { return HeapAlloc(GetProcessHeap(),0,size); } @@ -670,7 +789,7 @@ VOID* CRTDLL_malloc(DWORD size) /********************************************************************* * new (CRTDLL.001) */ -VOID* CRTDLL_new(DWORD size) +VOID* __cdecl CRTDLL_new(DWORD size) { VOID* result; if(!(result = HeapAlloc(GetProcessHeap(),0,size)) && new_handler) @@ -681,7 +800,7 @@ VOID* CRTDLL_new(DWORD size) /********************************************************************* * set_new_handler(CRTDLL.003) */ -new_handler_type CRTDLL_set_new_handler(new_handler_type func) +new_handler_type __cdecl CRTDLL_set_new_handler(new_handler_type func) { new_handler_type old_handler = new_handler; new_handler = func; @@ -691,7 +810,7 @@ new_handler_type CRTDLL_set_new_handler(new_handler_type func) /********************************************************************* * calloc (CRTDLL.350) */ -VOID* CRTDLL_calloc(DWORD size, DWORD count) +VOID* __cdecl CRTDLL_calloc(DWORD size, DWORD count) { return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size * count ); } @@ -699,7 +818,7 @@ VOID* CRTDLL_calloc(DWORD size, DWORD count) /********************************************************************* * realloc (CRTDLL.447) */ -VOID* CRTDLL_realloc( VOID *ptr, DWORD size ) +VOID* __cdecl CRTDLL_realloc( VOID *ptr, DWORD size ) { return HeapReAlloc( GetProcessHeap(), 0, ptr, size ); } @@ -707,7 +826,7 @@ VOID* CRTDLL_realloc( VOID *ptr, DWORD size ) /********************************************************************* * free (CRTDLL.427) */ -VOID CRTDLL_free(LPVOID ptr) +VOID __cdecl CRTDLL_free(LPVOID ptr) { HeapFree(GetProcessHeap(),0,ptr); } @@ -715,7 +834,7 @@ VOID CRTDLL_free(LPVOID ptr) /********************************************************************* * delete (CRTDLL.002) */ -VOID CRTDLL_delete(VOID* ptr) +VOID __cdecl CRTDLL_delete(VOID* ptr) { HeapFree(GetProcessHeap(),0,ptr); } @@ -723,24 +842,108 @@ VOID CRTDLL_delete(VOID* ptr) /********************************************************************* * _strdup (CRTDLL.285) */ -LPSTR CRTDLL__strdup(LPSTR ptr) +LPSTR __cdecl CRTDLL__strdup(LPSTR ptr) { return HEAP_strdupA(GetProcessHeap(),0,ptr); } + /********************************************************************* * fclose (CRTDLL.362) */ -DWORD CRTDLL_fclose(LPVOID x) +INT32 __cdecl CRTDLL_fclose( FILE *stream ) { - dprintf_crtdll(stdnimp,"fclose(%p)\n",x); - return 0; + int unix_handle=fileno(stream); + HFILE32 dos_handle=3; + HFILE32 ret=EOF; + + if (unix_handle<4) ret= fclose(stream); + else { + while(FILE_GetUnixHandle(dos_handle) != unix_handle) dos_handle++; + fclose(stream); + ret = _lclose32( dos_handle); + } + dprintf_crtdll(stddeb,"CRTDLL_fclose(%p) ufh %d dfh %d%s\n", + stream,unix_handle,dos_handle,(ret)?" failed":""); + return ret; +} + +/********************************************************************* + * _unlink (CRTDLL.315) + */ +INT32 __cdecl CRTDLL__unlink(LPCSTR pathname) +{ + int ret=0; + DOS_FULL_NAME full_name; + + if (!DOSFS_GetFullName( pathname, FALSE, &full_name )) { + dprintf_crtdll(stddeb,"CRTDLL_unlink file %s bad name\n",pathname); + return EOF; + } + + ret=unlink(full_name.long_name); + dprintf_crtdll(stddeb,"CRTDLL_unlink(%s unix %s)%s\n", + pathname,full_name.long_name, (ret)?" failed":""); + return ret; +} + +/********************************************************************* + * _open (CRTDLL.239) + */ +HFILE32 __cdecl CRTDLL__open(LPCSTR path,INT32 flags) +{ + HFILE32 ret=0; + int wineflags=0; + + /* FIXME: + the flags in lcc's header differ from the ones in Linux, e.g. + Linux: define O_APPEND 02000 (= 0x400) + lcc: define _O_APPEND 0x0008 + so here a scheme to translate them + Probably lcc is wrong here, but at least a hack to get is going + */ + wineflags = (flags & 3); + if (flags & 0x0008 ) wineflags |= O_APPEND; + if (flags & 0x0100 ) wineflags |= O_CREAT; + if (flags & 0x0200 ) wineflags |= O_TRUNC; + if (flags & 0x0400 ) wineflags |= O_EXCL; + if (flags & 0xf0f4 ) + dprintf_crtdll(stddeb,"CRTDLL_open file unsupported flags 0x%04x\n",flags); + /* End Fixme */ + + ret = FILE_Open(path,wineflags); + dprintf_crtdll(stddeb,"CRTDLL_open file %s mode 0x%04x (lccmode 0x%04x) got dfh %d\n", + path,wineflags,flags,ret); + return ret; +} + +/********************************************************************* + * _close (CRTDLL.57) + */ +INT32 __cdecl CRTDLL__close(HFILE32 fd) +{ + int ret=_lclose32(fd); + + dprintf_crtdll(stddeb,"CRTDLL_close(%d)%s\n",fd,(ret)?" failed":""); + return ret; +} + +/********************************************************************* + * feof (CRTDLL.363) + */ +INT32 __cdecl CRTDLL_feof( FILE *stream ) +{ + int ret; + + ret=feof(stream); + dprintf_crtdll(stddeb,"CRTDLL_feof(%p) %s\n",stream,(ret)?"true":"false"); + return ret; } /********************************************************************* * setlocale (CRTDLL.453) */ -LPSTR CRTDLL_setlocale(INT32 category,LPCSTR locale) +LPSTR __cdecl CRTDLL_setlocale(INT32 category,LPCSTR locale) { LPSTR categorystr; @@ -753,31 +956,53 @@ LPSTR CRTDLL_setlocale(INT32 category,LPCSTR locale) case CRTDLL_LC_TIME: categorystr="LC_TIME";break; default: categorystr = "UNKNOWN?";break; } - fprintf(stderr,"CRTDLL.setlocale(%s,%s),stub!\n",categorystr,locale); + fprintf(stderr,"CRTDLL_setlocale(%s,%s),stub!\n",categorystr,locale); return "C"; } /********************************************************************* - * wcsspn (CRTDLL.516) + * wcscat (CRTDLL.503) */ -INT32 CRTDLL_wcsspn(LPWSTR str,LPWSTR accept) +LPWSTR __cdecl CRTDLL_wcscat( LPWSTR s1, LPCWSTR s2 ) { - LPWSTR s,t; + return lstrcat32W( s1, s2 ); +} + +/********************************************************************* + * wcschr (CRTDLL.504) + */ +LPWSTR __cdecl CRTDLL_wcschr(LPWSTR str,WCHAR xchar) +{ + LPWSTR s; s=str; do { - t=accept; - while (*t) { if (*t==*s) break;t++;} - if (!*t) break; - s++; - } while (*s); - return s-str; /* nr of wchars */ + if (*s==xchar) + return s; + } while (*s++); + return NULL; +} + +/********************************************************************* + * wcscmp (CRTDLL.505) + */ +INT32 __cdecl CRTDLL_wcscmp( LPCWSTR s1, LPCWSTR s2 ) +{ + return lstrcmp32W( s1, s2 ); +} + +/********************************************************************* + * wcscpy (CRTDLL.507) + */ +LPWSTR __cdecl CRTDLL_wcscpy( LPWSTR s1, LPCWSTR s2 ) +{ + return lstrcpy32W( s1, s2 ); } /********************************************************************* * wcscspn (CRTDLL.508) */ -INT32 CRTDLL_wcscspn(LPWSTR str,LPWSTR reject) +INT32 __cdecl CRTDLL_wcscspn(LPWSTR str,LPWSTR reject) { LPWSTR s,t; @@ -792,49 +1017,91 @@ INT32 CRTDLL_wcscspn(LPWSTR str,LPWSTR reject) } /********************************************************************* - * wcschr (CRTDLL.504) + * wcslen (CRTDLL.510) */ -LPWSTR CRTDLL_wcschr(LPWSTR str,WCHAR xchar) +INT32 __cdecl CRTDLL_wcslen( LPCWSTR s ) { - LPWSTR s; + return lstrlen32W( s ); +} + +/********************************************************************* + * wcsncat (CRTDLL.511) + */ +LPWSTR __cdecl CRTDLL_wcsncat( LPWSTR s1, LPCWSTR s2, INT32 n ) +{ + return lstrcatn32W( s1, s2, n ); +} + +/********************************************************************* + * wcsncmp (CRTDLL.512) + */ +INT32 __cdecl CRTDLL_wcsncmp( LPCWSTR s1, LPCWSTR s2, INT32 n ) +{ + return lstrncmp32W( s1, s2, n ); +} + +/********************************************************************* + * wcsncpy (CRTDLL.513) + */ +LPWSTR __cdecl CRTDLL_wcsncpy( LPWSTR s1, LPCWSTR s2, INT32 n ) +{ + return lstrcpyn32W( s1, s2, n ); +} + +/********************************************************************* + * wcsspn (CRTDLL.516) + */ +INT32 __cdecl CRTDLL_wcsspn(LPWSTR str,LPWSTR accept) +{ + LPWSTR s,t; s=str; do { - if (*s==xchar) - return s; - } while (*s++); - return NULL; + t=accept; + while (*t) { if (*t==*s) break;t++;} + if (!*t) break; + s++; + } while (*s); + return s-str; /* nr of wchars */ } /********************************************************************* * towupper (CRTDLL.494) */ -WCHAR CRTDLL_towupper(WCHAR x) +WCHAR __cdecl CRTDLL_towupper(WCHAR x) { return (WCHAR)toupper((CHAR)x); } /********************************************************************* - * swprintf (CRTDLL.483) + * _wcsicmp (CRTDLL.321) */ -DWORD CRTDLL_swprintf(DWORD *args) +DWORD __cdecl CRTDLL__wcsicmp( LPCWSTR s1, LPCWSTR s2 ) { - return WIN32_wsprintf32W(args); + return lstrcmpi32W( s1, s2 ); } /********************************************************************* * _wcsicoll (CRTDLL.322) */ -DWORD CRTDLL__wcsicoll(LPWSTR a1,LPWSTR a2) +DWORD __cdecl CRTDLL__wcsicoll(LPCWSTR a1,LPCWSTR a2) { /* FIXME: handle collates */ return lstrcmpi32W(a1,a2); } +/********************************************************************* + * _wcsnicmp (CRTDLL.324) + */ +DWORD __cdecl CRTDLL__wcsnicmp( LPCWSTR s1, LPCWSTR s2, INT32 len ) +{ + return lstrncmpi32W( s1, s2, len ); +} + /********************************************************************* * wcscoll (CRTDLL.506) */ -DWORD CRTDLL_wcscoll(LPWSTR a1,LPWSTR a2) +DWORD __cdecl CRTDLL_wcscoll(LPWSTR a1,LPWSTR a2) { /* FIXME: handle collates */ return lstrcmp32W(a1,a2); @@ -843,7 +1110,7 @@ DWORD CRTDLL_wcscoll(LPWSTR a1,LPWSTR a2) /********************************************************************* * _wcsrev (CRTDLL.326) */ -VOID CRTDLL__wcsrev(LPWSTR s) { +VOID __cdecl CRTDLL__wcsrev(LPWSTR s) { LPWSTR e; e=s; @@ -860,7 +1127,7 @@ VOID CRTDLL__wcsrev(LPWSTR s) { /********************************************************************* * wcsstr (CRTDLL.517) */ -LPWSTR CRTDLL_wcsstr(LPWSTR s,LPWSTR b) +LPWSTR __cdecl CRTDLL_wcsstr(LPWSTR s,LPWSTR b) { LPWSTR x,y,c; @@ -877,10 +1144,19 @@ LPWSTR CRTDLL_wcsstr(LPWSTR s,LPWSTR b) return NULL; } +/********************************************************************* + * wcstombs (CRTDLL.521) + */ +INT32 __cdecl CRTDLL_wcstombs( LPSTR dst, LPCWSTR src, INT32 len ) +{ + lstrcpynWtoA( dst, src, len ); + return strlen(dst); /* FIXME: is this right? */ +} + /********************************************************************* * wcsrchr (CRTDLL.515) */ -LPWSTR CRTDLL_wcsrchr(LPWSTR str,WCHAR xchar) +LPWSTR __cdecl CRTDLL_wcsrchr(LPWSTR str,WCHAR xchar) { LPWSTR s; @@ -895,52 +1171,115 @@ LPWSTR CRTDLL_wcsrchr(LPWSTR str,WCHAR xchar) /********************************************************************* * _setmode (CRTDLL.265) - * FIXME: dunno what this is. + * FIXME: At present we ignore the request to translate CR/LF to LF. + * + * We allways translate when we read with fgets, we never do with fread + * */ -DWORD -CRTDLL__setmode(LPVOID x,INT32 y) { +INT32 __cdecl CRTDLL__setmode( INT32 fh,INT32 mode) +{ /* FIXME */ - fprintf(stdnimp,"CRTDLL._setmode(%p,%d), STUB.\n",x,y); - return 0; +#define O_TEXT 0x4000 +#define O_BINARY 0x8000 + + dprintf_crtdll(stddeb, + "CRTDLL._setmode on fhandle %d mode %s, STUB.\n", + fh,(mode=O_TEXT)?"O_TEXT": + (mode=O_BINARY)?"O_BINARY":"UNKNOWN"); + return -1; } /********************************************************************* * atexit (CRTDLL.345) */ -INT32 -CRTDLL_atexit(LPVOID x) { +INT32 __cdecl CRTDLL_atexit(LPVOID x) +{ /* FIXME */ fprintf(stdnimp,"CRTDLL.atexit(%p), STUB.\n",x); return 0; /* successful */ } +/********************************************************************* + * mblen (CRTDLL.428) + * FIXME: check multibyte support + */ +WCHAR __cdecl CRTDLL_mblen(CHAR *mb,INT32 size) +{ + + int ret=1; + + if (!mb) + ret = 0; + else if ((size<1)||(!*(mb+1))) + ret = -1; + else if (!(*mb)) + ret =0; + + dprintf_crtdll(stderr,"CRTDLL_mlen %s for max %d bytes ret %d\n",mb,size,ret); + + return ret; +} + /********************************************************************* * mbstowcs (CRTDLL.429) * FIXME: check multibyte support */ -INT32 -CRTDLL_mbstowcs(LPWSTR a,LPSTR b,INT32 nr) { - int i; - for (i=0;(i 0) && *src) { + *p++ = (WCHAR)(unsigned char)*src++; } - return i; + p++; + ret = (p -wcs); + + dprintf_crtdll(stddeb,"CRTDLL_mbstowcs %s for %d chars put %d wchars\n", + mbs,size,ret); + return ret; } /********************************************************************* * mbtowc (CRTDLL.430) * FIXME: check multibyte support */ -WCHAR -CRTDLL_mbtowc(CHAR a) { - return a; +WCHAR __cdecl CRTDLL_mbtowc(WCHAR* wc,CHAR* mb,INT32 size) +{ + int ret; + + if (!mb) + ret = 0; + else if (!wc) + ret =-1; + else + if ( (ret = mblen(mb,size)) != -1 ) + { + if (ret <= sizeof(char)) + *wc = (WCHAR) ((unsigned char)*mb); + else + ret= -1; + } + else + ret = -1; + + dprintf_crtdll(stderr,"CRTDLL_mbtowc %s for %d chars\n",mb,size); + + return ret; } /********************************************************************* * _isctype (CRTDLL.138) */ -BOOL32 -CRTDLL__isctype(CHAR x,CHAR type) { +BOOL32 __cdecl CRTDLL__isctype(CHAR x,CHAR type) +{ if ((type & CRTDLL_SPACE) && isspace(x)) return TRUE; if ((type & CRTDLL_PUNCT) && ispunct(x)) @@ -962,8 +1301,8 @@ CRTDLL__isctype(CHAR x,CHAR type) { /********************************************************************* * _chdrive (CRTDLL.52) */ -BOOL32 -CRTDLL__chdrive(INT32 newdrive) { +BOOL32 __cdecl CRTDLL__chdrive(INT32 newdrive) +{ /* FIXME: generates errnos */ return DRIVE_SetCurrentDrive(newdrive); } @@ -971,18 +1310,51 @@ CRTDLL__chdrive(INT32 newdrive) { /********************************************************************* * _chdir (CRTDLL.51) */ -INT32 -CRTDLL__chdir(LPCSTR newdir) { +INT32 __cdecl CRTDLL__chdir(LPCSTR newdir) +{ if (!SetCurrentDirectory32A(newdir)) return -1; return 0; } +/********************************************************************* + * _getcwd (CRTDLL.120) + */ +CHAR* __cdecl CRTDLL__getcwd(LPSTR buf, INT32 size) +{ + DOS_FULL_NAME full_name; + char *ret; + + dprintf_crtdll(stddeb,"CRTDLL_getcwd for buf %p size %d\n", + buf,size); + if (buf == NULL) + { + dprintf_crtdll(stderr,"CRTDLL_getcwd malloc unsupported\n"); + printf("CRTDLL_getcwd malloc unsupported\n"); + return 0; + } + ret = getcwd(buf,size); + if (!DOSFS_GetFullName( buf, FALSE, &full_name )) + { + dprintf_crtdll(stddeb,"CRTDLL_getcwd failed\n"); + return 0; + } + if (strlen(full_name.short_name)>size) + { + dprintf_crtdll(stddeb,"CRTDLL_getcwd string too long\n"); + return 0; + } + ret=strcpy(buf,full_name.short_name); + if (ret) + dprintf_crtdll(stddeb,"CRTDLL_getcwd returned:%s\n",ret); + return ret; +} + /********************************************************************* * _mkdir (CRTDLL.234) */ -INT32 -CRTDLL__mkdir(LPCSTR newdir) { +INT32 __cdecl CRTDLL__mkdir(LPCSTR newdir) +{ if (!CreateDirectory32A(newdir,NULL)) return -1; return 0; @@ -992,8 +1364,8 @@ CRTDLL__mkdir(LPCSTR newdir) { * _errno (CRTDLL.52) * Yes, this is a function. */ -LPINT32 -CRTDLL__errno() { +LPINT32 __cdecl CRTDLL__errno() +{ static int crtdllerrno; extern int LastErrorToErrno(DWORD); @@ -1001,3 +1373,83 @@ CRTDLL__errno() { crtdllerrno = LastErrorToErrno(GetLastError()); return &crtdllerrno; } + +/********************************************************************* + * _tempnam (CRTDLL.305) + * + */ +LPSTR __cdecl CRTDLL__tempnam(LPCSTR dir, LPCSTR prefix) +{ + + char *ret; + DOS_FULL_NAME tempname; + + if ((ret = tempnam(dir,prefix))==NULL) { + dprintf_crtdll(stddeb, + "CRTDLL_tempnam Unable to get unique filename\n"); + return NULL; + } + if (!DOSFS_GetFullName(ret,FALSE,&tempname)) + { + dprintf_crtdll(stddeb, + "CRTDLL_tempnam Wrong path?\n"); + return NULL; + } + free(ret); + if ((ret = CRTDLL_malloc(strlen(tempname.short_name)+1)) == NULL) { + dprintf_crtdll(stddeb, + "CRTDLL_tempnam CRTDL_malloc for shortname failed\n"); + return NULL; + } + if ((ret = strcpy(ret,tempname.short_name)) == NULL) { + dprintf_crtdll(stddeb, + "CRTDLL_tempnam Malloc for shortname failed\n"); + return NULL; + } + + dprintf_crtdll(stddeb,"CRTDLL_tempnam dir %s prefix %s got %s\n", + dir,prefix,ret); + return ret; + +} +/********************************************************************* + * tmpnam (CRTDLL.490) + * + * lcclnk from lcc-win32 relies on a terminating dot in the name returned + * + */ +LPSTR __cdecl CRTDLL_tmpnam(LPSTR s) +{ + char *ret; + + if ((ret =tmpnam(s))== NULL) { + dprintf_crtdll(stddeb, + "CRTDLL_tmpnam Unable to get unique filename\n"); + return NULL; + } + if (!DOSFS_GetFullName(ret,FALSE,&CRTDLL_tmpname)) + { + dprintf_crtdll(stddeb, + "CRTDLL_tmpnam Wrong path?\n"); + return NULL; + } + strcat(CRTDLL_tmpname.short_name,"."); + dprintf_crtdll(stddeb,"CRTDLL_tmpnam for buf %p got %s\n", + s,CRTDLL_tmpname.short_name); + dprintf_crtdll(stddeb,"CRTDLL_tmpnam long got %s\n", + CRTDLL_tmpname.long_name); + if ( s != NULL) + return strcpy(s,CRTDLL_tmpname.short_name); + else + return CRTDLL_tmpname.short_name; + +} + +/********************************************************************* + * _itoa (CRTDLL.165) + */ +LPSTR __cdecl CRTDLL__itoa(INT32 x,LPSTR buf,INT32 buflen) +{ + wsnprintf32A(buf,buflen,"%d",x); + return buf; +} diff --git a/misc/lstr.c b/misc/lstr.c index 64190c3f55d..f2fd7c63e17 100644 --- a/misc/lstr.c +++ b/misc/lstr.c @@ -137,7 +137,7 @@ void WINAPI OutputDebugString16( LPCSTR str ) for (p = buffer; *str; str++) if (*str != '\r') *p++ = *str; *p = '\0'; if ((p > buffer) && (p[-1] == '\n')) p[1] = '\0'; /* Remove trailing \n */ - module = MODULE_GetModuleName( GetExePtr(GetCurrentTask()) ); + module = MODULE_GetModuleName( GetCurrentTask() ); fprintf( stderr, "OutputDebugString: %s says '%s'\n", module ? module : "???", buffer ); HeapFree( GetProcessHeap(), 0, buffer ); @@ -475,7 +475,7 @@ BOOL32 WINAPI IsCharUpper32W(WCHAR x) } /*********************************************************************** - * FormatMessageA (KERNEL32.138) Library Version + * FormatMessage32A (KERNEL32.138) * FIXME: missing wrap,FROM_SYSTEM message-loading, */ DWORD WINAPI FormatMessage32A( @@ -577,10 +577,7 @@ DWORD WINAPI FormatMessage32A( if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY) argliststart=args+insertnr-1; else - /* FIXME: not sure that this is - * correct for unix-c-varargs. - */ - argliststart=((DWORD*)&args)+insertnr-1; + argliststart=(*(DWORD**)args)+insertnr-1; if (fmtstr[strlen(fmtstr)]=='s') sprintfbuf=HeapAlloc(GetProcessHeap(),0,strlen((LPSTR)argliststart[0])+1); @@ -643,44 +640,10 @@ DWORD WINAPI FormatMessage32A( } #undef ADD_TO_T + /*********************************************************************** - * FormatMessageA (KERNEL32.138) Emulator Version + * FormatMessage32W (KERNEL32.138) */ -DWORD WINAPI WIN32_FormatMessage32A(DWORD *args) -{ - DWORD dwFlags = args[0]; - LPCVOID lpSource = (LPCVOID)args[1]; - DWORD dwMessageId = args[2]; - DWORD dwLanguageId = args[3]; - LPSTR lpBuffer = (LPSTR)args[4]; - DWORD nSize = args[5]; - DWORD *xargs; - - /* convert possible varargs to an argument array look-a-like */ - - if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY) { - xargs=(DWORD*)args[6]; - } else { - /* args[6] is a pointer to a pointer to the start of - * a list of arguments. - */ - if (args[6]) - xargs=(DWORD*)(((DWORD*)args[6])[0]); - else - xargs=NULL; - dwFlags|=FORMAT_MESSAGE_ARGUMENT_ARRAY; - } - return FormatMessage32A( - dwFlags, - lpSource, - dwMessageId, - dwLanguageId, - lpBuffer, - nSize, - xargs - ); -} - DWORD WINAPI FormatMessage32W( DWORD dwFlags, LPCVOID lpSource, @@ -781,10 +744,7 @@ DWORD WINAPI FormatMessage32W( if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY) argliststart=args+insertnr-1; else - /* FIXME: not sure that this is - * correct for unix-c-varargs. - */ - argliststart=((DWORD*)&args)+insertnr-1; + argliststart=(*(DWORD**)args)+insertnr-1; if (fmtstr[strlen(fmtstr)]=='s') { DWORD xarr[3]; @@ -847,41 +807,3 @@ DWORD WINAPI FormatMessage32W( lstrlen32W(lpBuffer); } #undef ADD_TO_T - -/*********************************************************************** - * FormatMessageW (KERNEL32.138) Emulator Version - */ -DWORD WINAPI WIN32_FormatMessage32W(DWORD *args) -{ - DWORD dwFlags = args[0]; - LPCVOID lpSource = (LPCVOID)args[1]; - DWORD dwMessageId = args[2]; - DWORD dwLanguageId = args[3]; - LPWSTR lpBuffer = (LPWSTR)args[4]; - DWORD nSize = args[5]; - DWORD *xargs; - - /* convert possible varargs to an argument array look-a-like */ - - if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY) { - xargs=(DWORD*)args[6]; - } else { - /* args[6] is a pointer to a pointer to the start of - * a list of arguments. - */ - if (args[6]) - xargs=(DWORD*)(((DWORD*)args[6])[0]); - else - xargs=NULL; - dwFlags|=FORMAT_MESSAGE_ARGUMENT_ARRAY; - } - return FormatMessage32W( - dwFlags, - lpSource, - dwMessageId, - dwLanguageId, - lpBuffer, - nSize, - xargs - ); -} diff --git a/misc/main.c b/misc/main.c index 3ef3384f9e4..c1589412214 100644 --- a/misc/main.c +++ b/misc/main.c @@ -35,31 +35,123 @@ #include "xmalloc.h" const char people[] = "Wine is available thanks to the work of " -"Bob Amstadt, Dag Asheim, Martin Ayotte, Peter Bajusz, Ross Biro, " -"Uwe Bonnes, Erik Bos, Fons Botman, John Brezak, Andrew Bulhak, " -"John Burton, Niels de Carpentier, Jimen Ching, Huw D. M. Davies, " -"Roman Dolejsi, Frans van Dorsselaer, Paul Falstad, David Faure, " -"Olaf Flebbe, Peter Galbavy, Ramon Garcia, Matthew Ghio, " -"Hans de Graaff, Charles M. Hannum, John Harvey, Cameron Heide, " -"Jochen Hoenicke, Onno Hovers, Jeffrey Hsu, Miguel de Icaza, " -"Jukka Iivonen, Lee Jaekil, Alexandre Julliard, Bang Jun-Young, " -"Pavel Kankovsky, Jochen Karrer, Andreas Kirschbaum, Albrecht Kleine, " -"Jon Konrath, Alex Korobka, Greg Kreider, Anand Kumria, Scott A. Laird, " -"Andrew Lewycky, Martin von Loewis, Kenneth MacDonald, Peter MacDonald, " -"William Magro, Juergen Marquardt, Ricardo Massaro, Marcus Meissner, " -"Graham Menhennitt, David Metcalfe, Bruce Milner, Steffen Moeller, " -"Andreas Mohr, Philippe De Muyter, Itai Nahshon, Michael Patra, " -"Jim Peterson, Robert Pouliot, Keith Reynolds, Slaven Rezic, " -"John Richardson, Johannes Ruscheinski, Thomas Sandford, " -"Constantine Sapuntzakis, Pablo Saratxaga, Daniel Schepler, " -"Ulrich Schmid, Bernd Schmidt, Yngvi Sigurjonsson, Stephen Simmons, " -"Rick Sladkey, William Smith, Dominik Strasser, Vadim Strizhevsky, " -"Erik Svendsen, Tristan Tarrant, Andrew Taylor, Duncan C Thomson, " -"Goran Thyni, Jimmy Tirtawangsa, Jon Tombs, Linus Torvalds, " -"Gregory Trubetskoy, Petri Tuomola, Michael Veksler, Sven Verdoolaege, " -"Ronan Waide, Eric Warnke, Manfred Weichel, Morten Welinder, " -"Jan Willamowius, Carl Williams, Karl Guenter Wuensch, Eric Youngdale, " -"James Youngman, Mikolaj Zalewski, and John Zero."; +"Bob Amstadt, " +"Dag Asheim, " +"Martin Ayotte, " +"Peter Bajusz, " +"Georg Beyerle, " +"Ross Biro, " +"Uwe Bonnes, " +"Erik Bos, " +"Fons Botman, " +"John Brezak, " +"Andrew Bulhak, " +"John Burton, " +"Niels de Carpentier, " +"Jimen Ching, " +"David A. Cuthbert, " +"Huw D. M. Davies, " +"Roman Dolejsi, " +"Frans van Dorsselaer, " +"Chris Faherty, " +"Paul Falstad, " +"David Faure, " +"Claus Fischer, " +"Olaf Flebbe, " +"Chad Fraleigh, " +"Peter Galbavy, " +"Ramon Garcia, " +"Matthew Ghio, " +"Jody Goldberg, " +"Hans de Graaff, " +"Charles M. Hannum, " +"Adrian Harvey, " +"John Harvey, " +"Cameron Heide, " +"Jochen Hoenicke, " +"Onno Hovers, " +"Jeffrey Hsu, " +"Miguel de Icaza, " +"Jukka Iivonen, " +"Lee Jaekil, " +"Alexandre Julliard, " +"Bang Jun-Young, " +"Pavel Kankovsky, " +"Jochen Karrer, " +"Andreas Kirschbaum, " +"Albrecht Kleine, " +"Jon Konrath, " +"Alex Korobka, " +"Greg Kreider, " +"Anand Kumria, " +"Scott A. Laird, " +"Andrew Lewycky, " +"Martin von Loewis, " +"Michiel van Loon, " +"Kenneth MacDonald, " +"Peter MacDonald, " +"William Magro, " +"Juergen Marquardt, " +"Ricardo Massaro, " +"Marcus Meissner, " +"Graham Menhennitt, " +"David Metcalfe, " +"Bruce Milner, " +"Steffen Moeller, " +"Andreas Mohr, " +"Philippe De Muyter, " +"Itai Nahshon, " +"Henrik Olsen, " +"Michael Patra, " +"Dimitrie O. Paun, " +"Jim Peterson, " +"Robert Pouliot, " +"Keith Reynolds, " +"Slaven Rezic, " +"John Richardson, " +"Rick Richardson, " +"Doug Ridgway, " +"Bernhard Rosenkraenzer, " +"Johannes Ruscheinski, " +"Thomas Sandford, " +"Constantine Sapuntzakis, " +"Pablo Saratxaga, " +"Daniel Schepler, " +"Peter Schlaile, " +"Ulrich Schmid, " +"Bernd Schmidt, " +"Ingo Schneider, " +"Victor Schneider, " +"Yngvi Sigurjonsson, " +"Stephen Simmons, " +"Rick Sladkey, " +"William Smith, " +"Dominik Strasser, " +"Vadim Strizhevsky, " +"Erik Svendsen, " +"Tristan Tarrant, " +"Andrew Taylor, " +"Duncan C Thomson, " +"Goran Thyni, " +"Jimmy Tirtawangsa, " +"Jon Tombs, " +"Linus Torvalds, " +"Gregory Trubetskoy, " +"Petri Tuomola, " +"Michael Veksler, " +"Sven Verdoolaege, " +"Ronan Waide, " +"Eric Warnke, " +"Manfred Weichel, " +"Morten Welinder, " +"Lawson Whitney, " +"Jan Willamowius, " +"Carl Williams, " +"Karl Guenter Wuensch, " +"Eric Youngdale, " +"James Youngman, " +"Mikolaj Zalewski, " +"and John Zero."; const WINE_LANGUAGE_DEF Languages[] = { diff --git a/misc/network.c b/misc/network.c index 3768fc93f98..4ebd1ffb649 100644 --- a/misc/network.c +++ b/misc/network.c @@ -153,8 +153,8 @@ int WINAPI WNetUnlockQueueData(LPSTR szQueue) /************************************************************************** * WNetGetConnection [USER.512] */ -int WINAPI WNetGetConnection(LPSTR lpLocalName, - LPSTR lpRemoteName, UINT16 *cbRemoteName) +int WINAPI WNetGetConnection16(LPSTR lpLocalName, + LPSTR lpRemoteName, UINT16 *cbRemoteName) { const char *path; @@ -402,4 +402,11 @@ UINT16 WINAPI WNetOpenEnum(DWORD dwScope, DWORD dwType, } - +DWORD +WNetGetConnection32A(LPCSTR localname,LPSTR remotename,LPDWORD buflen) +{ + UINT16 x; + DWORD ret = WNetGetConnection16(localname,remotename,&x); + *buflen = x; + return ret; +} diff --git a/misc/ntdll.c b/misc/ntdll.c index 43b6a5d13ae..aeef87a7f0e 100644 --- a/misc/ntdll.c +++ b/misc/ntdll.c @@ -510,3 +510,27 @@ DWORD WINAPI NtOpenFile(DWORD x1,DWORD flags,DWORD x3,DWORD x4,DWORD alignment,D /* returns file io completion status */ return 0; } +/* +These functions were originally in CRTDLL. CRTFLL now call the C-Lib +function directly. So they were moved here +*/ + +/********************************************************************* + * atoi (NDLL.885) + */ +INT32 NTDLL_atoi(LPCSTR x) +{ + if (!x) return 0; + return atoi(x); +} + +/********************************************************************* + * atol (NTDLL.886) + */ +LONG NTDLL_atol(LPCSTR x) +{ + if (!x) return 0; + return atol(x); +} + + diff --git a/misc/ole2.c b/misc/ole2.c index 5f65195bbe4..8996ce98c26 100644 --- a/misc/ole2.c +++ b/misc/ole2.c @@ -17,8 +17,8 @@ */ DWORD WINAPI OleBuildVersion() { - dprintf_ole(stddeb,"OleBuildVersion()\n"); - return (rmm<<16)+rup; + dprintf_ole(stddeb,"OleBuildVersion()\n"); + return (rmm<<16)+rup; } /*********************************************************************** @@ -35,5 +35,14 @@ HRESULT WINAPI OleInitialize(LPVOID reserved) */ void WINAPI OleUninitialize() { - dprintf_ole(stdnimp,"OleUninitialize()\n"); + dprintf_ole(stdnimp,"OleUninitialize()\n"); } + +/*********************************************************************** + * OleFlushClipboard [OLE2.76] + */ +HRESULT WINAPI OleFlushClipboard() +{ + return S_OK; +} + diff --git a/misc/ole2nls.c b/misc/ole2nls.c index df08c93d99d..5fd924e85b8 100644 --- a/misc/ole2nls.c +++ b/misc/ole2nls.c @@ -125,6 +125,7 @@ static struct tagLOCALE_NAME2ID { LOCALE_ENTRY(IPOSSEPBYSPACE), LOCALE_ENTRY(INEGSYMPRECEDES), LOCALE_ENTRY(INEGSEPBYSPACE), +/* LOCALE_ENTRY(FONTSIGNATURE),*/ {NULL,0}, }; @@ -183,7 +184,7 @@ const struct map_lcid2str { /*********************************************************************** * GetUserDefaultLCID (OLE2NLS.1) */ -DWORD WINAPI GetUserDefaultLCID() +LCID WINAPI GetUserDefaultLCID() { /* Default sorting, neutral sublanguage */ switch(Options.language) @@ -224,7 +225,7 @@ DWORD WINAPI GetUserDefaultLCID() /*********************************************************************** * GetSystemDefaultLCID (OLE2NLS.2) */ -DWORD WINAPI GetSystemDefaultLCID() +LCID WINAPI GetSystemDefaultLCID() { return GetUserDefaultLCID(); } @@ -232,7 +233,7 @@ DWORD WINAPI GetSystemDefaultLCID() /*********************************************************************** * GetUserDefaultLangID (OLE2NLS.3) */ -WORD WINAPI GetUserDefaultLangID() +LANGID WINAPI GetUserDefaultLangID() { return (WORD)GetUserDefaultLCID(); } @@ -240,7 +241,7 @@ WORD WINAPI GetUserDefaultLangID() /*********************************************************************** * GetSystemDefaultLangID (OLE2NLS.4) */ -WORD WINAPI GetSystemDefaultLangID() +LANGID WINAPI GetSystemDefaultLangID() { return GetUserDefaultLangID(); } @@ -261,6 +262,9 @@ INT32 WINAPI GetLocaleInfo32A(LCID lcid,LCTYPE LCType,LPSTR buf,INT32 len) dprintf_ole(stddeb,"GetLocaleInfo32A(%8lX,%8lX,%p,%4X)\n", lcid,LCType,buf,len); + + LCType &= ~(LOCALE_NOUSEROVERRIDE|LOCALE_USE_CP_ACP); + /* As an option, we could obtain the value from win.ini. This would not match the Wine compile-time option. Also, not all identifiers are available from win.ini */ @@ -303,8 +307,8 @@ LOCVAL(LOCALE_SABBREVCTRYNAME,"De") LOCVAL(LOCALE_SNATIVECTRYNAME,"Deutschland") LOCVAL(LOCALE_IDEFAULTLANGUAGE,"9") LOCVAL(LOCALE_IDEFAULTCOUNTRY,"49") +LOCVAL(LOCALE_IDEFAULTCODEPAGE,"851") /* Dunno -LOCVAL(LOCALE_IDEFAULTCODEPAGE) LOCVAL(LOCALE_IDEFAULTANSICODEPAGE) */ LOCVAL(LOCALE_SLIST,";") @@ -522,8 +526,6 @@ LOCVAL(LOCALE_INEGSEPBYSPACE, "0") case LANG_En: switch (LCType) { -/* This definitions apply to Germany only. Users in Austria - or Switzerland might want to modify them */ LOCVAL(LOCALE_ILANGUAGE,"9") LOCVAL(LOCALE_SLANGUAGE,"English") LOCVAL(LOCALE_SENGLANGUAGE,"English") @@ -536,8 +538,8 @@ LOCVAL(LOCALE_SABBREVCTRYNAME,"De") LOCVAL(LOCALE_SNATIVECTRYNAME,"Deutschland") LOCVAL(LOCALE_IDEFAULTLANGUAGE,"9") LOCVAL(LOCALE_IDEFAULTCOUNTRY,"49") +LOCVAL(LOCALE_IDEFAULTCODEPAGE,"437") /* Dunno -LOCVAL(LOCALE_IDEFAULTCODEPAGE) LOCVAL(LOCALE_IDEFAULTANSICODEPAGE) */ LOCVAL(LOCALE_SLIST,";") @@ -1685,7 +1687,8 @@ LOCVAL(LOCALE_INEGSEPBYSPACE, "0") if(!found) { fprintf(stderr,"'%s' not supported for your language.\n", retString); - return 0; + retString = ""; + /*return 0;*/ } if (buf) lstrcpyn32A(buf,retString,len); @@ -2029,3 +2032,59 @@ DWORD WINAPI VerLanguageName32W(UINT32 langid,LPWSTR langname, return strlen(languages[i].langname); /* same as strlenW(langname); */ } + +INT32 WINAPI LCMapString32A( + LCID lcid,DWORD mapflags,LPCSTR srcstr,INT32 srclen,LPSTR dststr, + INT32 dstlen +) { + int i,len; + + fprintf(stderr,"LCMapStringA(0x%04lx,0x%08lx,%s,%d,%p,%d)\n", + lcid,mapflags,srcstr,srclen,dststr,dstlen + ); + if (!dstlen || !dststr) { + dststr = srcstr; + } + if (!srclen) srclen = strlen(srcstr); + if (!dstlen) dstlen = strlen(dststr); + len = dstlen; + if (srclen < len) + len = srclen; + if (mapflags & LCMAP_LOWERCASE) { + for (i=0;i iconDirCount - nIconIndex ) n = iconDirCount - nIconIndex; + if( n > iconDirCount - nIconIndex ) n = iconDirCount - nIconIndex; - for( i = nIconIndex; i < nIconIndex + n; i++ ) - { - /* .ICO files have only one icon directory */ + for( i = nIconIndex; i < nIconIndex + n; i++ ) + { + /* .ICO files have only one icon directory */ - if( lpiID == NULL ) + if( lpiID == NULL ) hIcon = SHELL_LoadResource( hInstance, hFile, pIconDir + i, *(WORD*)pData ); - RetPtr[i-nIconIndex] = GetIconID( hIcon, 3 ); - GlobalFree16(hIcon); - } + RetPtr[i-nIconIndex] = GetIconID( hIcon, 3 ); + GlobalFree16(hIcon); + } - for( icon = nIconIndex; icon < nIconIndex + n; icon++ ) - { - hIcon = 0; - if( lpiID ) + for( icon = nIconIndex; icon < nIconIndex + n; icon++ ) + { + hIcon = 0; + if( lpiID ) hIcon = ICO_LoadIcon( hInstance, hFile, lpiID->idEntries + RetPtr[icon-nIconIndex]); - else + else for( i = 0; i < iconCount; i++ ) if( pIconStorage[i].id == (RetPtr[icon-nIconIndex] | 0x8000) ) hIcon = SHELL_LoadResource( hInstance, hFile, pIconStorage + i, *(WORD*)pData ); - RetPtr[icon-nIconIndex] = (hIcon)?CURSORICON_LoadHandler( hIcon, hInstance, FALSE ):0; - } + if( hIcon ) + { + RetPtr[icon-nIconIndex] = LoadIconHandler( hIcon, TRUE ); + FarSetOwner( RetPtr[icon-nIconIndex], GetExePtr(hInstance) ); + } + else + RetPtr[icon-nIconIndex] = 0; + } } if( lpiID ) HeapFree( GetProcessHeap(), 0, lpiID); else HeapFree( GetProcessHeap(), 0, pData); @@ -1030,3 +1036,9 @@ LPWSTR* WINAPI CommandLineToArgvW(LPWSTR cmdline,LPDWORD numargs) *numargs=i; return argv; } + +void WINAPI Control_RunDLL(DWORD a1,DWORD a2,LPSTR a3,DWORD a4) { + fprintf(stderr,"Control_RunDLL(0x%08lx,0x%08lx,%s,0x%08lx)\n", + a1,a2,a3,a4 + ); +} diff --git a/misc/spy.c b/misc/spy.c index 65490b9778f..56cebfe069e 100644 --- a/misc/spy.c +++ b/misc/spy.c @@ -9,6 +9,7 @@ #include #include #include "windows.h" +#include "win.h" #include "module.h" #include "options.h" #include "stddebug.h" @@ -568,6 +569,7 @@ static const char * const MessageTypeNames[SPY_MAX_MSGNUM + 1] = static BOOL16 SPY_Exclude[SPY_MAX_MSGNUM+1]; +static BOOL16 SPY_ExcludeDWP = 0; static int SPY_IndentLevel = 0; #define SPY_EXCLUDE(msg) \ @@ -578,17 +580,56 @@ static int SPY_IndentLevel = 0; */ const char *SPY_GetMsgName( UINT32 msg ) { - static char buffer[20]; + static char msg_buffer[20]; if (msg <= SPY_MAX_MSGNUM) { if (!MessageTypeNames[msg]) return "???"; return MessageTypeNames[msg]; } - sprintf( buffer, "WM_USER+%04x", msg - WM_USER ); - return buffer; + sprintf( msg_buffer, "WM_USER+%04x", msg - WM_USER ); + return msg_buffer; } +/*********************************************************************** + * SPY_GetWndName + */ +const char *SPY_GetWndName( HWND32 hwnd ) +{ + static char wnd_buffer[16]; + + WND* pWnd = WIN_FindWndPtr( hwnd ); + if( pWnd ) + { + INT32 n = sizeof(wnd_buffer) - 6; + LPSTR p = wnd_buffer; + LPSTR src; + + char postfix; + + if( pWnd->text && pWnd->text[0] != '\0' ) + { + src = pWnd->text; + *(p++) = postfix = '\"'; + while ((n-- > 1) && *src) *p++ = *src++; + } + else /* get class name */ + { + INT32 len; + + *(p++)='{'; + GlobalGetAtomName32A( pWnd->class->atomName, p, n + 1); + src = p += (len = lstrlen32A(p)); + if( len >= n ) src = wnd_buffer; /* something nonzero */ + postfix = '}'; + } + if( *src ) for( n = 0; n < 3; n++ ) *(p++)='.'; + *(p++) = postfix; + *(p++) = '\0'; + } + else lstrcpy32A( wnd_buffer, "\"NULL\"" ); + return wnd_buffer; +} /*********************************************************************** * SPY_EnterMessage @@ -596,20 +637,24 @@ const char *SPY_GetMsgName( UINT32 msg ) void SPY_EnterMessage( INT32 iFlag, HWND32 hWnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam ) { + LPCSTR pname; + if (!debugging_message || SPY_EXCLUDE(msg)) return; /* each SPY_SENDMESSAGE must be complemented by call to SPY_ExitMessage */ switch(iFlag) { case SPY_DISPATCHMESSAGE16: - dprintf_message(stddeb,"%*s(%04x) message [%04x] %s dispatched wp=%04x lp=%08lx\n", - SPY_IndentLevel, "", hWnd, msg, SPY_GetMsgName( msg ), + pname = SPY_GetWndName(hWnd); + dprintf_message(stddeb,"%*s(%04x) %-16s message [%04x] %s dispatched wp=%04x lp=%08lx\n", + SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ), wParam, lParam); break; case SPY_DISPATCHMESSAGE32: - dprintf_message(stddeb,"%*s(%08x) message [%04x] %s dispatched wp=%08x lp=%08lx\n", - SPY_IndentLevel, "", hWnd, msg, SPY_GetMsgName( msg ), + pname = SPY_GetWndName(hWnd); + dprintf_message(stddeb,"%*s(%08x) %-16s message [%04x] %s dispatched wp=%08x lp=%08lx\n", + SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ), wParam, lParam); break; @@ -618,32 +663,36 @@ void SPY_EnterMessage( INT32 iFlag, HWND32 hWnd, UINT32 msg, { char taskName[30]; HTASK16 hTask = GetWindowTask16(hWnd); + if (hTask == GetCurrentTask()) strcpy( taskName, "self" ); else if (!hTask) strcpy( taskName, "Wine" ); else sprintf( taskName, "task %04x %s", - hTask, MODULE_GetModuleName( GetExePtr(hTask) ) ); + hTask, MODULE_GetModuleName(hTask) ); + pname = SPY_GetWndName(hWnd); if (iFlag == SPY_SENDMESSAGE16) - dprintf_message(stddeb,"%*s(%04x) message [%04x] %s sent from %s wp=%04x lp=%08lx\n", - SPY_IndentLevel, "", hWnd, msg, - SPY_GetMsgName( msg ), taskName, wParam, - lParam ); + dprintf_message(stddeb, + "%*s(%04x) %-16s message [%04x] %s sent from %s wp=%04x lp=%08lx\n", + SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ), + taskName, wParam, lParam ); else - dprintf_message(stddeb,"%*s(%08x) message [%04x] %s sent from %s wp=%08x lp=%08lx\n", - SPY_IndentLevel, "", hWnd, msg, - SPY_GetMsgName( msg ), taskName, wParam, - lParam ); + dprintf_message(stddeb, + "%*s(%08x) %-16s message [%04x] %s sent from %s wp=%08x lp=%08lx\n", + SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ), + taskName, wParam, lParam ); } break; case SPY_DEFWNDPROC16: - dprintf_message(stddeb, "%*s(%04x) DefWindowProc: %s [%04x] wp=%04x lp=%08lx\n", + if( SPY_ExcludeDWP ) return; + dprintf_message(stddeb, "%*s(%04x) DefWindowProc16: %s [%04x] wp=%04x lp=%08lx\n", SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ), msg, wParam, lParam ); break; case SPY_DEFWNDPROC32: - dprintf_message(stddeb, "%*s(%08x) DefWindowProc: %s [%04x] wp=%08x lp=%08lx\n", + if( SPY_ExcludeDWP ) return; + dprintf_message(stddeb, "%*s(%08x) DefWindowProc32: %s [%04x] wp=%08x lp=%08lx\n", SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ), msg, wParam, lParam ); break; @@ -657,29 +706,51 @@ void SPY_EnterMessage( INT32 iFlag, HWND32 hWnd, UINT32 msg, */ void SPY_ExitMessage( INT32 iFlag, HWND32 hWnd, UINT32 msg, LRESULT lReturn ) { - if (!debugging_message || SPY_EXCLUDE(msg)) return; + LPCSTR pname; + + if (!debugging_message || SPY_EXCLUDE(msg) || + (SPY_ExcludeDWP && (iFlag == SPY_RESULT_DEFWND16 || iFlag == SPY_RESULT_DEFWND32)) ) + return; + if (SPY_IndentLevel) SPY_IndentLevel -= SPY_INDENT_UNIT; switch(iFlag) { + case SPY_RESULT_DEFWND16: + dprintf_message(stddeb,"%*s(%04x) DefWindowProc16: %s [%04x] returned %08lx\n", + SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ), msg, lReturn ); + break; + + case SPY_RESULT_DEFWND32: + dprintf_message(stddeb,"%*s(%08x) DefWindowProc32: %s [%04x] returned %08lx\n", + SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ), msg, lReturn ); + break; + case SPY_RESULT_OK16: - dprintf_message(stddeb,"%*s(%04x) message [%04x] %s returned %08lx\n", - SPY_IndentLevel, "", hWnd, msg, + pname = SPY_GetWndName(hWnd); + dprintf_message(stddeb,"%*s(%04x) %-16s message [%04x] %s returned %08lx\n", + SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ), lReturn ); break; + case SPY_RESULT_OK32: - dprintf_message(stddeb,"%*s(%08x) message [%04x] %s returned %08lx\n", - SPY_IndentLevel, "", hWnd, msg, + pname = SPY_GetWndName(hWnd); + dprintf_message(stddeb,"%*s(%08x) %-16s message [%04x] %s returned %08lx\n", + SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ), lReturn ); break; + case SPY_RESULT_INVALIDHWND16: - dprintf_message(stddeb,"%*s(%04x) message [%04x] %s HAS INVALID HWND\n", - SPY_IndentLevel, "", hWnd, msg, + pname = SPY_GetWndName(hWnd); + dprintf_message(stddeb,"%*s(%04x) %-16s message [%04x] %s HAS INVALID HWND\n", + SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ) ); break; + case SPY_RESULT_INVALIDHWND32: - dprintf_message(stddeb,"%*s(%08x) message [%04x] %s HAS INVALID HWND\n", - SPY_IndentLevel, "", hWnd, msg, + pname = SPY_GetWndName(hWnd); + dprintf_message(stddeb,"%*s(%08x) %-16s message [%04x] %s HAS INVALID HWND\n", + SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ) ); break; } @@ -712,5 +783,8 @@ int SPY_Init(void) for (i = 0; i <= SPY_MAX_MSGNUM; i++) SPY_Exclude[i] = (MessageTypeNames[i] && strstr(buffer,MessageTypeNames[i])); } + + SPY_ExcludeDWP = PROFILE_GetWineIniInt( "Spy", "ExcludeDWP", 0 ); + return 1; } diff --git a/misc/ver.c b/misc/ver.c index 89426ca38cf..dc6836cebe9 100644 --- a/misc/ver.c +++ b/misc/ver.c @@ -1,7 +1,8 @@ /* * Implementation of VER.DLL * - * Copyright 1996 Marcus Meissner + * Copyright 1996,1997 Marcus Meissner + * Copyright 1997 David Cuthbert */ #include #include @@ -166,8 +167,9 @@ static int testFileExclusiveExistence( int -read_ne_header(HFILE32 lzfd,LPIMAGE_OS2_HEADER nehd) { +read_xx_header(HFILE32 lzfd) { IMAGE_DOS_HEADER mzh; + char magic[2]; LZSeek32(lzfd,0,SEEK_SET); if (sizeof(mzh)!=LZRead32(lzfd,&mzh,sizeof(mzh))) @@ -175,22 +177,24 @@ read_ne_header(HFILE32 lzfd,LPIMAGE_OS2_HEADER nehd) { if (mzh.e_magic!=IMAGE_DOS_SIGNATURE) return 0; LZSeek32(lzfd,mzh.e_lfanew,SEEK_SET); - LZREAD(nehd); - if (nehd->ne_magic == IMAGE_OS2_SIGNATURE) { - LZSeek32(lzfd,mzh.e_lfanew,SEEK_SET); - return 1; - } - fprintf(stderr,"misc/ver.c:read_ne_header:can't handle PE files yet.\n"); - /* must handle PE files too. Later. */ + if (2!=LZRead32(lzfd,magic,2)) + return 0; + LZSeek32(lzfd,mzh.e_lfanew,SEEK_SET); + if (magic[0] == 'N' && magic[1] == 'E') + return IMAGE_OS2_SIGNATURE; + if (magic[0] == 'P' && magic[1] == 'E') + return IMAGE_NT_SIGNATURE; + fprintf(stderr,"misc/ver.c:read_ne_header:can't handle %*s files.\n",2,magic); return 0; } int find_ne_resource( - HFILE32 lzfd,LPIMAGE_OS2_HEADER nehd,SEGPTR typeid,SEGPTR resid, + HFILE32 lzfd,SEGPTR typeid,SEGPTR resid, BYTE **resdata,int *reslen,DWORD *off ) { + IMAGE_OS2_HEADER nehd; NE_TYPEINFO ti; NE_NAMEINFO ni; int i; @@ -198,7 +202,12 @@ find_ne_resource( DWORD nehdoffset; nehdoffset = LZTELL(lzfd); - LZSeek32(lzfd,nehd->resource_tab_offset,SEEK_CUR); + LZREAD(&nehd); + if (nehd.resource_tab_offset==nehd.rname_tab_offset) { + dprintf_ver(stddeb,"no resources in NE dll\n"); + return 0; + } + LZSeek32(lzfd,nehd.resource_tab_offset+nehdoffset,SEEK_SET); LZREAD(&shiftcount); dprintf_ver(stddeb,"shiftcount is %d\n",shiftcount); dprintf_ver(stddeb,"reading resource typeinfo dir.\n"); @@ -212,6 +221,7 @@ find_ne_resource( if (!ti.type_id) return 0; dprintf_ver(stddeb," ti.typeid =%04x,count=%d\n",ti.type_id,ti.count); + skipflag=0; if (!HIWORD(typeid)) { if ((ti.type_id&0x8000)&&(typeid!=ti.type_id)) @@ -227,7 +237,7 @@ find_ne_resource( whereleft = LZTELL(lzfd); LZSeek32( lzfd, - nehdoffset+nehd->resource_tab_offset+ti.type_id, + nehdoffset+nehd.resource_tab_offset+ti.type_id, SEEK_SET ); LZREAD(&len); @@ -268,7 +278,7 @@ find_ne_resource( whereleft = LZTELL(lzfd); LZSeek32( lzfd, - nehdoffset+nehd->resource_tab_offset+ni.id, + nehdoffset+nehd.resource_tab_offset+ni.id, SEEK_SET ); LZREAD(&len); @@ -302,31 +312,135 @@ find_ne_resource( } } +extern LPIMAGE_RESOURCE_DIRECTORY GetResDirEntryW( + LPIMAGE_RESOURCE_DIRECTORY resdirptr,LPCWSTR name,DWORD root +); + +/* Loads the specified PE resource. + * FIXME: shouldn't load the whole image + */ +int +find_pe_resource( + HFILE32 lzfd,LPWSTR typeid,LPWSTR resid, + BYTE **resdata,int *reslen,DWORD *off +) { + IMAGE_NT_HEADERS pehd; + int i; + UINT32 nrofsections; + DWORD imagesize,pehdoffset; + BYTE *image; + IMAGE_DATA_DIRECTORY resdir; + LPIMAGE_RESOURCE_DIRECTORY resourcedir,xresdir; + LPIMAGE_RESOURCE_DATA_ENTRY xresdata; + LPIMAGE_SECTION_HEADER sections; + + pehdoffset = LZTELL(lzfd); + LZREAD(&pehd); + resdir = pehd.OptionalHeader.DataDirectory[IMAGE_FILE_RESOURCE_DIRECTORY]; + dprintf_ver(stddeb,"find_pe_resource(.,%p,%p,....)\n",typeid,resid); + if (!resdir.Size) { + fprintf(stderr,"misc/ver.c:find_pe_resource() no resource directory found in PE file.\n"); + return 0; + } + imagesize = pehd.OptionalHeader.SizeOfImage; + image = HeapAlloc(GetProcessHeap(),0,imagesize); + nrofsections = pehd.FileHeader.NumberOfSections; + + sections = (LPIMAGE_SECTION_HEADER)HeapAlloc(GetProcessHeap(),0,pehd.FileHeader.NumberOfSections*sizeof(IMAGE_SECTION_HEADER)); + LZSeek32(lzfd, + pehdoffset+ + sizeof(DWORD)+ /* Signature */ + sizeof(IMAGE_FILE_HEADER)+ + pehd.FileHeader.SizeOfOptionalHeader, + SEEK_SET + ); + if ( nrofsections*sizeof(IMAGE_SECTION_HEADER)!= + LZRead32(lzfd,sections,nrofsections*sizeof(IMAGE_SECTION_HEADER)) + ) { + HeapFree(GetProcessHeap(),0,image); + return 0; + } + for (i=0;iSize; + *resdata= (LPBYTE)xmalloc(*reslen); + memcpy(*resdata,image+xresdata->OffsetToData,*reslen); + /* find physical address for virtual offset */ + for (i=0;iOffsetToData >= sections[i].VirtualAddress)&& + (xresdata->OffsetToData < sections[i].VirtualAddress+sections[i].SizeOfRawData) + ) { + *off = (DWORD)(xresdata->OffsetToData)-(DWORD)(sections[i].VirtualAddress)+(DWORD)(sections[i].PointerToRawData); + break; + } + } + HeapFree(GetProcessHeap(),0,image); + HeapFree(GetProcessHeap(),0,sections); + return 1; +} + /* GetFileResourceSize [VER.2] */ DWORD WINAPI GetFileResourceSize(LPCSTR filename,SEGPTR restype,SEGPTR resid, LPDWORD off) { HFILE32 lzfd; OFSTRUCT ofs; - BYTE *resdata; - int reslen; - IMAGE_OS2_HEADER nehd; + BYTE *resdata = NULL; + int reslen,res; dprintf_ver(stddeb,"GetFileResourceSize(%s,%lx,%lx,%p)\n", filename,(LONG)restype,(LONG)resid,off ); lzfd=LZOpenFile32A(filename,&ofs,OF_READ); - if (lzfd==0) - return 0; - if (!read_ne_header(lzfd,&nehd)) { - LZClose32(lzfd); + if (!lzfd) return 0; + switch (read_xx_header(lzfd)) { + case 0: + res=0; + break; + case IMAGE_OS2_SIGNATURE: + res=find_ne_resource(lzfd,restype,resid,&resdata,&reslen,off); + break; + case IMAGE_NT_SIGNATURE: + res=find_pe_resource(lzfd,(LPWSTR)restype,(LPWSTR)resid,&resdata,&reslen,off); + break; } - if (!find_ne_resource(lzfd,&nehd,restype,resid,&resdata,&reslen,off)) { - LZClose32(lzfd); - return 0; + if (!res) { + LZClose32(lzfd); + return 0; } - free(resdata); + if (resdata) + free(resdata); LZClose32(lzfd); return reslen; } @@ -337,9 +451,9 @@ DWORD WINAPI GetFileResource(LPCSTR filename,SEGPTR restype,SEGPTR resid, { HFILE32 lzfd; OFSTRUCT ofs; - BYTE *resdata; - int reslen=datalen; - IMAGE_OS2_HEADER nehd; + BYTE *resdata=NULL; + int res,reslen=datalen; + dprintf_ver(stddeb,"GetFileResource(%s,%lx,%lx,%ld,%ld,%p)\n", filename,(LONG)restype,(LONG)resid,off,datalen,data ); @@ -348,20 +462,26 @@ DWORD WINAPI GetFileResource(LPCSTR filename,SEGPTR restype,SEGPTR resid, if (lzfd==0) return 0; if (!off) { - if (!read_ne_header(lzfd,&nehd)) { - LZClose32(lzfd); - return 0; + switch (read_xx_header(lzfd)) { + case 0: res=0; + break; + case IMAGE_OS2_SIGNATURE: + res= find_ne_resource(lzfd,restype,resid,&resdata,&reslen,&off); + break; + case IMAGE_NT_SIGNATURE: + res= find_pe_resource(lzfd,restype,resid,&resdata,&reslen,&off); + break; } - if (!find_ne_resource(lzfd,&nehd,restype,resid,&resdata,&reslen,&off)) { - LZClose32(lzfd); + LZClose32(lzfd); + if (!res) return 0; - } + if (reslen>datalen) reslen = datalen; + memcpy(data,resdata,reslen); free(resdata); + return reslen; } LZSeek32(lzfd,off,SEEK_SET); - if (reslen>datalen) - reslen=datalen; - LZRead32(lzfd,data,reslen); + reslen = LZRead32(lzfd,data,datalen); LZClose32(lzfd); return reslen; } @@ -369,8 +489,8 @@ DWORD WINAPI GetFileResource(LPCSTR filename,SEGPTR restype,SEGPTR resid, /* GetFileVersionInfoSize [VER.6] */ DWORD WINAPI GetFileVersionInfoSize16(LPCSTR filename,LPDWORD handle) { - DWORD len,ret; - BYTE buf[72]; + DWORD len,ret,isuni=0; + BYTE buf[144]; VS_FIXEDFILEINFO *vffi; dprintf_ver(stddeb,"GetFileVersionInfoSize16(%s,%p)\n",filename,handle); @@ -384,15 +504,41 @@ DWORD WINAPI GetFileVersionInfoSize16(LPCSTR filename,LPDWORD handle) return 0; vffi=(VS_FIXEDFILEINFO*)(buf+0x14); - if (vffi->dwSignature != VS_FFI_SIGNATURE) - return 0; + if (vffi->dwSignature != VS_FFI_SIGNATURE) { + /* unicode resource */ + if (vffi->dwSignature == 0x004f0049) { + isuni = 1; + vffi = (VS_FIXEDFILEINFO*)(buf+0x28); + } else { + fprintf(stderr,"vffi->dwSignature is 0x%08lx, but not 0x%08lx!\n", + vffi->dwSignature,VS_FFI_SIGNATURE + ); + return 0; + } + } if (*(WORD*)buf < len) len = *(WORD*)buf; - dprintf_ver(stddeb,"->strucver=%ld.%ld,filever=%ld.%ld,productver=%ld.%ld,flagmask=%lx,flags=%lx,OS=", + dprintf_ver(stddeb," structversion=0x%lx.0x%lx,\n fileversion=0x%lx.0x%lx,\n productversion=0x%lx.0x%lx,\n flagmask=0x%lx,\n flags=", (vffi->dwStrucVersion>>16),vffi->dwStrucVersion&0xFFFF, vffi->dwFileVersionMS,vffi->dwFileVersionLS, vffi->dwProductVersionMS,vffi->dwProductVersionLS, - vffi->dwFileFlagsMask,vffi->dwFileFlags + vffi->dwFileFlagsMask + ); + if (vffi->dwFileFlags & VS_FF_DEBUG) + dprintf_ver(stddeb,"DEBUG,"); + if (vffi->dwFileFlags & VS_FF_PRERELEASE) + dprintf_ver(stddeb,"PRERELEASE,"); + if (vffi->dwFileFlags & VS_FF_PATCHED) + dprintf_ver(stddeb,"PATCHED,"); + if (vffi->dwFileFlags & VS_FF_PRIVATEBUILD) + dprintf_ver(stddeb,"PRIVATEBUILD,"); + if (vffi->dwFileFlags & VS_FF_INFOINFERRED) + dprintf_ver(stddeb,"INFOINFERRED,"); + if (vffi->dwFileFlags & VS_FF_SPECIALBUILD) + dprintf_ver(stddeb,"SPECIALBUILD,"); + dprintf_ver(stddeb,"\n OS=0x%lx.0x%lx (", + (vffi->dwFileOS&0xFFFF0000)>>16, + vffi->dwFileOS&0x0000FFFF ); switch (vffi->dwFileOS&0xFFFF0000) { case VOS_DOS:dprintf_ver(stddeb,"DOS,");break; @@ -401,7 +547,7 @@ DWORD WINAPI GetFileVersionInfoSize16(LPCSTR filename,LPDWORD handle) case VOS_NT:dprintf_ver(stddeb,"NT,");break; case VOS_UNKNOWN: default: - dprintf_ver(stddeb,"UNKNOWN(%ld),",vffi->dwFileOS&0xFFFF0000);break; + dprintf_ver(stddeb,"UNKNOWN(0x%lx),",vffi->dwFileOS&0xFFFF0000);break; } switch (vffi->dwFileOS & 0xFFFF) { case VOS__BASE:dprintf_ver(stddeb,"BASE");break; @@ -409,21 +555,22 @@ DWORD WINAPI GetFileVersionInfoSize16(LPCSTR filename,LPDWORD handle) case VOS__WINDOWS32:dprintf_ver(stddeb,"WIN32");break; case VOS__PM16:dprintf_ver(stddeb,"PM16");break; case VOS__PM32:dprintf_ver(stddeb,"PM32");break; - default:dprintf_ver(stddeb,"UNKNOWN(%ld)",vffi->dwFileOS&0xFFFF);break; + default:dprintf_ver(stddeb,"UNKNOWN(0x%lx)",vffi->dwFileOS&0xFFFF);break; } + dprintf_ver(stddeb,")\n "); switch (vffi->dwFileType) { default: case VFT_UNKNOWN: - dprintf_ver(stddeb,"filetype=Unknown(%ld)",vffi->dwFileType); + dprintf_ver(stddeb,"filetype=Unknown(0x%lx)",vffi->dwFileType); break; - case VFT_APP:dprintf_ver(stddeb,"filetype=APP");break; - case VFT_DLL:dprintf_ver(stddeb,"filetype=DLL");break; + case VFT_APP:dprintf_ver(stddeb,"filetype=APP,");break; + case VFT_DLL:dprintf_ver(stddeb,"filetype=DLL,");break; case VFT_DRV: dprintf_ver(stddeb,"filetype=DRV,"); switch(vffi->dwFileSubtype) { default: case VFT2_UNKNOWN: - dprintf_ver(stddeb,"UNKNOWN(%ld)",vffi->dwFileSubtype); + dprintf_ver(stddeb,"UNKNOWN(0x%lx)",vffi->dwFileSubtype); break; case VFT2_DRV_PRINTER: dprintf_ver(stddeb,"PRINTER"); @@ -464,7 +611,7 @@ DWORD WINAPI GetFileVersionInfoSize16(LPCSTR filename,LPDWORD handle) dprintf_ver(stddeb,"filetype=FONT."); switch (vffi->dwFileSubtype) { default: - dprintf_ver(stddeb,"UNKNOWN(%ld)",vffi->dwFileSubtype); + dprintf_ver(stddeb,"UNKNOWN(0x%lx)",vffi->dwFileSubtype); break; case VFT2_FONT_RASTER:dprintf_ver(stddeb,"RASTER");break; case VFT2_FONT_VECTOR:dprintf_ver(stddeb,"VECTOR");break; @@ -474,7 +621,7 @@ DWORD WINAPI GetFileVersionInfoSize16(LPCSTR filename,LPDWORD handle) case VFT_VXD:dprintf_ver(stddeb,"filetype=VXD");break; case VFT_STATIC_LIB:dprintf_ver(stddeb,"filetype=STATIC_LIB");break; } - dprintf_ver(stddeb,"filedata=%lx.%lx\n",vffi->dwFileDateMS,vffi->dwFileDateLS); + dprintf_ver(stddeb,"\n filedata=0x%lx.0x%lx\n",vffi->dwFileDateMS,vffi->dwFileDateLS); return len; } @@ -749,7 +896,7 @@ DWORD WINAPI VerInstallFile16( /* VerInstallFileA [VERSION.7] */ static LPBYTE -_fetch_versioninfo(LPSTR fn) { +_fetch_versioninfo(LPSTR fn,VS_FIXEDFILEINFO **vffi) { DWORD alloclen; LPBYTE buf; DWORD ret; @@ -766,8 +913,14 @@ _fetch_versioninfo(LPSTR fn) { free(buf); alloclen = *(WORD*)buf; buf = xmalloc(alloclen); - } else + } else { + *vffi = (VS_FIXEDFILEINFO*)(buf+0x14); + if ((*vffi)->dwSignature == 0x004f0049) /* hack to detect unicode */ + *vffi = (VS_FIXEDFILEINFO*)(buf+0x28); + if ((*vffi)->dwSignature != VS_FFI_SIGNATURE) + fprintf(stderr,"_fetch_versioninfo:bad VS_FIXEDFILEINFO signature 0x%08lx\n",(*vffi)->dwSignature); return buf; + } } } @@ -868,16 +1021,14 @@ DWORD WINAPI VerInstallFile32A( } xret = 0; if (!(flags & VIFF_FORCEINSTALL)) { - buf1 = _fetch_versioninfo(destfn); + VS_FIXEDFILEINFO *destvffi,*tmpvffi; + buf1 = _fetch_versioninfo(destfn,&destvffi); if (buf1) { - buf2 = _fetch_versioninfo(tmpfn); + buf2 = _fetch_versioninfo(tmpfn,&tmpvffi); if (buf2) { char *tbuf1,*tbuf2; - VS_FIXEDFILEINFO *destvffi,*tmpvffi; UINT32 len1,len2; - destvffi= (VS_FIXEDFILEINFO*)(buf1+0x14); - tmpvffi = (VS_FIXEDFILEINFO*)(buf2+0x14); len1=len2=40; /* compare file versions */ @@ -974,7 +1125,7 @@ DWORD WINAPI VerInstallFile32W( /* FIXME: UNICODE? */ -struct db { +struct dbA { WORD nextoff; WORD datalen; /* in memory structure... */ @@ -985,11 +1136,25 @@ struct db { */ }; +/* FIXME: UNICODE? */ +struct dbW { + WORD nextoff; + WORD datalen; + WORD btext; /* type of data */ +/* in memory structure... */ + WCHAR name[1]; /* padded to dword alignment */ +/* .... + WCHAR data[datalen]; padded to dword alignment + BYTE subdirdata[]; until nextoff + */ +}; + +/* this one used for Win16 resources, which are always in ASCII format */ static BYTE* -_find_data(BYTE *block,LPCSTR str, WORD buff_remain) { +_find_dataA(BYTE *block,LPCSTR str, WORD buff_remain) { char *nextslash; int substrlen, inc_size; - struct db *db; + struct dbA *db; while (*str && *str=='\\') str++; @@ -1006,7 +1171,7 @@ _find_data(BYTE *block,LPCSTR str, WORD buff_remain) { while (1) { - db=(struct db*)block; + db=(struct dbA*)block; dprintf_ver(stddeb,"db=%p,db->nextoff=%d,db->datalen=%d,db->name=%s,db->data=%s\n", db,db->nextoff,db->datalen,db->name,(char*)((char*)db+4+((strlen(db->name)+4)&~3)) ); @@ -1018,7 +1183,7 @@ _find_data(BYTE *block,LPCSTR str, WORD buff_remain) { if (nextslash) { inc_size = 4+((strlen(db->name)+4)&~3)+((db->datalen+3)&~3); - return _find_data( block+inc_size ,nextslash, + return _find_dataA( block+inc_size ,nextslash, buff_remain - inc_size); } else @@ -1030,13 +1195,54 @@ _find_data(BYTE *block,LPCSTR str, WORD buff_remain) { } } +/* this one used for Win32 resources, which are always in UNICODE format */ +extern LPWSTR CRTDLL_wcschr(LPWSTR str,WCHAR xchar); +static BYTE* +_find_dataW(BYTE *block,LPCWSTR str, WORD buff_remain) { + LPWSTR nextslash; + int substrlen, inc_size; + struct dbW *db; + + while (*str && *str=='\\') + str++; + if (NULL!=(nextslash=CRTDLL_wcschr(str,'\\'))) + substrlen=nextslash-str; + else + substrlen=lstrlen32W(str); + if (nextslash!=NULL) { + while (*nextslash && *nextslash=='\\') + nextslash++; + if (!*nextslash) + nextslash=NULL; + } + + + while (1) { + db=(struct dbW*)block; + if ((!db->nextoff) || (!buff_remain)) /* no more entries ? */ + return NULL; + + if (!lstrncmp32W(db->name,str,substrlen)) { + if (nextslash) { + inc_size = 8+((lstrlen32W(db->name)*sizeof(WCHAR)+4)&~3)+((db->datalen+3)&~3); + + return _find_dataW( block+inc_size ,nextslash, + buff_remain - inc_size); + } else + return block; + } + inc_size=((db->nextoff+3)&~3); + block=block+inc_size; + buff_remain=buff_remain-inc_size; + } +} + /* VerQueryValue [VER.11] */ /* take care, 'buffer' is NOT a SEGPTR, it just points to one */ DWORD WINAPI VerQueryValue16(SEGPTR segblock,LPCSTR subblock,SEGPTR *buffer, UINT16 *buflen) { BYTE *block=PTR_SEG_TO_LIN(segblock),*b; - struct db *db; char *s; dprintf_ver(stddeb,"VerQueryValue16(%p,%s,%p,%d)\n", @@ -1044,16 +1250,36 @@ DWORD WINAPI VerQueryValue16(SEGPTR segblock,LPCSTR subblock,SEGPTR *buffer, ); s=(char*)xmalloc(strlen("VS_VERSION_INFO\\")+strlen(subblock)+1); strcpy(s,"VS_VERSION_INFO\\");strcat(s,subblock); - b=_find_data(block, s, *(WORD *)block); - if (b==NULL) { - *buflen=0; - return 0; + + /* check for UNICODE version */ + if ( (*(DWORD*)(block+0x14) != VS_FFI_SIGNATURE) && + (*(DWORD*)(block+0x28) == VS_FFI_SIGNATURE) + ) { + struct dbW *db; + LPWSTR wstr; + wstr = HEAP_strdupAtoW(GetProcessHeap(),0,s); + b=_find_dataW(block, wstr, *(WORD *)block); + HeapFree(GetProcessHeap(),0,wstr); + if (!b) { + fprintf(stderr,"key %s not found in versionresource.\n",subblock); + *buflen=0; + return 0; + } + db=(struct dbW*)b; + b = b+8+((lstrlen32W(db->name)*sizeof(WCHAR)+4)&~3); + *buflen = db->datalen; + } else { + struct dbA *db; + b=_find_dataA(block, s, *(WORD *)block); + if (!b) { + fprintf(stderr,"key %s not found in versionresource.\n",subblock); + *buflen=0; + return 0; + } + db=(struct dbA*)b; + b = b+4+((lstrlen32A(db->name)+4)&~3); + *buflen = db->datalen; } - db=(struct db*)b; - *buflen = db->datalen; - /* let b point to data area */ - b = b+4+((strlen(db->name)+4)&~3); - /* now look up what the resp. SEGPTR would be ... */ *buffer = (b-block)+segblock; dprintf_ver(stddeb," -> %s=%s\n",subblock,b); return 1; @@ -1063,23 +1289,42 @@ DWORD WINAPI VerQueryValue32A(LPVOID vblock,LPCSTR subblock, LPVOID *vbuffer,UINT32 *buflen) { BYTE *b,*block=(LPBYTE)vblock,**buffer=(LPBYTE*)vbuffer; - struct db *db; - char *s; + LPSTR s; dprintf_ver(stddeb,"VerQueryValue32A(%p,%s,%p,%d)\n", block,subblock,buffer,*buflen ); s=(char*)xmalloc(strlen("VS_VERSION_INFO\\")+strlen(subblock)+1); strcpy(s,"VS_VERSION_INFO\\");strcat(s,subblock); - b=_find_data(block, s, *(WORD *)block); - if (b==NULL) { - *buflen=0; - return 0; + /* check for UNICODE version */ + if ( (*(DWORD*)(block+0x14) != VS_FFI_SIGNATURE) && + (*(DWORD*)(block+0x28) == VS_FFI_SIGNATURE) + ) { + LPWSTR wstr; + struct dbW *db; + wstr = HEAP_strdupAtoW(GetProcessHeap(),0,s); + b=_find_dataW(block, wstr, *(WORD *)block); + HeapFree(GetProcessHeap(),0,wstr); + if (!b) { + fprintf(stderr,"key %s not found in versionresource.\n",subblock); + *buflen=0; + return 0; + } + db=(struct dbW*)b; + *buflen = db->datalen; + b = b+8+((lstrlen32W(db->name)*sizeof(WCHAR)+4)&~3); + } else { + struct dbA *db; + b=_find_dataA(block, s, *(WORD *)block); + if (!b) { + fprintf(stderr,"key %s not found in versionresource.\n",subblock); + *buflen=0; + return 0; + } + db=(struct dbA*)b; + *buflen = db->datalen; + b = b+4+((lstrlen32A(db->name)+4)&~3); } - db=(struct db*)b; - *buflen = db->datalen; - /* let b point to data area */ - b = b+4+((strlen(db->name)+4)&~3); *buffer = b; dprintf_ver(stddeb," -> %s=%s\n",subblock,b); return 1; @@ -1088,30 +1333,11 @@ DWORD WINAPI VerQueryValue32A(LPVOID vblock,LPCSTR subblock, DWORD WINAPI VerQueryValue32W(LPVOID vblock,LPCWSTR subblock,LPVOID *vbuffer, UINT32 *buflen) { - /* FIXME: hmm, we not only need to convert subblock, but also - * the content...or? - * And what about UNICODE version info? - * And the NAMES of the values? - */ - BYTE *b,**buffer=(LPBYTE*)vbuffer,*block=(LPBYTE)vblock; - struct db *db; - char *s,*sb; + LPSTR sb; + DWORD ret; sb = HEAP_strdupWtoA( GetProcessHeap(), 0, subblock ); - s=(char*)xmalloc(strlen("VS_VERSION_INFO\\")+strlen(sb)+1); - strcpy(s,"VS_VERSION_INFO\\");strcat(s,sb); - b=_find_data(block, s, *(WORD *)block); - if (b==NULL) { - *buflen=0; - HeapFree( GetProcessHeap(), 0, sb ); - return 0; - } - db=(struct db*)b; - *buflen = db->datalen; - /* let b point to data area */ - b = b+4+((strlen(db->name)+4)&~3); - *buffer = b; - dprintf_ver(stddeb," -> %s=%s\n",sb,b); + ret = VerQueryValue32A(vblock,sb,vbuffer,buflen); HeapFree( GetProcessHeap(), 0, sb ); return 1; } diff --git a/misc/winsock.c b/misc/winsock.c index 3246b415fa7..bec016cda57 100644 --- a/misc/winsock.c +++ b/misc/winsock.c @@ -342,7 +342,11 @@ void WINSOCK_Shutdown() INT32 WINSOCK_DeleteTaskWSI( TDB* pTask, LPWSINFO pwsi ) { - /* WSACleanup() backend, called on task termination as well. */ + /* WSACleanup() backend, called on task termination as well. + * Real DLL would have registered its own signal handler with + * TaskSetSignalHandler() and waited until USIG_TERMINATION/USIG_GPF + * but this scheme is much more straightforward. + */ int i, j, n; diff --git a/misc/wsprintf.c b/misc/wsprintf.c index f347fd516cf..9f11e074d4f 100644 --- a/misc/wsprintf.c +++ b/misc/wsprintf.c @@ -331,7 +331,7 @@ INT16 WINAPI wvsnprintf16( LPSTR buffer, UINT16 maxlen, LPCSTR spec, * wvsnprintf32A (Not a Windows API) */ INT32 WINAPI wvsnprintf32A( LPSTR buffer, UINT32 maxlen, LPCSTR spec, - LPCVOID args ) + va_list args ) { WPRINTF_FORMAT format; LPSTR p = buffer; @@ -351,21 +351,24 @@ INT32 WINAPI wvsnprintf32A( LPSTR buffer, UINT32 maxlen, LPCSTR spec, switch(format.type) { case WPR_WCHAR: - if ((*p = (CHAR)*(WCHAR *)args)) p++; + if ((*p = (CHAR)va_arg( args, WCHAR ))) p++; else if (format.width > 1) *p++ = ' '; else len = 0; break; case WPR_CHAR: - if ((*p = *(CHAR *)args)) p++; + if ((*p = va_arg( args, CHAR ))) p++; else if (format.width > 1) *p++ = ' '; else len = 0; break; case WPR_STRING: - if (len) memcpy( p, *(LPCSTR *)args, len ); + if (len) memcpy( p, va_arg( args, LPCSTR ), len ); p += len; break; case WPR_WSTRING: - for (i = 0; i < len; i++) *p++ = (CHAR)*(*(LPCWSTR *)args + i); + { + LPCWSTR ptr = va_arg( args, LPCWSTR ); + for (i = 0; i < len; i++) *p++ = (CHAR)*ptr++; + } break; case WPR_HEXA: if ((format.flags & WPRINTF_PREFIX_HEX) && (maxlen > 3)) @@ -383,12 +386,12 @@ INT32 WINAPI wvsnprintf32A( LPSTR buffer, UINT32 maxlen, LPCSTR spec, for (i = len; i < format.precision; i++, maxlen--) *p++ = '0'; if (len) memcpy( p, number, len ); p += len; + (void)va_arg( args, INT32 ); /* Go to the next arg */ break; } if (format.flags & WPRINTF_LEFTALIGN) for (i = format.precision; i < format.width; i++, maxlen--) *p++ = ' '; - args = (INT32 *)args + 1; maxlen -= len; } *p = 0; @@ -400,7 +403,7 @@ INT32 WINAPI wvsnprintf32A( LPSTR buffer, UINT32 maxlen, LPCSTR spec, * wvsnprintf32W (Not a Windows API) */ INT32 WINAPI wvsnprintf32W( LPWSTR buffer, UINT32 maxlen, LPCWSTR spec, - LPCVOID args ) + va_list args ) { WPRINTF_FORMAT format; LPWSTR p = buffer; @@ -420,20 +423,23 @@ INT32 WINAPI wvsnprintf32W( LPWSTR buffer, UINT32 maxlen, LPCWSTR spec, switch(format.type) { case WPR_WCHAR: - if ((*p = *(WCHAR *)args)) p++; + if ((*p = va_arg( args, WCHAR ))) p++; else if (format.width > 1) *p++ = ' '; else len = 0; break; case WPR_CHAR: - if ((*p = (WCHAR)*(CHAR *)args)) p++; + if ((*p = (WCHAR)va_arg( args, CHAR ))) p++; else if (format.width > 1) *p++ = ' '; else len = 0; break; case WPR_STRING: - for (i = 0; i < len; i++) *p++ = (WCHAR)*(*(LPCSTR *)args + i); + { + LPCSTR ptr = va_arg( args, LPCSTR ); + for (i = 0; i < len; i++) *p++ = (WCHAR)*ptr++; + } break; case WPR_WSTRING: - if (len) memcpy( p, *(LPCWSTR *)args, len * sizeof(WCHAR) ); + if (len) memcpy( p, va_arg( args, LPCWSTR ), len * sizeof(WCHAR) ); p += len; break; case WPR_HEXA: @@ -451,12 +457,12 @@ INT32 WINAPI wvsnprintf32W( LPWSTR buffer, UINT32 maxlen, LPCWSTR spec, case WPR_UNSIGNED: for (i = len; i < format.precision; i++, maxlen--) *p++ = '0'; for (i = 0; i < len; i++) *p++ = (WCHAR)number[i]; + (void)va_arg( args, INT32 ); /* Go to the next arg */ break; } if (format.flags & WPRINTF_LEFTALIGN) for (i = format.precision; i < format.width; i++, maxlen--) *p++ = ' '; - args = (INT32 *)args + 1; maxlen -= len; } *p = 0; @@ -476,7 +482,7 @@ INT16 WINAPI wvsprintf16( LPSTR buffer, LPCSTR spec, LPCVOID args ) /*********************************************************************** * wvsprintf32A (USER32.586) */ -INT32 WINAPI wvsprintf32A( LPSTR buffer, LPCSTR spec, LPCVOID args ) +INT32 WINAPI wvsprintf32A( LPSTR buffer, LPCSTR spec, va_list args ) { return wvsnprintf32A( buffer, 0xffffffff, spec, args ); } @@ -485,7 +491,7 @@ INT32 WINAPI wvsprintf32A( LPSTR buffer, LPCSTR spec, LPCVOID args ) /*********************************************************************** * wvsprintf32W (USER32.587) */ -INT32 WINAPI wvsprintf32W( LPWSTR buffer, LPCWSTR spec, LPCVOID args ) +INT32 WINAPI wvsprintf32W( LPWSTR buffer, LPCWSTR spec, va_list args ) { return wvsnprintf32W( buffer, 0xffffffff, spec, args ); } @@ -502,7 +508,7 @@ INT16 WINAPIV wsprintf16( LPSTR buffer, LPCSTR spec, ... ) va_start( valist, spec ); /* Note: we call the 32-bit version, because the args are 32-bit */ - res = (INT16)wvsprintf32A( buffer, spec, (LPCVOID)valist ); + res = (INT16)wvsprintf32A( buffer, spec, valist ); va_end( valist ); return res; } @@ -519,44 +525,75 @@ INT16 WINAPIV WIN16_wsprintf16(void) /*********************************************************************** - * wsprintf32A (USER32.584) + * wsprintf32A (USER32.585) */ -/* Winelib version */ INT32 WINAPIV wsprintf32A( LPSTR buffer, LPCSTR spec, ... ) { va_list valist; INT32 res; va_start( valist, spec ); - res = wvsprintf32A( buffer, spec, (LPCVOID)valist ); + res = wvsprintf32A( buffer, spec, valist ); va_end( valist ); return res; } -/* Emulator version */ -INT32 WINAPIV WIN32_wsprintf32A( DWORD *args ) -{ - return wvsprintf32A( (LPSTR)args[0], (LPCSTR)args[1], (LPCVOID)&args[2] ); -} - /*********************************************************************** - * wsprintf32W (USER32.585) + * wsprintf32W (USER32.586) */ -/* Winelib version */ INT32 WINAPIV wsprintf32W( LPWSTR buffer, LPCWSTR spec, ... ) { va_list valist; INT32 res; va_start( valist, spec ); - res = wvsprintf32W( buffer, spec, (LPCVOID)valist ); + res = wvsprintf32W( buffer, spec, valist ); va_end( valist ); return res; } -/* Emulator version */ -INT32 WINAPIV WIN32_wsprintf32W( DWORD *args ) + +/*********************************************************************** + * wsnprintf16 (Not a Windows API) + */ +INT16 WINAPIV wsnprintf16( LPSTR buffer, UINT16 maxlen, LPCSTR spec, ... ) { - return wvsprintf32W( (LPWSTR)args[0], (LPCWSTR)args[1], (LPCVOID)&args[2]); + va_list valist; + INT16 res; + + va_start( valist, spec ); + res = wvsnprintf16( buffer, maxlen, spec, valist ); + va_end( valist ); + return res; +} + + +/*********************************************************************** + * wsnprintf32A (Not a Windows API) + */ +INT32 WINAPIV wsnprintf32A( LPSTR buffer, UINT32 maxlen, LPCSTR spec, ... ) +{ + va_list valist; + INT32 res; + + va_start( valist, spec ); + res = wvsnprintf32A( buffer, maxlen, spec, valist ); + va_end( valist ); + return res; +} + + +/*********************************************************************** + * wsnprintf32W (Not a Windows API) + */ +INT32 WINAPIV wsnprintf32W( LPWSTR buffer, UINT32 maxlen, LPCWSTR spec, ... ) +{ + va_list valist; + INT32 res; + + va_start( valist, spec ); + res = wvsnprintf32W( buffer, maxlen, spec, valist ); + va_end( valist ); + return res; } diff --git a/miscemu/instr.c b/miscemu/instr.c index 9e414c4ede8..c101d21bd3a 100644 --- a/miscemu/instr.c +++ b/miscemu/instr.c @@ -187,7 +187,9 @@ static BYTE *INSTR_GetOperandAddr( SIGCONTEXT *context, BYTE *instr, } if (segprefix != -1) seg = segprefix; - /* FIXME: should check limit of the segment here */ + /* Make sure the segment and offset are valid */ + if (((seg & 7) != 7) || IS_SELECTOR_FREE(seg)) return NULL; + if (GET_SEL_LIMIT(seg) < (base + (index << ss))) return NULL; return (BYTE *)PTR_SEG_OFF_TO_LIN( seg, (base + (index << ss)) ); #undef GET_VAL } diff --git a/msdos/int21.c b/msdos/int21.c index d01e61f269c..8bcb950c740 100644 --- a/msdos/int21.c +++ b/msdos/int21.c @@ -102,15 +102,6 @@ static BYTE *GetCurrentDTA(void) } -static void ChopOffWhiteSpace(char *string) -{ - int length; - - for (length = strlen(string) ; length ; length--) - if (string[length] == ' ') - string[length] = '\0'; -} - void CreateBPB(int drive, BYTE *data) { if (drive > 1) { @@ -760,87 +751,11 @@ static int INT21_FindNextFCB( CONTEXT *context ) static void DeleteFileFCB( CONTEXT *context ) { fprintf( stderr, "DeleteFileFCB: not implemented yet\n" ); -#if 0 - BYTE *fcb = PTR_SEG_OFF_TO_LIN(DS_reg(context), DX_reg(context)); - struct dosdirent *dp; - char temp[256], *ptr; - int drive = DOS_GET_DRIVE( *fcb ); - - DumpFCB( fcb ); - - temp[0] = '\\'; - strcpy(temp+1, DRIVE_GetDosCwd(drive)); - strcat(temp, "\\"); - strncat(temp, fcb + 1, 8); - ChopOffWhiteSpace(temp); - strncat(temp, fcb + 9, 3); - ChopOffWhiteSpace(temp); - - if ((dp = DOS_opendir(temp)) == NULL) { - Error(InvalidDrive, EC_MediaError , EL_Disk); - AX_reg(context) = 0xff; - return; - } - - temp[0] = '\\'; - strcpy(temp+1, DRIVE_GetDosCwd(drive) ); - strcat(temp, "\\"); - - ptr = temp + strlen(temp); - - while (DOS_readdir(dp) != NULL) - { - strcpy(ptr, dp->filename); - dprintf_int(stddeb, "int21: delete file %s\n", temp); - /* unlink(DOS_GetUnixFileName(temp)); */ - } - DOS_closedir(dp); - AX_reg(context) = 0; -#endif } static void RenameFileFCB( CONTEXT *context ) { fprintf( stderr, "RenameFileFCB: not implemented yet\n" ); -#if 0 - BYTE *fcb = PTR_SEG_OFF_TO_LIN(DS_reg(context), DX_reg(context)); - struct dosdirent *dp; - char temp[256], oldname[256], newname[256], *oldnameptr, *newnameptr; - int drive = DOS_GET_DRIVE( *fcb ); - - DumpFCB( fcb ); - - temp[0] = '\\'; - strcpy(temp+1, DRIVE_GetDosCwd(drive) ); - strcat(temp, "\\"); - strncat(temp, fcb + 1, 8); - ChopOffWhiteSpace(temp); - strncat(temp, fcb + 9, 3); - ChopOffWhiteSpace(temp); - - if ((dp = DOS_opendir(temp)) == NULL) { - Error(InvalidDrive, EC_MediaError , EL_Disk); - AX_reg(context) = 0xff; - return; - } - - oldname[0] = '\\'; - strcpy(oldname+1, DRIVE_GetDosCwd(drive) ); - strcat(oldname, "\\"); - strcpy( newname, oldname ); - oldnameptr = oldname + strlen(oldname); - newnameptr = newname + strlen(newname); - - while (DOS_readdir(dp) != NULL) - { - strcpy(oldnameptr, dp->filename); - strcpy(newnameptr, fcb + 1); - dprintf_int(stddeb, "int21: renamefile %s -> %s\n", - oldname, newname); - } - DOS_closedir(dp); - AX_reg(context) = 0; -#endif } @@ -1627,6 +1542,14 @@ void WINAPI DOS3Call( CONTEXT *context ) } break; case 0x41: /* Delete file */ + if (!DeleteFile32A(PTR_SEG_OFF_TO_LIN( + DS_reg(context), + DX_reg(context)) + )) { + SET_CFLAG(context); + AL_reg(context) = DOS_ExtendedError; + } + break; case 0x56: /* Move (rename) file */ default: fprintf( stderr, "Unimplemented int21 long file name function:\n"); diff --git a/multimedia/mmsystem.c b/multimedia/mmsystem.c index b13221f9232..06b97437264 100644 --- a/multimedia/mmsystem.c +++ b/multimedia/mmsystem.c @@ -2304,22 +2304,23 @@ UINT16 WINAPI mmioDescend(HMMIO16 hmmio, MMCKINFO * lpck, const MMCKINFO * lpckParent, UINT16 uFlags) { DWORD dwfcc, dwOldPos; - LPMMIOINFO lpmminfo; + dprintf_mmio(stddeb, "mmioDescend(%04X, %p, %p, %04X);\n", hmmio, lpck, lpckParent, uFlags); - if (lpck == NULL) return 0; - lpmminfo = (LPMMIOINFO)GlobalLock16(hmmio); - if (lpmminfo == NULL) return 0; + + if (lpck == NULL) + return 0; + dwfcc = lpck->ckid; dprintf_mmio(stddeb, "mmioDescend // dwfcc=%08lX\n", dwfcc); - dprintf_mmio(stddeb, "mmioDescend // hfile = %ld\n", lpmminfo->dwReserved2); - dwOldPos = _llseek32((HFILE32)lpmminfo->dwReserved2, 0, SEEK_CUR); + + dwOldPos = mmioSeek(hmmio, 0, SEEK_CUR); dprintf_mmio(stddeb, "mmioDescend // dwOldPos=%ld\n", dwOldPos); + if (lpckParent != NULL) { dprintf_mmio(stddeb, "mmioDescend // seek inside parent at %ld !\n", lpckParent->dwDataOffset); - dwOldPos = _llseek32((HFILE32)lpmminfo->dwReserved2, - lpckParent->dwDataOffset, SEEK_SET); - } + dwOldPos = mmioSeek(hmmio, lpckParent->dwDataOffset, SEEK_SET); + } /* It seems to be that FINDRIFF should not be treated the same as the @@ -2331,44 +2332,43 @@ UINT16 WINAPI mmioDescend(HMMIO16 hmmio, MMCKINFO * lpck, if ((uFlags & MMIO_FINDCHUNK) || (uFlags & MMIO_FINDLIST)) { dprintf_mmio(stddeb, "mmioDescend // MMIO_FINDxxxx dwfcc=%08lX !\n", dwfcc); while (TRUE) { - size_t ix; + LONG ix; - ix =_lread32((HFILE32)lpmminfo->dwReserved2, (LPSTR)lpck, sizeof(MMCKINFO)); - dprintf_mmio(stddeb, "mmioDescend // after _lread32 ix = %d req = %d, errno = %d\n",ix,sizeof(MMCKINFO),errno); + ix = mmioRead(hmmio, (LPSTR)lpck, sizeof(MMCKINFO)); + dprintf_mmio(stddeb, "mmioDescend // after _lread32 ix = %ld req = %d, errno = %d\n",ix,sizeof(MMCKINFO),errno); if (ix < sizeof(MMCKINFO)) { - _llseek32((HFILE32)lpmminfo->dwReserved2, dwOldPos, SEEK_SET); - GlobalUnlock16(hmmio); + mmioSeek(hmmio, dwOldPos, SEEK_SET); dprintf_mmio(stddeb, "mmioDescend // return ChunkNotFound\n"); return MMIOERR_CHUNKNOTFOUND; - } + } dprintf_mmio(stddeb, "mmioDescend // dwfcc=%08lX ckid=%08lX cksize=%08lX !\n", dwfcc, lpck->ckid, lpck->cksize); - if (dwfcc == lpck->ckid) break; + if (dwfcc == lpck->ckid) + break; + dwOldPos += lpck->cksize + 2 * sizeof(DWORD); if (lpck->ckid == FOURCC_RIFF || lpck->ckid == FOURCC_LIST) dwOldPos += sizeof(DWORD); - _llseek32((HFILE32)lpmminfo->dwReserved2, dwOldPos, SEEK_SET); - } + mmioSeek(hmmio, dwOldPos, SEEK_SET); } + } else { - if (_lread32(LOWORD(lpmminfo->dwReserved2), (LPSTR)lpck, - sizeof(MMCKINFO)) < sizeof(MMCKINFO)) { - _llseek32((HFILE32)lpmminfo->dwReserved2, dwOldPos, SEEK_SET); - GlobalUnlock16(hmmio); - dprintf_mmio(stddeb, "mmioDescend // return ChunkNotFound 2nd\n"); + if (mmioRead(hmmio, (LPSTR)lpck, sizeof(MMCKINFO)) < sizeof(MMCKINFO)) { + mmioSeek(hmmio, dwOldPos, SEEK_SET); + dprintf_mmio(stddeb, "mmioDescend // return ChunkNotFound 2nd\n"); return MMIOERR_CHUNKNOTFOUND; - } } + } lpck->dwDataOffset = dwOldPos + 2 * sizeof(DWORD); if (lpck->ckid == FOURCC_RIFF || lpck->ckid == FOURCC_LIST) lpck->dwDataOffset += sizeof(DWORD); - lpmminfo->lDiskOffset = _llseek32((HFILE32)lpmminfo->dwReserved2, - lpck->dwDataOffset, SEEK_SET); - GlobalUnlock16(hmmio); + mmioSeek(hmmio, lpck->dwDataOffset, SEEK_SET); + dprintf_mmio(stddeb, "mmioDescend // lpck->ckid=%08lX lpck->cksize=%ld !\n", lpck->ckid, lpck->cksize); dprintf_mmio(stddeb, "mmioDescend // lpck->fccType=%08lX !\n", lpck->fccType); + return 0; } diff --git a/multimedia/time.c b/multimedia/time.c index 6242f857440..cf4905a8651 100644 --- a/multimedia/time.c +++ b/multimedia/time.c @@ -32,7 +32,6 @@ typedef struct tagTIMERENTRY { WORD wTimerID; WORD wCurTime; struct tagTIMERENTRY *Next; - struct tagTIMERENTRY *Prev; } TIMERENTRY, *LPTIMERENTRY; static LPTIMERENTRY lpTimerList = NULL; @@ -137,23 +136,16 @@ WORD WINAPI timeSetEvent(WORD wDelay, WORD wResol, LPTIMECALLBACK lpFunc, wDelay, wResol, lpFunc, dwUser, wFlags); if (!mmTimeStarted) StartMMTime(); - lpNewTimer = (LPTIMERENTRY) malloc(sizeof(TIMERENTRY)); + lpNewTimer = (LPTIMERENTRY)xmalloc(sizeof(TIMERENTRY)); if (lpNewTimer == NULL) return 0; while (lpTimer != NULL) { wNewID = MAX(wNewID, lpTimer->wTimerID); - if (lpTimer->Next == NULL) - break; lpTimer = lpTimer->Next; } - if (lpTimerList == NULL) { - lpTimerList = lpNewTimer; - lpNewTimer->Prev = NULL; - } else { - lpTimer->Next = lpNewTimer; - lpNewTimer->Prev = lpTimer; - } - lpNewTimer->Next = NULL; + + lpNewTimer->Next = lpTimerList; + lpTimerList = lpNewTimer; lpNewTimer->wTimerID = wNewID + 1; lpNewTimer->wCurTime = wDelay; lpNewTimer->wDelay = wDelay; @@ -173,19 +165,15 @@ WORD WINAPI timeSetEvent(WORD wDelay, WORD wResol, LPTIMECALLBACK lpFunc, */ WORD WINAPI timeKillEvent(WORD wID) { - LPTIMERENTRY lpTimer = lpTimerList; - while (lpTimer != NULL) { - if (wID == lpTimer->wTimerID) { - if (lpTimer->Prev != NULL) - lpTimer->Prev->Next = lpTimer->Next; - if (lpTimer->Next != NULL) - lpTimer->Next->Prev = lpTimer->Prev; - free(lpTimer); - if (lpTimer==lpTimerList) - lpTimerList=NULL; + LPTIMERENTRY xlptimer,*lpTimer = &lpTimerList; + while (*lpTimer) { + if (wID == (*lpTimer)->wTimerID) { + xlptimer = (*lpTimer)->Next; + free(*lpTimer); + *lpTimer = xlptimer; return TRUE; } - lpTimer = lpTimer->Next; + lpTimer = &((*lpTimer)->Next); } return 0; } diff --git a/objects/bitmap.c b/objects/bitmap.c index 6fe7a98539b..18df9836c66 100644 --- a/objects/bitmap.c +++ b/objects/bitmap.c @@ -49,6 +49,80 @@ static int XPutImage_wrapper( const struct XPutImage_descr *descr ) descr->image, 0, 0, 0, 0, descr->width, descr->height ); } +/*********************************************************************** + * BITMAP_GetBitsPadding + * + * Return number of bytes to pad a scanline of 16-bit aligned Windows DDB data. + */ +INT32 BITMAP_GetBitsPadding( int bmWidth, int bpp ) +{ + INT32 pad; + + switch (bpp) + { + case 1: + if (!(bmWidth & 15)) pad = 0; + else pad = ((16 - (bmWidth & 15)) + 7) / 8; + break; + + case 8: + pad = (2 - (bmWidth & 1)) & 1; + break; + + case 24: + pad = (bmWidth*3) & 1; + break; + + case 32: + case 16: + case 15: + pad = 0; /* we have 16bit alignment already */ + break; + + case 4: + if (!(bmWidth & 3)) pad = 0; + else pad = ((4 - (bmWidth & 3)) + 1) / 2; + break; + + default: + fprintf(stderr,"GetBitsPadding: unknown depth %d, please report.\n", bpp ); + return -1; + } + return pad; +} + +/*********************************************************************** + * BITMAP_GetBitsWidth + * + * Return number of bytes taken by a scanline of 16-bit aligned Windows DDB data. + */ +INT32 BITMAP_GetBitsWidth( int bmWidth, int bpp ) +{ + switch(bpp) + { + case 1: + return 2 * ((bmWidth+15) >> 4); + + case 24: + bmWidth *= 3; /* fall through */ + case 8: + return bmWidth + (bmWidth & 1); + + case 32: + return bmWidth * 4; + + case 16: + case 15: + return bmWidth * 2; + + case 4: + return 2 * ((bmWidth+3) >> 2); + + default: + fprintf(stderr,"GetBitsPadding: unknown depth %d, please report.\n", bpp ); + } + return -1; +} /*********************************************************************** * CreateBitmap16 (GDI.48) @@ -200,46 +274,19 @@ LONG WINAPI GetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPVOID buffer ) /* Only get entire lines */ height = count / bmp->bitmap.bmWidthBytes; if (height > bmp->bitmap.bmHeight) height = bmp->bitmap.bmHeight; + dprintf_bitmap(stddeb, "GetBitmapBits: %dx%d %d colors %p fetched height: %ld\n", bmp->bitmap.bmWidth, bmp->bitmap.bmHeight, 1 << bmp->bitmap.bmBitsPixel, buffer, height ); - if (!height) + + pad = BITMAP_GetBitsPadding( bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel ); + + if (!height || (pad == -1)) { GDI_HEAP_UNLOCK( hbitmap ); return 0; } - switch (bmp->bitmap.bmBitsPixel) { - case 1: - if (!(bmp->bitmap.bmWidth & 15)) - pad = 0; - else - pad = ((16 - (bmp->bitmap.bmWidth & 15)) + 7) / 8; - break; - case 4: - if (!(bmp->bitmap.bmWidth & 3)) - pad = 0; - else - pad = ((4 - (bmp->bitmap.bmWidth & 3)) + 1) / 2; - break; - case 8: - pad = (2 - (bmp->bitmap.bmWidth & 1)) & 1; - break; - case 15: - case 16: - pad = 0; /* we have 16bit alignment already */ - break; - case 24: - pad = (bmp->bitmap.bmWidth*3) & 1; - break; - default: - fprintf(stderr,"GetBitMapBits32: unknown depth %d, please report.\n", - bmp->bitmap.bmBitsPixel - ); - GDI_HEAP_UNLOCK( hbitmap ); - return 0; - } - /* Hack: change the bitmap height temporarily to avoid */ /* getting unnecessary bitmap rows. */ old_height = bmp->bitmap.bmHeight; @@ -354,41 +401,15 @@ LONG WINAPI SetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPCVOID buffer ) /* Only set entire lines */ height = count / bmp->bitmap.bmWidthBytes; if (height > bmp->bitmap.bmHeight) height = bmp->bitmap.bmHeight; - if (!height) + + pad = BITMAP_GetBitsPadding( bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel ); + + if (!height || (pad == -1)) { GDI_HEAP_UNLOCK( hbitmap ); return 0; } - switch (bmp->bitmap.bmBitsPixel) { - case 1: - if (!(bmp->bitmap.bmWidth & 15)) - pad = 0; - else - pad = ((16 - (bmp->bitmap.bmWidth & 15)) + 7) / 8; - break; - case 4: - if (!(bmp->bitmap.bmWidth & 3)) - pad = 0; - else - pad = ((4 - (bmp->bitmap.bmWidth & 3)) + 1) / 2; - break; - case 8: - pad = (2 - (bmp->bitmap.bmWidth & 1)) & 1; - break; - case 15: - case 16: - pad = 0; /* we have 16bit alignment already */ - break; - case 24: - pad = (bmp->bitmap.bmWidth*3) & 1; - break; - default: - fprintf(stderr,"SetBitMapBits32: unknown depth %d, please report.\n", - bmp->bitmap.bmBitsPixel - ); - return 0; - } sbuf = (LPBYTE)buffer; widthbytes = DIB_GetXImageWidthBytes(bmp->bitmap.bmWidth,bmp->bitmap.bmBitsPixel); @@ -497,6 +518,29 @@ HANDLE32 WINAPI LoadImage32A( HINSTANCE32 hinst, LPCSTR name, UINT32 type, return 0; } +HANDLE32 WINAPI LoadImage32W( HINSTANCE32 hinst, LPCWSTR name, UINT32 type, + INT32 desiredx, INT32 desiredy, UINT32 loadflags) +{ + if (HIWORD(name)) { + dprintf_resource(stddeb,"LoadImage32W(0x%04x,%p,%d,%d,%d,0x%08x)\n", + hinst,name,type,desiredx,desiredy,loadflags + ); + } else { + dprintf_resource(stddeb,"LoadImage32W(0x%04x,%p,%d,%d,%d,0x%08x)\n", + hinst,name,type,desiredx,desiredy,loadflags + ); + } + switch (type) { + case IMAGE_BITMAP: + return LoadBitmap32W(hinst,name); + case IMAGE_ICON: + return LoadIcon32W(hinst,name); + case IMAGE_CURSOR: + return LoadCursor32W(hinst,name); + } + return 0; +} + /********************************************************************** * CopyImage32 (USER32.60) * diff --git a/objects/brush.c b/objects/brush.c index 5f216f211c3..b3fdb31dc9d 100644 --- a/objects/brush.c +++ b/objects/brush.c @@ -7,6 +7,7 @@ #include #include "brush.h" #include "bitmap.h" +#include "syscolor.h" #include "metafile.h" #include "color.h" #include "stddebug.h" @@ -241,18 +242,80 @@ BOOL32 WINAPI SetBrushOrgEx( HDC32 hdc, INT32 x, INT32 y, LPPOINT32 oldorg ) */ HBRUSH16 WINAPI GetSysColorBrush16( INT16 index ) { - fprintf( stderr, "Unimplemented stub: GetSysColorBrush16(%d)\n", index ); - return GetStockObject32(LTGRAY_BRUSH); + return (HBRUSH16)GetSysColorBrush32(index); } /*********************************************************************** * GetSysColorBrush32 (USER32.289) */ -HBRUSH32 WINAPI GetSysColorBrush32( INT32 index) +HBRUSH32 WINAPI GetSysColorBrush32( INT32 index ) { - fprintf( stderr, "Unimplemented stub: GetSysColorBrush32(%d)\n", index ); - return GetStockObject32(LTGRAY_BRUSH); + switch(index){ + case COLOR_SCROLLBAR: + return sysColorObjects.hbrushScrollbar; + case COLOR_BACKGROUND: /* same as COLOR_DESKTOP */ + return sysColorObjects.hbrushScrollbar; /*FIXME*/ + case COLOR_ACTIVECAPTION: + return sysColorObjects.hbrushActiveCaption; + case COLOR_INACTIVECAPTION: + return sysColorObjects.hbrushInactiveCaption; + case COLOR_MENU: + return sysColorObjects.hbrushMenu; + case COLOR_WINDOW: + return sysColorObjects.hbrushWindow; + case COLOR_WINDOWFRAME: + fprintf( stderr, "GetSysColorBrush32: Unimplemented index(%d)\n", index ); + break; + case COLOR_MENUTEXT: + fprintf( stderr, "GetSysColorBrush32: Unimplemented index(%d)\n", index ); + break; + case COLOR_WINDOWTEXT: + fprintf( stderr, "GetSysColorBrush32: Unimplemented index(%d)\n", index ); + break; + case COLOR_CAPTIONTEXT: + fprintf( stderr, "GetSysColorBrush32: Unimplemented index(%d)\n", index ); + break; + case COLOR_ACTIVEBORDER: + return sysColorObjects.hbrushActiveBorder; + case COLOR_INACTIVEBORDER: + return sysColorObjects.hbrushInactiveBorder; + case COLOR_APPWORKSPACE: + return sysColorObjects.hbrushActiveBorder; /*FIXME*/ + case COLOR_HIGHLIGHT: + return sysColorObjects.hbrushHighlight; + case COLOR_HIGHLIGHTTEXT: + return sysColorObjects.hbrushHighlight; /*FIXME*/ + case COLOR_BTNFACE: /* same as COLOR_3DFACE */ + return sysColorObjects.hbrushBtnFace; + case COLOR_BTNSHADOW: /* same as COLOR_3DSHADOW */ + return sysColorObjects.hbrushBtnShadow; + case COLOR_GRAYTEXT: + return sysColorObjects.hbrushBtnShadow; /*FIXME*/ + case COLOR_BTNTEXT: + return sysColorObjects.hbrushBtnShadow; /*FIXME*/ + case COLOR_INACTIVECAPTIONTEXT: + return sysColorObjects.hbrushBtnShadow; /*FIXME*/ + case COLOR_BTNHIGHLIGHT: /* same as COLOR_(3DHIGH|3DHI|BTNHI)LIGHT */ + return sysColorObjects.hbrushBtnHighlight; + /* case COLOR_3DDKSHADOW: FIXME + fprintf( stderr, "GetSysColorBrush32: Unimplemented index(%d)\n", index ); + break; + case COLOR_3DLIGHT: + fprintf( stderr, "GetSysColorBrush32: Unimplemented index(%d)\n", index ); + break; + case COLOR_INFOTEXT: + fprintf( stderr, "GetSysColorBrush32: Unimplemented index(%d)\n", index ); + break; + case COLOR_INFOBK: + fprintf( stderr, "GetSysColorBrush32: Unimplemented index(%d)\n", index ); + break;*/ + default: + fprintf( stderr, "GetSysColorBrush32: Unknown index(%d)\n", index ); + } + + return GetStockObject32(LTGRAY_BRUSH); + } @@ -299,5 +362,3 @@ INT32 BRUSH_GetObject32( BRUSHOBJ * brush, INT32 count, LPSTR buffer ) memcpy( buffer, &brush->logbrush, count ); return count; } - - diff --git a/objects/cursoricon.c b/objects/cursoricon.c index 317f1634072..fb021096f4e 100644 --- a/objects/cursoricon.c +++ b/objects/cursoricon.c @@ -2,6 +2,8 @@ * Cursor and icon support * * Copyright 1995 Alexandre Julliard + * 1996 Martin Von Loewis + * 1997 Alex Korobka */ /* @@ -26,18 +28,22 @@ #include #include +#include "heap.h" #include "windows.h" +#include "peexe.h" #include "color.h" #include "bitmap.h" #include "callback.h" #include "cursoricon.h" #include "sysmetrics.h" +#include "module.h" #include "win.h" #include "stddebug.h" #include "debug.h" #include "task.h" extern UINT16 COLOR_GetSystemPaletteSize(); +extern HGLOBAL16 USER_CallDefaultRsrcHandler( HGLOBAL16, HMODULE16, HRSRC16 ); Cursor CURSORICON_XCursor = None; /* Current X cursor */ static HCURSOR32 hActiveCursor = 0; /* Active cursor */ @@ -196,15 +202,14 @@ static CURSORDIRENTRY *CURSORICON_FindBestCursor( CURSORICONDIR *dir, /********************************************************************** - * CURSORICON_LoadDirEntry + * CURSORICON_LoadDirEntry16 * * Load the icon/cursor directory for a given resource name and find the * best matching entry. */ -static BOOL32 CURSORICON_LoadDirEntry( HINSTANCE32 hInstance, SEGPTR name, - INT32 width, INT32 height, - INT32 colors, BOOL32 fCursor, - CURSORICONDIRENTRY *dirEntry ) +static BOOL32 CURSORICON_LoadDirEntry16( HINSTANCE32 hInstance, SEGPTR name, + INT32 width, INT32 height, INT32 colors, + BOOL32 fCursor, CURSORICONDIRENTRY *dirEntry ) { HRSRC16 hRsrc; HGLOBAL16 hMem; @@ -231,30 +236,76 @@ static BOOL32 CURSORICON_LoadDirEntry( HINSTANCE32 hInstance, SEGPTR name, /********************************************************************** - * CURSORICON_LoadHandler + * CURSORICON_LoadDirEntry32 * - * Create a cursor or icon from a resource. + * Load the icon/cursor directory for a given resource name and find the + * best matching entry. */ -HGLOBAL16 CURSORICON_LoadHandler( HGLOBAL16 handle, HINSTANCE16 hInstance, - BOOL32 fCursor ) +static BOOL32 CURSORICON_LoadDirEntry32( HINSTANCE32 hInstance, LPCWSTR name, + INT32 width, INT32 height, INT32 colors, + BOOL32 fCursor, CURSORICONDIRENTRY *dirEntry ) { - static char* __loadhandlerStr = "CURSORICON_LoadHandler"; + HANDLE32 hRsrc; + HANDLE32 hMem; + CURSORICONDIR *dir; + CURSORICONDIRENTRY *entry = NULL; + if (!(hRsrc = FindResource32W( hInstance, name, + (LPCWSTR)(fCursor ? RT_GROUP_CURSOR : RT_GROUP_ICON) ))) + return FALSE; + if (!(hMem = LoadResource32( hInstance, hRsrc ))) return FALSE; + if ((dir = (CURSORICONDIR*)LockResource32( hMem ))) + { + if (fCursor) + entry = (CURSORICONDIRENTRY *)CURSORICON_FindBestCursor( dir, + width, height ); + else + entry = (CURSORICONDIRENTRY *)CURSORICON_FindBestIcon( dir, + width, height, colors ); + if (entry) *dirEntry = *entry; + } + FreeResource32( hMem ); + return (entry != NULL); +} + + +/********************************************************************** + * CURSORICON_CreateFromResource + * + * Create a cursor or icon from in-memory resource template. + * + * FIXME: Adjust icon size when width and height are nonzero (stretchblt). + * Convert to mono when cFlag is LR_MONOCHROME. Do something + * with cbSize parameter as well. + */ +static HGLOBAL16 CURSORICON_CreateFromResource( HINSTANCE32 hInstance, HGLOBAL16 hObj, LPBYTE bits, + UINT32 cbSize, BOOL32 bIcon, DWORD dwVersion, + INT32 width, INT32 height, UINT32 cFlag ) +{ int sizeAnd, sizeXor; HBITMAP32 hAndBits = 0, hXorBits = 0; /* error condition for later */ BITMAPOBJ *bmpXor, *bmpAnd; POINT16 hotspot = { 0 ,0 }; - CURSORICONINFO *info; BITMAPINFO *bmi; HDC32 hdc; - if (fCursor) /* If cursor, get the hotspot */ + dprintf_cursor(stddeb,"CreateFromResource: %08x (%u bytes), ver %08x, %ix%i %s %s\n", + (unsigned)bits, cbSize, (unsigned)dwVersion, width, height, + bIcon ? "icon" : "cursor", cFlag ? "mono" : "" ); + if (dwVersion == 0x00020000) { - POINT16 *pt = (POINT16 *)LockResource16( handle ); + fprintf(stdnimp,"\t2.xx resources are not supported\n"); + return 0; + } + + if (bIcon) + bmi = (BITMAPINFO *)bits; + else /* get the hotspot */ + { + POINT16 *pt = (POINT16 *)bits; hotspot = *pt; bmi = (BITMAPINFO *)(pt + 1); } - else bmi = (BITMAPINFO *)LockResource16( handle ); /* Check bitmap header */ @@ -262,7 +313,7 @@ HGLOBAL16 CURSORICON_LoadHandler( HGLOBAL16 handle, HINSTANCE16 hInstance, (bmi->bmiHeader.biSize != sizeof(BITMAPINFOHEADER) || bmi->bmiHeader.biCompression != BI_RGB) ) { - fprintf(stderr,"%s: invalid bitmap header.\n", __loadhandlerStr); + fprintf(stderr,"\tinvalid resource bitmap header.\n"); return 0; } @@ -329,7 +380,7 @@ HGLOBAL16 CURSORICON_LoadHandler( HGLOBAL16 handle, HINSTANCE16 hInstance, if( !hXorBits || !hAndBits ) { - fprintf(stderr,"%s: unable to create a bitmap.\n", __loadhandlerStr ); + fprintf(stderr,"\tunable to create an icon bitmap.\n"); return 0; } @@ -340,46 +391,77 @@ HGLOBAL16 CURSORICON_LoadHandler( HGLOBAL16 handle, HINSTANCE16 hInstance, sizeXor = bmpXor->bitmap.bmHeight * bmpXor->bitmap.bmWidthBytes; sizeAnd = bmpAnd->bitmap.bmHeight * bmpAnd->bitmap.bmWidthBytes; - if (!(handle = GlobalAlloc16( GMEM_MOVEABLE, - sizeof(CURSORICONINFO) + sizeXor + sizeAnd))) + if (hObj) hObj = GlobalReAlloc16( hObj, + sizeof(CURSORICONINFO) + sizeXor + sizeAnd, GMEM_MOVEABLE ); + if (!hObj) hObj = GlobalAlloc16( GMEM_MOVEABLE, + sizeof(CURSORICONINFO) + sizeXor + sizeAnd ); + if (hObj) { - DeleteObject32( hXorBits ); - DeleteObject32( hAndBits ); - return 0; + CURSORICONINFO *info; + + /* Make it owned by the module */ + if (hInstance) FarSetOwner( hObj, MODULE_HANDLEtoHMODULE16(hInstance)); + + info = (CURSORICONINFO *)GlobalLock16( hObj ); + info->ptHotSpot.x = hotspot.x; + info->ptHotSpot.y = hotspot.y; + info->nWidth = bmpXor->bitmap.bmWidth; + info->nHeight = bmpXor->bitmap.bmHeight; + info->nWidthBytes = bmpXor->bitmap.bmWidthBytes; + info->bPlanes = bmpXor->bitmap.bmPlanes; + info->bBitsPerPixel = bmpXor->bitmap.bmBitsPixel; + + /* Transfer the bitmap bits to the CURSORICONINFO structure */ + + GetBitmapBits32( hAndBits, sizeAnd, (char *)(info + 1) ); + GetBitmapBits32( hXorBits, sizeXor, (char *)(info + 1) + sizeAnd ); + GlobalUnlock16( hObj ); } - /* Make it owned by the module */ - if (hInstance) FarSetOwner( handle, GetExePtr(hInstance) ); - - info = (CURSORICONINFO *)GlobalLock16( handle ); - info->ptHotSpot.x = hotspot.x; - info->ptHotSpot.y = hotspot.y; - info->nWidth = bmpXor->bitmap.bmWidth; - info->nHeight = bmpXor->bitmap.bmHeight; - info->nWidthBytes = bmpXor->bitmap.bmWidthBytes; - info->bPlanes = bmpXor->bitmap.bmPlanes; - info->bBitsPerPixel = bmpXor->bitmap.bmBitsPixel; - - /* Transfer the bitmap bits to the CURSORICONINFO structure */ - - GetBitmapBits32( hAndBits, sizeAnd, (char *)(info + 1) ); - GetBitmapBits32( hXorBits, sizeXor, (char *)(info + 1) + sizeAnd ); DeleteObject32( hXorBits ); DeleteObject32( hAndBits ); - GlobalUnlock16( handle ); - return handle; + return hObj; } + /********************************************************************** - * CURSORICON_Load + * CreateIconFromResourceEx16 (USER.450) * - * Load a cursor or icon. + * FIXME: not sure about exact parameter types */ -static HGLOBAL16 CURSORICON_Load( HINSTANCE16 hInstance, SEGPTR name, - INT32 width, INT32 height, INT32 colors, - BOOL32 fCursor ) +HICON16 WINAPI CreateIconFromResourceEx16( LPBYTE bits, UINT16 cbSize, BOOL16 bIcon, + DWORD dwVersion, INT16 width, INT16 height, UINT16 cFlag ) { - HGLOBAL16 handle, hRet; + TDB* pTask = (TDB*)GlobalLock16( GetCurrentTask() ); + if( pTask ) + return CURSORICON_CreateFromResource( pTask->hInstance, 0, bits, cbSize, bIcon, dwVersion, + width, height, cFlag ); + return 0; +} + + +/********************************************************************** + * CreateIconFromResourceEx32 (USER32.76) + */ +HICON32 WINAPI CreateIconFromResourceEx32( LPBYTE bits, UINT32 cbSize, + BOOL32 bIcon, DWORD dwVersion, + INT32 width, INT32 height, + UINT32 cFlag ) +{ + return CreateIconFromResourceEx16( bits, cbSize, bIcon, dwVersion, width, height, cFlag ); +} + + +/********************************************************************** + * CURSORICON_Load16 + * + * Load a cursor or icon from a 16-bit resource. + */ +static HGLOBAL16 CURSORICON_Load16( HINSTANCE16 hInstance, SEGPTR name, + INT32 width, INT32 height, INT32 colors, + BOOL32 fCursor ) +{ + HGLOBAL16 handle; HRSRC16 hRsrc; CURSORICONDIRENTRY dirEntry; @@ -396,19 +478,89 @@ static HGLOBAL16 CURSORICON_Load( HINSTANCE16 hInstance, SEGPTR name, /* Find the best entry in the directory */ - if (!CURSORICON_LoadDirEntry( hInstance, name, width, height, - colors, fCursor, &dirEntry )) return 0; - + if ( !CURSORICON_LoadDirEntry16( hInstance, name, width, height, + colors, fCursor, &dirEntry ) ) return 0; /* Load the resource */ - if (!(hRsrc = FindResource16( hInstance, + if ( (hRsrc = FindResource16( hInstance, MAKEINTRESOURCE( dirEntry.icon.wResId ), - fCursor ? RT_CURSOR : RT_ICON ))) return 0; - if (!(handle = LoadResource16( hInstance, hRsrc ))) return 0; + fCursor ? RT_CURSOR : RT_ICON )) ) + { + /* 16-bit icon or cursor resources are processed + * transparently by the LoadResource16() via custom + * resource handlers set by SetResourceHandler(). + */ - hRet = CURSORICON_LoadHandler( handle, hInstance, fCursor ); - FreeResource16(handle); - return hRet; + if ( (handle = LoadResource16( hInstance, hRsrc )) ) + return handle; + } + return 0; +} + +/********************************************************************** + * CURSORICON_Load32 + * + * Load a cursor or icon from a 32-bit resource. + */ +static HGLOBAL32 CURSORICON_Load32( HINSTANCE32 hInstance, LPCWSTR name, + int width, int height, int colors, + BOOL32 fCursor ) +{ + HANDLE32 handle; + HANDLE32 hRsrc; + CURSORICONDIRENTRY dirEntry; + + if(!hInstance) /* OEM cursor/icon */ + { + WORD resid; + if(HIWORD(name)) + { + LPSTR ansi = HEAP_strdupWtoA(GetProcessHeap(),0,name); + if( ansi[0]=='#') /*Check for '#xxx' name */ + { + resid = atoi(ansi+1); + HeapFree( GetProcessHeap(), 0, ansi ); + } + else + { + HeapFree( GetProcessHeap(), 0, ansi ); + return 0; + } + } + else resid = LOWORD(name); + return OBM_LoadCursorIcon(resid, fCursor); + } + + /* Find the best entry in the directory */ + + if ( !CURSORICON_LoadDirEntry32( hInstance, name, width, height, + colors, fCursor, &dirEntry ) ) return 0; + /* Load the resource */ + + if ( (hRsrc = FindResource32W( hInstance, + (LPWSTR) (DWORD) dirEntry.icon.wResId, + (LPWSTR) (fCursor ? RT_CURSOR : RT_ICON ))) ) + { + HANDLE32 h = 0; + if ( (handle = LoadResource32( hInstance, hRsrc )) ) + { + /* Hack to keep LoadCursor/Icon32() from spawning multiple + * copies of the same object. + */ +#define pRsrcEntry ((LPIMAGE_RESOURCE_DATA_ENTRY)hRsrc) + if( !pRsrcEntry->ResourceHandle ) + { + LPBYTE bits = (LPBYTE)LockResource32( handle ); + h = CURSORICON_CreateFromResource( hInstance, 0, bits, dirEntry.icon.dwBytesInRes, + !fCursor, 0x00030000, width, height, LR_DEFAULTCOLOR ); + pRsrcEntry->ResourceHandle = h; + } + else h = pRsrcEntry->ResourceHandle; +#undef pRsrcEntry + } + return h; + } + return 0; } @@ -438,80 +590,86 @@ static HGLOBAL16 CURSORICON_Copy( HINSTANCE16 hInstance, HGLOBAL16 handle ) /*********************************************************************** * CURSORICON_IconToCursor * - * Converts bitmap to mono and truncates if icon is too large + * Converts bitmap to mono and truncates if icon is too large (should + * probably do StretchBlt() instead). */ HCURSOR16 CURSORICON_IconToCursor(HICON16 hIcon, BOOL32 bSemiTransparent) { HCURSOR16 hRet = 0; - CURSORICONINFO *ptr = NULL; + CURSORICONINFO *pIcon = NULL; HTASK16 hTask = GetCurrentTask(); TDB* pTask = (TDB *)GlobalLock16(hTask); if(hIcon && pTask) - if (!(ptr = (CURSORICONINFO*)GlobalLock16( hIcon ))) return FALSE; - if (ptr->bPlanes * ptr->bBitsPerPixel == 1) + if (!(pIcon = (CURSORICONINFO*)GlobalLock16( hIcon ))) return FALSE; + if (pIcon->bPlanes * pIcon->bBitsPerPixel == 1) hRet = CURSORICON_Copy( pTask->hInstance, hIcon ); else { BYTE pAndBits[128]; BYTE pXorBits[128]; - int x, y, ix, iy, shift; - int bpp = (ptr->bBitsPerPixel>=24)?32:ptr->bBitsPerPixel; /* this sucks */ - BYTE* psPtr = (BYTE *)(ptr + 1) + - ptr->nHeight * BITMAP_WIDTH_BYTES(ptr->nWidth,1); - BYTE* pxbPtr = pXorBits; - unsigned *psc = NULL, val = 0; - unsigned val_base = 0xffffffff >> (32 - bpp); + int maxx, maxy, ix, iy, bpp = pIcon->bBitsPerPixel; + BYTE* psPtr, *pxbPtr = pXorBits; + unsigned xor_width, and_width, val_base = 0xffffffff >> (32 - bpp); BYTE* pbc = NULL; COLORREF col; CURSORICONINFO cI; + dprintf_icon(stddeb, "IconToCursor:[%04x] %ix%i %ibpp (bogus %ibps)\n", + hIcon, pIcon->nWidth, pIcon->nHeight, pIcon->bBitsPerPixel, pIcon->nWidthBytes ); + + xor_width = BITMAP_GetBitsWidth( pIcon->nWidth, bpp ); + and_width = BITMAP_GetBitsWidth( pIcon->nWidth, 1 ); + psPtr = (BYTE *)(pIcon + 1) + pIcon->nHeight * and_width; + memset(pXorBits, 0, 128); cI.bBitsPerPixel = 1; cI.bPlanes = 1; cI.ptHotSpot.x = cI.ptHotSpot.y = 15; cI.nWidth = 32; cI.nHeight = 32; - cI.nWidthBytes = 4; /* 1bpp */ + cI.nWidthBytes = 4; /* 32x1bpp */ - x = (ptr->nWidth > 32) ? 32 : ptr->nWidth; - y = (ptr->nHeight > 32) ? 32 : ptr->nHeight; + maxx = (pIcon->nWidth > 32) ? 32 : pIcon->nWidth; + maxy = (pIcon->nHeight > 32) ? 32 : pIcon->nHeight; - for( iy = 0; iy < y; iy++ ) + for( iy = 0; iy < maxy; iy++ ) { - val = BITMAP_WIDTH_BYTES( ptr->nWidth, 1 ); - memcpy( pAndBits + iy * 4, - (BYTE *)(ptr + 1) + iy * val, (val>4) ? 4 : val); - shift = iy % 2; + unsigned shift = iy % 2; - for( ix = 0; ix < x; ix++ ) + memcpy( pAndBits + iy * 4, (BYTE *)(pIcon + 1) + iy * and_width, + (and_width > 4) ? 4 : and_width ); + for( ix = 0; ix < maxx; ix++ ) { if( bSemiTransparent && ((ix+shift)%2) ) { + /* set AND bit, XOR bit stays 0 */ + pbc = pAndBits + iy * 4 + ix/8; *pbc |= 0x80 >> (ix%8); } else { - psc = (unsigned*)(psPtr + (ix * bpp)/8); - val = ((*psc) >> (ix * bpp)%8) & val_base; + /* keep AND bit, set XOR bit */ + + unsigned *psc = (unsigned*)(psPtr + (ix * bpp)/8); + unsigned val = ((*psc) >> (ix * bpp)%8) & val_base; col = COLOR_ToLogical(val); - if( GetRValue(col) > 0xa0 || - GetGValue(col) > 0x80 || - GetBValue(col) > 0xa0 ) + if( (GetRValue(col) + GetGValue(col) + GetBValue(col)) > 0x180 ) { pbc = pxbPtr + ix/8; *pbc |= 0x80 >> (ix%8); } } } - psPtr += ptr->nWidthBytes; + psPtr += xor_width; pxbPtr += 4; } + hRet = CreateCursorIconIndirect( pTask->hInstance , &cI, pAndBits, pXorBits); if( !hRet ) /* fall back on default drag cursor */ hRet = CURSORICON_Copy( pTask->hInstance , - CURSORICON_Load(0,MAKEINTRESOURCE(OCR_DRAGOBJECT), + CURSORICON_Load16(0,MAKEINTRESOURCE(OCR_DRAGOBJECT), SYSMETRICS_CXCURSOR, SYSMETRICS_CYCURSOR, 1, TRUE) ); } @@ -531,8 +689,8 @@ HCURSOR16 WINAPI LoadCursor16( HINSTANCE16 hInstance, SEGPTR name ) dprintf_cursor( stddeb, "LoadCursor16: %04x %04x\n", hInstance, LOWORD(name) ); - return CURSORICON_Load( hInstance, name, - SYSMETRICS_CXCURSOR, SYSMETRICS_CYCURSOR, 1, TRUE); + return CURSORICON_Load16( hInstance, name, + SYSMETRICS_CXCURSOR, SYSMETRICS_CYCURSOR, 1, TRUE); } @@ -548,9 +706,9 @@ HICON16 WINAPI LoadIcon16( HINSTANCE16 hInstance, SEGPTR name ) dprintf_icon( stddeb, "LoadIcon: %04x %04x\n", hInstance, LOWORD(name) ); - return CURSORICON_Load( hInstance, name, - SYSMETRICS_CXICON, SYSMETRICS_CYICON, - MIN( 16, COLOR_GetSystemPaletteSize() ), FALSE ); + return CURSORICON_Load16( hInstance, name, + SYSMETRICS_CXICON, SYSMETRICS_CYICON, + MIN( 16, COLOR_GetSystemPaletteSize() ), FALSE ); } @@ -691,7 +849,7 @@ BOOL32 WINAPI DestroyIcon32( HICON32 hIcon ) { dprintf_icon( stddeb, "DestroyIcon: %04x\n", hIcon ); /* FIXME: should check for OEM icon here */ - return (GlobalFree16( hIcon ) == 0); + return (FreeResource16( hIcon ) == 0); } @@ -711,7 +869,7 @@ BOOL32 WINAPI DestroyCursor32( HCURSOR32 hCursor ) { dprintf_cursor( stddeb, "DestroyCursor: %04x\n", hCursor ); /* FIXME: should check for OEM cursor here */ - return (GlobalFree16( hCursor ) != 0); + return (FreeResource16( hCursor ) != 0); } @@ -1093,6 +1251,53 @@ void WINAPI GetClipCursor32( RECT32 *rect ) if (rect) CopyRect32( rect, &CURSOR_ClipRect ); } +/********************************************************************** + * LookupIconIdFromDirectoryEx16 (USER.364) + * + * FIXME: exact parameter sizes + */ +UINT16 WINAPI LookupIconIdFromDirectoryEx16( CURSORICONDIR *dir, BOOL16 bIcon, + INT16 width, INT16 height, UINT16 cFlag ) +{ + UINT16 retVal = 0; + if( dir && !dir->idReserved && (dir->idType & 3) ) + { + int colors = (cFlag == LR_MONOCHROME) ? 2 : COLOR_GetSystemPaletteSize(); + if( bIcon ) + { + ICONDIRENTRY* entry; + entry = CURSORICON_FindBestIcon( dir, width, height, colors ); + if( entry ) retVal = entry->wResId; + } + else + { + CURSORDIRENTRY* entry; + entry = CURSORICON_FindBestCursor( dir, width, height ); + if( entry ) retVal = entry->wResId; + } + } + else dprintf_cursor(stddeb,"IconId: invalid resource directory\n"); + return retVal; +} + +/********************************************************************** + * LookupIconIdFromDirectoryEx32 (USER32.379) + */ +INT32 WINAPI LookupIconIdFromDirectoryEx32( CURSORICONDIR *dir, BOOL32 bIcon, + INT32 width, INT32 height, UINT32 cFlag ) +{ + return LookupIconIdFromDirectoryEx16( dir, bIcon, width, height, cFlag ); +} + +/********************************************************************** + * LookupIconIdFromDirectory (USER32.378) + */ +INT32 WINAPI LookupIconIdFromDirectory( CURSORICONDIR *dir, BOOL32 bIcon ) +{ + return LookupIconIdFromDirectoryEx16( dir, bIcon, + bIcon ? SYSMETRICS_CXICON : SYSMETRICS_CXCURSOR, + bIcon ? SYSMETRICS_CYICON : SYSMETRICS_CYCURSOR, bIcon ? 0 : LR_MONOCHROME ); +} /********************************************************************** * GetIconID (USER.455) @@ -1100,52 +1305,143 @@ void WINAPI GetClipCursor32( RECT32 *rect ) WORD WINAPI GetIconID( HGLOBAL16 hResource, DWORD resType ) { CURSORICONDIR *lpDir = (CURSORICONDIR *)GlobalLock16(hResource); -/* LockResource16(hResource); */ - - if (!lpDir || lpDir->idReserved || - ((lpDir->idType != 1) && (lpDir->idType != 2))) - { - dprintf_cursor(stddeb,"GetIconID: invalid resource directory\n"); - return 0; - } dprintf_cursor( stddeb, "GetIconID: hRes=%04x, entries=%i\n", - hResource, lpDir->idCount ); + hResource, lpDir ? lpDir->idCount : 0); switch(resType) { - case 1: /* cursor */ - { - CURSORDIRENTRY *entry = CURSORICON_FindBestCursor( lpDir, - SYSMETRICS_CXCURSOR, SYSMETRICS_CYCURSOR ); - return entry ? entry->wResId : 0; - } - case 3: /* icon */ - { - ICONDIRENTRY * entry = CURSORICON_FindBestIcon( lpDir, - SYSMETRICS_CXICON, SYSMETRICS_CYICON, - MIN( 16, COLOR_GetSystemPaletteSize() ) ); - return entry ? entry->wResId : 0; - } + case RT_CURSOR: + return (WORD)LookupIconIdFromDirectoryEx16( lpDir, FALSE, + SYSMETRICS_CXCURSOR, SYSMETRICS_CYCURSOR, LR_MONOCHROME ); + case RT_ICON: + return (WORD)LookupIconIdFromDirectoryEx16( lpDir, TRUE, + SYSMETRICS_CXICON, SYSMETRICS_CYICON, 0 ); + default: + fprintf( stderr, "GetIconID: invalid res type %ld\n", resType ); } - fprintf( stderr, "GetIconID: invalid res type %ld\n", resType ); return 0; } +/********************************************************************** + * LoadCursorIconHandler (USER.336) + * + * Supposed to load resources of Windows 2.x applications. + */ +HGLOBAL16 WINAPI LoadCursorIconHandler( HGLOBAL16 hResource, HMODULE16 hModule, HRSRC16 hRsrc ) +{ + fprintf(stderr,"hModule[%04x]: old 2.x resources are not supported!\n", hModule); + return (HGLOBAL16)0; +} + +/********************************************************************** + * LoadDIBIconHandler (USER.357) + * + * RT_ICON resource loader, installed by USER_SignalProc when module + * is initialized. + */ +HGLOBAL16 WINAPI LoadDIBIconHandler( HGLOBAL16 hMemObj, HMODULE16 hModule, HRSRC16 hRsrc ) +{ + /* If hResource is zero we must allocate a new memory block, if it's + * non-zero but GlobalLock() returns NULL then it was discarded and + * we have to recommit some memory, otherwise we just need to check + * the block size. See LoadProc() in 16-bit SDK for more. + */ + + hMemObj = USER_CallDefaultRsrcHandler( hMemObj, hModule, hRsrc ); + if( hMemObj ) + { + LPBYTE bits = (LPBYTE)GlobalLock16( hMemObj ); + hMemObj = CURSORICON_CreateFromResource( hModule, hMemObj, bits, + SizeofResource16(hModule, hRsrc), TRUE, 0x00030000, + SYSMETRICS_CXICON, SYSMETRICS_CYICON, LR_DEFAULTCOLOR ); + } + return hMemObj; +} + +/********************************************************************** + * LoadDIBCursorHandler (USER.356) + * + * RT_CURSOR resource loader. Same as above. + */ +HGLOBAL16 WINAPI LoadDIBCursorHandler( HGLOBAL16 hMemObj, HMODULE16 hModule, HRSRC16 hRsrc ) +{ + hMemObj = USER_CallDefaultRsrcHandler( hMemObj, hModule, hRsrc ); + if( hMemObj ) + { + LPBYTE bits = (LPBYTE)GlobalLock16( hMemObj ); + hMemObj = CURSORICON_CreateFromResource( hModule, hMemObj, bits, + SizeofResource16(hModule, hRsrc), FALSE, 0x00030000, + SYSMETRICS_CXCURSOR, SYSMETRICS_CYCURSOR, LR_MONOCHROME ); + } + return hMemObj; +} /********************************************************************** * LoadIconHandler (USER.456) */ HICON16 WINAPI LoadIconHandler( HGLOBAL16 hResource, BOOL16 bNew ) { + LPBYTE bits = (LPBYTE)LockResource16( hResource ); + dprintf_cursor(stddeb,"LoadIconHandler: hRes=%04x\n",hResource); - if( !bNew ) - { - fprintf(stdnimp,"LoadIconHandler: 2.xx resources are not supported\n"); - return 0; - } - return CURSORICON_LoadHandler( hResource, 0, FALSE); + return CURSORICON_CreateFromResource( 0, 0, bits, 0, TRUE, + bNew ? 0x00030000 : 0x00020000, 0, 0, LR_DEFAULTCOLOR ); +} + +/*********************************************************************** + * LoadCursorW (USER32.361) + */ +HCURSOR32 WINAPI LoadCursor32W(HINSTANCE32 hInstance, LPCWSTR name) +{ + return CURSORICON_Load32( hInstance, name, + SYSMETRICS_CXCURSOR, SYSMETRICS_CYCURSOR, 1, TRUE); +} + +/*********************************************************************** + * LoadCursorA (USER32.358) + */ +HCURSOR32 WINAPI LoadCursor32A(HINSTANCE32 hInstance, LPCSTR name) +{ + HCURSOR32 res=0; + if(!HIWORD(name)) + return LoadCursor32W(hInstance,(LPCWSTR)name); + else + { + LPWSTR uni = HEAP_strdupAtoW( GetProcessHeap(), 0, name ); + res = LoadCursor32W(hInstance, uni); + HeapFree( GetProcessHeap(), 0, uni); + } + return res; +} + +/*********************************************************************** + * LoadIconW (USER32.363) + */ +HICON32 WINAPI LoadIcon32W(HINSTANCE32 hInstance, LPCWSTR name) +{ + return CURSORICON_Load32( hInstance, name, + SYSMETRICS_CXICON, SYSMETRICS_CYICON, + MIN( 16, COLOR_GetSystemPaletteSize() ), FALSE ); +} + +/*********************************************************************** + * LoadIconA (USER32.362) + */ +HICON32 WINAPI LoadIcon32A(HINSTANCE32 hInstance, LPCSTR name) +{ + HICON32 res=0; + + if( !HIWORD(name) ) + return LoadIcon32W(hInstance, (LPCWSTR)name); + else + { + LPWSTR uni = HEAP_strdupAtoW( GetProcessHeap(), 0, name ); + res = LoadIcon32W( hInstance, uni ); + HeapFree( GetProcessHeap(), 0, uni ); + } + return res; } /********************************************************************** diff --git a/objects/dc.c b/objects/dc.c index 77d3996a9cb..ed3b3fd1345 100644 --- a/objects/dc.c +++ b/objects/dc.c @@ -232,6 +232,16 @@ BOOL32 DC_SetupGCForPatBlt( DC * dc, GC gc, BOOL32 fMapColors ) if (dc->w.flags & DC_DIRTY) CLIPPING_UpdateGCRegion(dc); val.function = DC_XROPfunction[dc->w.ROPmode-1]; + /* + ** Let's replace GXinvert by GXxor with (black xor white) + ** This solves the selection color and leak problems in excel + ** FIXME : Let's do that only if we work with X-pixels, not with Win-pixels + */ + if (val.function == GXinvert) + { + val.foreground = BlackPixelOfScreen(screen) ^ WhitePixelOfScreen(screen); + val.function = GXxor; + } val.fill_style = dc->u.x.brush.fillStyle; switch(val.fill_style) { @@ -338,7 +348,7 @@ BOOL32 DC_SetupGCForPen( DC * dc ) } else val.line_style = LineSolid; val.line_width = dc->u.x.pen.width; - val.cap_style = CapRound; + val.cap_style = (val.line_width <= 1) ? CapNotLast : CapRound; val.join_style = JoinMiter; XChangeGC( display, dc->u.x.gc, GCFunction | GCForeground | GCBackground | GCLineWidth | diff --git a/objects/dib.c b/objects/dib.c index 9746225152a..5035ec34aa3 100644 --- a/objects/dib.c +++ b/objects/dib.c @@ -299,13 +299,13 @@ static void DIB_SetImageBits_4( DWORD lines, const BYTE *srcbits, while (lines--) { - for (i = srcwidth/2, x = 0; i > 0; i--) + for (i = dstwidth/2, x = 0; i > 0; i--) { BYTE pix = *bits++; XPutPixel( bmpImage, x++, lines, colors[pix >> 4] ); XPutPixel( bmpImage, x++, lines, colors[pix & 0x0f] ); } - if (srcwidth & 1) XPutPixel( bmpImage, x, lines, colors[*bits >> 4] ); + if (dstwidth & 1) XPutPixel( bmpImage, x, lines, colors[*bits >> 4] ); srcbits += linebytes; bits = srcbits; } @@ -1125,3 +1125,15 @@ HBITMAP32 WINAPI CreateDIBitmap32( HDC32 hdc, const BITMAPINFOHEADER *header, SetDIBits32( hdc, handle, 0, height, bits, data, coloruse ); return handle; } + +HBITMAP32 CreateDIBSection( + HDC32 hdc,BITMAPINFO *bmi,UINT32 usage, LPVOID **bits,HANDLE32 section, + DWORD offset +) { + fprintf(stderr,"CreateDIBSection(%d,[w=%ld,h=%ld],%d,%p,0x%08x,%ld),stub\n", + hdc,bmi->bmiHeader.biWidth,bmi->bmiHeader.biHeight,usage,bits,section,offset + ); + *bits = 0xCafeBabe; + return 0; +} + diff --git a/objects/font.c b/objects/font.c index 216962f701d..941881a157a 100644 --- a/objects/font.c +++ b/objects/font.c @@ -804,11 +804,12 @@ BOOL32 WINAPI GetTextMetrics32A( HDC32 hdc, TEXTMETRIC32A *metrics ) } if (!dc->funcs->pGetTextMetrics || - !dc->funcs->pGetTextMetrics( dc,metrics )) + !dc->funcs->pGetTextMetrics( dc, metrics )) return FALSE; - /* map them from device to logic coordinatesystem before returning. - * FIXME: should this be in the device driver? - */ + + /* device layer returns values in device units + * therefore we have to convert them to logical */ + #define WDPTOLP(x) ((x<0)? \ (-abs((x)*dc->wndExtX/dc->vportExtX)): \ (abs((x)*dc->wndExtX/dc->vportExtX))) diff --git a/objects/metafile.c b/objects/metafile.c index ad8622aff48..ba27f44f03d 100644 --- a/objects/metafile.c +++ b/objects/metafile.c @@ -727,16 +727,16 @@ void WINAPI PlayMetaFileRecord16( HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr, case META_CREATEREGION: { int i; - HRGN32 h1,h2,hrgn=CreateRectRgn32(mr->rdParam[7],mr->rdParam[8], - mr->rdParam[9],mr->rdParam[10]); - for (i=0,h1=CreateRectRgn32(0,0,0,0);irdParam[5];i++) + HRGN32 h2,hrgn=CreateRectRgn32(mr->rdParam[7],mr->rdParam[8], + mr->rdParam[9],mr->rdParam[10]); + for (i = 0; i < mr->rdParam[5]; i++) { if (mr->rdParam[11+i*6]==2) { h2=CreateRectRgn32(mr->rdParam[14+i*6],mr->rdParam[12+i*6], mr->rdParam[15+i*6],mr->rdParam[13+i*6]); - CombineRgn32(hrgn,h1,h2,mr->rdParam[16+i*6]); /* e.g. RGN_OR */ - h1=hrgn; + CombineRgn32(hrgn,hrgn,h2,mr->rdParam[16+i*6]); /* e.g. RGN_OR */ + DeleteObject32( h2 ); } } MF_AddHandle(ht, nHandles,hrgn); diff --git a/objects/text.c b/objects/text.c index 1b4683023a3..7e66e563f4f 100644 --- a/objects/text.c +++ b/objects/text.c @@ -254,7 +254,7 @@ INT16 WINAPI DrawText16( HDC16 hdc, LPCSTR str, INT16 i_count, HPEN32 hpen = CreatePen32( PS_SOLID, 1, GetTextColor32(hdc) ); HPEN32 oldPen = SelectObject32( hdc, hpen ); MoveTo(hdc, x + prefix_x, y + tm.tmAscent + 1 ); - LineTo32(hdc, x + prefix_end, y + tm.tmAscent + 1 ); + LineTo32(hdc, x + prefix_end + 1, y + tm.tmAscent + 1 ); SelectObject32( hdc, oldPen ); DeleteObject32( hpen ); } @@ -312,6 +312,31 @@ INT32 WINAPI DrawText32W( HDC32 hdc, LPCWSTR str, INT32 count, return ret; } +/*********************************************************************** + * DrawTextEx32A (USER32.164) + */ +INT32 DrawTextEx32A( HDC32 hdc, LPCSTR str, INT32 count, + LPRECT32 rect, UINT32 flags, LPDRAWTEXTPARAMS dtp ) +{ + fprintf(stderr,"DrawTextEx32A(%d,'%s',%d,%p,0x%08x,%p)\n", + hdc,str,count,rect,flags,dtp + ); + /*FIXME: ignores extended functionality ... */ + return DrawText32A(hdc,str,count,rect,flags); +} + +/*********************************************************************** + * DrawTextEx32W (USER32.165) + */ +INT32 DrawTextEx32W( HDC32 hdc, LPCWSTR str, INT32 count, + LPRECT32 rect, UINT32 flags, LPDRAWTEXTPARAMS dtp ) +{ + fprintf(stderr,"DrawTextEx32A(%d,%p,%d,%p,0x%08x,%p)\n", + hdc,str,count,rect,flags,dtp + ); + /*FIXME: ignores extended functionality ... */ + return DrawText32W(hdc,str,count,rect,flags); +} /*********************************************************************** * ExtTextOut16 (GDI.351) diff --git a/scheduler/process.c b/scheduler/process.c index 28195620962..25087fafda4 100644 --- a/scheduler/process.c +++ b/scheduler/process.c @@ -22,7 +22,7 @@ PDB32 *pCurrentProcess = NULL; #define HTABLE_SIZE 0x30 /* Handle table initial size */ #define HTABLE_INC 0x10 /* Handle table increment */ -#define BOOT_HTABLE_SIZE 5 +#define BOOT_HTABLE_SIZE 10 static HANDLE_ENTRY boot_handles[BOOT_HTABLE_SIZE]; @@ -146,6 +146,7 @@ HANDLE32 PROCESS_AllocHandle( K32OBJ *ptr, DWORD flags ) if ((h < pCurrentProcess->handle_table->count) || PROCESS_GrowHandleTable( pCurrentProcess )) { + entry = &pCurrentProcess->handle_table->entries[h]; entry->flags = flags; entry->ptr = ptr; LeaveCriticalSection( &pCurrentProcess->crit_section ); @@ -251,7 +252,7 @@ static int pstr_cmp( const void *ps1, const void *ps2 ) /*********************************************************************** * PROCESS_FillEnvDB */ -static BOOL32 PROCESS_FillEnvDB( PDB32 *pdb, TDB *pTask ) +static BOOL32 PROCESS_FillEnvDB( PDB32 *pdb, TDB *pTask, LPCSTR cmd_line ) { LPSTR p, env; INT32 count = 0; @@ -278,9 +279,15 @@ static BOOL32 PROCESS_FillEnvDB( PDB32 *pdb, TDB *pTask ) HeapFree( pdb->heap, 0, array ); array = NULL; + /* Copy the command line */ + + if (!(pdb->env_db->cmd_line = HEAP_strdupA( pdb->heap, 0, cmd_line ))) + goto error; + return TRUE; error: + if (pdb->env_db->cmd_line) HeapFree( pdb->heap, 0, pdb->env_db->cmd_line ); if (array) HeapFree( pdb->heap, 0, array ); if (pdb->env_db->environ) HeapFree( pdb->heap, 0, pdb->env_db->environ ); return FALSE; @@ -290,7 +297,7 @@ error: /*********************************************************************** * PROCESS_Create */ -PDB32 *PROCESS_Create( TDB *pTask ) +PDB32 *PROCESS_Create( TDB *pTask, LPCSTR cmd_line ) { PDB32 *pdb = HeapAlloc( SystemHeap, HEAP_ZERO_MEMORY, sizeof(PDB32) ); if (!pdb) return NULL; @@ -310,7 +317,7 @@ PDB32 *PROCESS_Create( TDB *pTask ) if (!(pdb->env_db = HeapAlloc(pdb->heap, HEAP_ZERO_MEMORY, sizeof(ENVDB)))) goto error; if (!(pdb->handle_table = PROCESS_AllocHandleTable( pdb ))) goto error; - if (!PROCESS_FillEnvDB( pdb, pTask )) goto error; + if (!PROCESS_FillEnvDB( pdb, pTask, cmd_line )) goto error; return pdb; error: @@ -352,6 +359,7 @@ void PROCESS_Destroy( K32OBJ *ptr ) */ void WINAPI ExitProcess( DWORD status ) { + __RESTORE_ES; /* Necessary for Pietrek's showseh example program */ TASK_KillCurrentTask( status ); } diff --git a/scheduler/thread.c b/scheduler/thread.c index 7d1bbe2feeb..c350aee47ca 100644 --- a/scheduler/thread.c +++ b/scheduler/thread.c @@ -16,6 +16,7 @@ #include "stddebug.h" THDB *pCurrentThread = NULL; +static K32OBJ_LIST THREAD_List; /*********************************************************************** * THREAD_GetPtr @@ -29,7 +30,7 @@ static THDB *THREAD_GetPtr( HANDLE32 handle ) if (handle == 0xfffffffe) /* Self-thread handle */ { - thread = (THDB *)GetCurrentThreadId(); + thread = THREAD_Current(); K32OBJ_IncCount( &thread->header ); } else thread = (THDB *)PROCESS_GetObjPtr( handle, K32OBJ_THREAD ); @@ -37,6 +38,19 @@ static THDB *THREAD_GetPtr( HANDLE32 handle ) } +/*********************************************************************** + * THREAD_Current + * + * Return the current thread THDB pointer. + */ +THDB *THREAD_Current(void) +{ + /* FIXME: should probably use %fs register here */ + assert( pCurrentThread ); + return pCurrentThread; +} + + /*********************************************************************** * THREAD_Create */ @@ -88,6 +102,10 @@ THDB *THREAD_Create( PDB32 *pdb, DWORD stack_size, thdb->context.Eip = (DWORD)start_addr; thdb->context.Esp = (DWORD)thdb->teb.stack_top; + /* Add the thread to the linked list */ + + K32OBJ_AddTail( &THREAD_List, &thdb->header ); + return thdb; error: @@ -104,10 +122,42 @@ error: void THREAD_Destroy( K32OBJ *ptr ) { THDB *thdb = (THDB *)ptr; + assert( ptr->type == K32OBJ_THREAD ); ptr->type = K32OBJ_UNKNOWN; + + /* Note: when we get here, the thread has already been removed */ + /* from the thread list */ + + /* Free the associated memory */ + SELECTOR_FreeBlock( thdb->teb_sel, 1 ); HeapFree( SystemHeap, 0, thdb ); + +} + + +/*********************************************************************** + * THREAD_SwitchThread + * + * Return the thread we want to switch to, and switch the contexts. + */ +THDB *THREAD_SwitchThread( CONTEXT *context ) +{ + K32OBJ *cur; + THDB *next; + if (!pCurrentThread) return NULL; + cur = K32OBJ_RemoveHead( &THREAD_List ); + K32OBJ_AddTail( &THREAD_List, cur ); + K32OBJ_DecCount( cur ); + next = (THDB *)THREAD_List.head; + if (next != pCurrentThread) + { + pCurrentThread->context = *context; + pCurrentThread = next; + *context = pCurrentThread->context; + } + return pCurrentThread; } @@ -150,9 +200,7 @@ HANDLE32 WINAPI GetCurrentThread(void) */ DWORD WINAPI GetCurrentThreadId(void) { - /* FIXME: should probably use %fs register here */ - assert( pCurrentThread ); - return (DWORD)pCurrentThread; + return (DWORD)THREAD_Current(); } @@ -161,7 +209,7 @@ DWORD WINAPI GetCurrentThreadId(void) */ DWORD WINAPI GetLastError(void) { - THDB *thread = (THDB *)GetCurrentThreadId(); + THDB *thread = THREAD_Current(); return thread->last_error; } @@ -173,7 +221,7 @@ void WINAPI SetLastError( DWORD error ) { THDB *thread; if (!pCurrentThread) return; /* FIXME */ - thread = (THDB *)GetCurrentThreadId(); + thread = THREAD_Current(); thread->last_error = error; } @@ -194,7 +242,7 @@ void WINAPI SetLastErrorEx( DWORD error, DWORD type ) DWORD WINAPI TlsAlloc(void) { DWORD i, mask, ret = 0; - THDB *thread = (THDB *)GetCurrentThreadId(); + THDB *thread = THREAD_Current(); DWORD *bits = thread->process->tls_bits; EnterCriticalSection( &thread->process->crit_section ); if (*bits == 0xffffffff) @@ -221,7 +269,7 @@ DWORD WINAPI TlsAlloc(void) BOOL32 WINAPI TlsFree( DWORD index ) { DWORD mask; - THDB *thread = (THDB *)GetCurrentThreadId(); + THDB *thread = THREAD_Current(); DWORD *bits = thread->process->tls_bits; if (index >= 64) { @@ -250,7 +298,7 @@ BOOL32 WINAPI TlsFree( DWORD index ) */ LPVOID WINAPI TlsGetValue( DWORD index ) { - THDB *thread = (THDB *)GetCurrentThreadId(); + THDB *thread = THREAD_Current(); if (index >= 64) { SetLastError( ERROR_INVALID_PARAMETER ); @@ -266,7 +314,7 @@ LPVOID WINAPI TlsGetValue( DWORD index ) */ BOOL32 WINAPI TlsSetValue( DWORD index, LPVOID value ) { - THDB *thread = (THDB *)GetCurrentThreadId(); + THDB *thread = THREAD_Current(); if (index >= 64) { SetLastError( ERROR_INVALID_PARAMETER ); @@ -335,3 +383,26 @@ BOOL32 WINAPI TerminateThread(DWORD threadid,DWORD exitcode) fprintf(stdnimp,"TerminateThread(0x%08lx,%ld), STUB!\n",threadid,exitcode); return TRUE; } + +/********************************************************************** + * GetExitCodeThread (KERNEL32) + */ +BOOL32 WINAPI GetExitCodeThread(HANDLE32 hthread,LPDWORD exitcode) +{ + THDB *thread; + + if (!(thread = THREAD_GetPtr( hthread ))) return FALSE; + if (exitcode) *exitcode = thread->exit_code; + K32OBJ_DecCount( &thread->header ); + return TRUE; +} + +/********************************************************************** + * ResumeThread (KERNEL32) + */ +BOOL32 WINAPI ResumeThread(DWORD threadid) +{ + fprintf(stdnimp,"ResumeThread(0x%08lx), STUB!\n",threadid); + return TRUE; +} + diff --git a/tools/build-spec.txt b/tools/build-spec.txt index 8d731485d04..cf796214c25 100644 --- a/tools/build-spec.txt +++ b/tools/build-spec.txt @@ -61,16 +61,14 @@ by the ordinal number corresponding to the function. - "register" for a function using CPU register to pass arguments - "stdcall" for a normal Win32 function - "cdecl" for a Win32 function using the C calling convention +- "varargs" for a Win32 function taking a variable number of arguments "ARGTYPE" should be one of: -- "byte" - "word" - "long" - "ptr" (linear pointer) - "str" (linear pointer to a null-terminated string) -- "s_byte" (signed byte) - "s_word" (signed word) -- "s_long" (signed long) - "segptr" (segmented pointer). - "segstr" (segmented pointer to a null-terminated string) @@ -91,11 +89,11 @@ call (the ordinal 100 is just an example): 100 pascal GetFocus() WIN_GetFocus() -To declare a function using a variable number of arguments, specify -the function as taking no arguments. In this special case, in Win32 -the called function will be passed a pointer to the first arg; in -Win16, the args are available with CURRENT_STACK16->args. See the -wsprintf* functions in user.spec and user32.spec for an example. +To declare a function using a variable number of arguments in Win16, +specify the function as taking no arguments. The arguments are then +available with CURRENT_STACK16->args. In Win32, specify the function +as 'varargs' and declare it with a '...' parameter in the C file. See +the wsprintf* functions in user.spec and user32.spec for an example. Stub ordinals: ============== diff --git a/tools/build.c b/tools/build.c index 327a8e8f533..18032722c0d 100644 --- a/tools/build.c +++ b/tools/build.c @@ -43,6 +43,7 @@ typedef enum TYPE_STUB, /* unimplemented stub */ TYPE_STDCALL, /* stdcall function (Win32) */ TYPE_CDECL, /* cdecl function (Win32) */ + TYPE_VARARGS, /* varargs function (Win32) */ TYPE_EXTERN, /* external symbol (Win32) */ TYPE_NBTYPES } ORD_TYPE; @@ -61,6 +62,7 @@ static const char * const TypeNames[TYPE_NBTYPES] = "stub", /* TYPE_STUB */ "stdcall", /* TYPE_STDCALL */ "cdecl", /* TYPE_CDECL */ + "varargs", /* TYPE_VARARGS */ "extern" /* TYPE_EXTERN */ }; @@ -101,6 +103,11 @@ typedef struct int value; } ORD_ABS; +typedef struct +{ + char link_name[80]; +} ORD_VARARGS; + typedef struct { char link_name[80]; @@ -118,6 +125,7 @@ typedef struct ORD_FUNCTION func; ORD_RETURN ret; ORD_ABS abs; + ORD_VARARGS vargs; ORD_EXTERN ext; } u; } ORDDEF; @@ -128,8 +136,9 @@ static SPEC_TYPE SpecType = SPEC_INVALID; static char DLLName[80]; static char DLLFileName[80]; int Limit = 0; -int Base = 0; +int Base = MAX_ORDINALS; int DLLHeapSize = 0; +char *SpecName; FILE *SpecFp; char *ParseBuffer = NULL; @@ -231,9 +240,9 @@ static char * GetToken(void) { ParseBuffer = xmalloc(512); ParseNext = ParseBuffer; - Line++; while (1) { + Line++; if (fgets(ParseBuffer, 511, SpecFp) == NULL) return NULL; if (ParseBuffer[0] != '#') @@ -244,9 +253,9 @@ static char * GetToken(void) while ((token = GetTokenInLine()) == NULL) { ParseNext = ParseBuffer; - Line++; while (1) { + Line++; if (fgets(ParseBuffer, 511, SpecFp) == NULL) return NULL; if (ParseBuffer[0] != '#') @@ -273,7 +282,8 @@ static int ParseVariable( ORDDEF *odp ) char *token = GetToken(); if (*token != '(') { - fprintf(stderr, "%d: Expected '(' got '%s'\n", Line, token); + fprintf(stderr, "%s:%d: Expected '(' got '%s'\n", + SpecName, Line, token); return -1; } @@ -296,15 +306,16 @@ static int ParseVariable( ORDDEF *odp ) if (endptr == NULL || *endptr != '\0') { - fprintf(stderr, "%d: Expected number value, got '%s'\n", Line, - token); + fprintf(stderr, "%s:%d: Expected number value, got '%s'\n", + SpecName, Line, token); return -1; } } if (token == NULL) { - fprintf(stderr, "%d: End of file in variable declaration\n", Line); + fprintf(stderr, "%s:%d: End of file in variable declaration\n", + SpecName, Line); return -1; } @@ -330,19 +341,22 @@ static int ParseExportFunction( ORDDEF *odp ) case SPEC_WIN16: if (odp->type == TYPE_STDCALL) { - fprintf( stderr, "%d: 'stdcall' not supported for Win16\n", Line ); + fprintf( stderr, "%s:%d: 'stdcall' not supported for Win16\n", + SpecName, Line ); return -1; } if (odp->type == TYPE_CDECL) { - fprintf( stderr, "%d: 'cdecl' not supported for Win16\n", Line ); + fprintf( stderr, "%s:%d: 'cdecl' not supported for Win16\n", + SpecName, Line ); return -1; } break; case SPEC_WIN32: if ((odp->type == TYPE_PASCAL) || (odp->type == TYPE_PASCAL_16)) { - fprintf( stderr, "%d: 'pascal' not supported for Win32\n", Line ); + fprintf( stderr, "%s:%d: 'pascal' not supported for Win32\n", + SpecName, Line ); return -1; } break; @@ -353,7 +367,8 @@ static int ParseExportFunction( ORDDEF *odp ) token = GetToken(); if (*token != '(') { - fprintf(stderr, "%d: Expected '(' got '%s'\n", Line, token); + fprintf(stderr, "%s:%d: Expected '(' got '%s'\n", + SpecName, Line, token); return -1; } @@ -363,9 +378,9 @@ static int ParseExportFunction( ORDDEF *odp ) if (*token == ')') break; - if (!strcmp(token, "byte") || !strcmp(token, "word")) + if (!strcmp(token, "word")) odp->u.func.arg_types[i] = 'w'; - else if (!strcmp(token, "s_byte") || !strcmp(token, "s_word")) + else if (!strcmp(token, "s_word")) odp->u.func.arg_types[i] = 's'; else if (!strcmp(token, "long") || !strcmp(token, "segptr")) odp->u.func.arg_types[i] = 'l'; @@ -375,24 +390,32 @@ static int ParseExportFunction( ORDDEF *odp ) odp->u.func.arg_types[i] = 't'; else if (!strcmp(token, "segstr")) odp->u.func.arg_types[i] = 'T'; + else if (!strcmp(token, "double")) + { + odp->u.func.arg_types[i++] = 'l'; + odp->u.func.arg_types[i] = 'l'; + } else { - fprintf(stderr, "%d: Unknown variable type '%s'\n", Line, token); + fprintf(stderr, "%s:%d: Unknown variable type '%s'\n", + SpecName, Line, token); return -1; } if (SpecType == SPEC_WIN32) { - if (strcmp(token, "long") && strcmp(token, "ptr")) + if (strcmp(token, "long") && + strcmp(token, "ptr") && + strcmp(token, "double")) { - fprintf( stderr, "%d: Type '%s' not supported for Win32\n", - Line, token ); + fprintf( stderr, "%s:%d: Type '%s' not supported for Win32\n", + SpecName, Line, token ); return -1; } } } - if (*token != ')') + if ((*token != ')') || (i >= sizeof(odp->u.func.arg_types))) { - fprintf( stderr, "%d: Too many arguments\n", Line ); + fprintf( stderr, "%s:%d: Too many arguments\n", SpecName, Line ); return -1; } odp->u.func.arg_types[i] = '\0'; @@ -416,8 +439,8 @@ static int ParseEquate( ORDDEF *odp ) int value = strtol(token, &endptr, 0); if (endptr == NULL || *endptr != '\0') { - fprintf(stderr, "%d: Expected number value, got '%s'\n", Line, - token); + fprintf(stderr, "%s:%d: Expected number value, got '%s'\n", + SpecName, Line, token); return -1; } @@ -440,8 +463,8 @@ static int ParseReturn( ORDDEF *odp ) odp->u.ret.arg_size = strtol(token, &endptr, 0); if (endptr == NULL || *endptr != '\0') { - fprintf(stderr, "%d: Expected number value, got '%s'\n", Line, - token); + fprintf(stderr, "%s:%d: Expected number value, got '%s'\n", + SpecName, Line, token); return -1; } @@ -449,8 +472,8 @@ static int ParseReturn( ORDDEF *odp ) odp->u.ret.ret_value = strtol(token, &endptr, 0); if (endptr == NULL || *endptr != '\0') { - fprintf(stderr, "%d: Expected number value, got '%s'\n", Line, - token); + fprintf(stderr, "%s:%d: Expected number value, got '%s'\n", + SpecName, Line, token); return -1; } @@ -471,6 +494,42 @@ static int ParseStub( ORDDEF *odp ) } +/******************************************************************* + * ParseVarargs + * + * Parse an 'varargs' definition. + */ +static int ParseVarargs( ORDDEF *odp ) +{ + char *token; + + if (SpecType == SPEC_WIN16) + { + fprintf( stderr, "%s:%d: 'varargs' not supported for Win16\n", + SpecName, Line ); + return -1; + } + + token = GetToken(); + if (*token != '(') + { + fprintf(stderr, "%s:%d: Expected '(' got '%s'\n", + SpecName, Line, token); + return -1; + } + token = GetToken(); + if (*token != ')') + { + fprintf(stderr, "%s:%d: Expected ')' got '%s'\n", + SpecName, Line, token); + return -1; + } + + strcpy( odp->u.vargs.link_name, GetToken() ); + return 0; +} + + /******************************************************************* * ParseExtern * @@ -480,7 +539,8 @@ static int ParseExtern( ORDDEF *odp ) { if (SpecType == SPEC_WIN16) { - fprintf( stderr, "%d: 'extern' not supported for Win16\n", Line ); + fprintf( stderr, "%s:%d: 'extern' not supported for Win16\n", + SpecName, Line ); return -1; } strcpy( odp->u.ext.link_name, GetToken() ); @@ -500,15 +560,16 @@ static int ParseOrdinal(int ordinal) if (ordinal >= MAX_ORDINALS) { - fprintf(stderr, "%d: Ordinal number too large\n", Line); + fprintf(stderr, "%s:%d: Ordinal number too large\n", SpecName, Line ); return -1; } if (ordinal > Limit) Limit = ordinal; + if (ordinal < Base) Base = ordinal; odp = &OrdinalDefinitions[ordinal]; if (!(token = GetToken())) { - fprintf(stderr, "%d: Expected type after ordinal\n", Line); + fprintf(stderr, "%s:%d: Expected type after ordinal\n", SpecName, Line); return -1; } @@ -519,14 +580,14 @@ static int ParseOrdinal(int ordinal) if (odp->type >= TYPE_NBTYPES) { fprintf( stderr, - "%d: Expected type after ordinal, found '%s' instead\n", - Line, token ); + "%s:%d: Expected type after ordinal, found '%s' instead\n", + SpecName, Line, token ); return -1; } if (!(token = GetToken())) { - fprintf( stderr, "%d: Expected name after type\n", Line ); + fprintf( stderr, "%s:%d: Expected name after type\n", SpecName, Line ); return -1; } strcpy( odp->name, token ); @@ -550,6 +611,8 @@ static int ParseOrdinal(int ordinal) return ParseReturn( odp ); case TYPE_STUB: return ParseStub( odp ); + case TYPE_VARARGS: + return ParseVarargs( odp ); case TYPE_EXTERN: return ParseExtern( odp ); default: @@ -588,26 +651,18 @@ static int ParseTopLevel(void) else if (!strcmp(token, "win32" )) SpecType = SPEC_WIN32; else { - fprintf(stderr, "%d: Type must be 'win16' or 'win32'\n", Line); + fprintf(stderr, "%s:%d: Type must be 'win16' or 'win32'\n", + SpecName, Line); return -1; } } - else if (strcmp(token, "base") == 0) - { - token = GetToken(); - if (!IsNumberString(token)) - { - fprintf(stderr, "%d: Expected number after base\n", Line); - return -1; - } - Base = atoi(token); - } else if (strcmp(token, "heap") == 0) { token = GetToken(); if (!IsNumberString(token)) { - fprintf(stderr, "%d: Expected number after heap\n", Line); + fprintf(stderr, "%s:%d: Expected number after heap\n", + SpecName, Line); return -1; } DLLHeapSize = atoi(token); @@ -624,7 +679,8 @@ static int ParseTopLevel(void) else { fprintf(stderr, - "%d: Expected name, id, length or ordinal\n", Line); + "%s:%d: Expected name, id, length or ordinal\n", + SpecName, Line); return -1; } } @@ -1009,8 +1065,7 @@ static int BuildSpec32File( char * specfile, FILE *outfile ) fprintf( outfile, "\t.align 4\n" ); fprintf( outfile, "Code_Start:\n\n" ); - odp = OrdinalDefinitions; - for (i = 0; i <= Limit; i++, odp++) + for (i = Base, odp = OrdinalDefinitions + Base; i <= Limit; i++, odp++) { switch (odp->type) { @@ -1091,6 +1146,7 @@ static int BuildSpec32File( char * specfile, FILE *outfile ) fprintf( outfile, "\t.text\n" ); break; + case TYPE_VARARGS: case TYPE_EXTERN: break; @@ -1103,19 +1159,49 @@ static int BuildSpec32File( char * specfile, FILE *outfile ) module_size = BuildModule32( outfile ); - /* Output the DLL functions table */ + /* Output the DLL functions table for no debugging code */ fprintf( outfile, "\t.text\n" ); fprintf( outfile, "\t.align 4\n" ); - fprintf( outfile, "Functions:\n" ); - odp = OrdinalDefinitions; - for (i = 0; i <= Limit; i++, odp++) + fprintf( outfile, "NoDbg_Functions:\n" ); + for (i = Base, odp = OrdinalDefinitions + Base; i <= Limit; i++, odp++) { switch(odp->type) { case TYPE_INVALID: fprintf( outfile, "\t.long 0\n" ); break; + case TYPE_VARARGS: + fprintf( outfile, "\t.long " PREFIX "%s\n",odp->u.vargs.link_name); + break; + case TYPE_EXTERN: + fprintf( outfile, "\t.long " PREFIX "%s\n", odp->u.ext.link_name ); + break; + case TYPE_STDCALL: + case TYPE_CDECL: + fprintf( outfile, "\t.long " PREFIX "%s\n", odp->u.func.link_name); + break; + default: + fprintf( outfile, "\t.long %s_%d\n", DLLName, i ); + break; + } + } + + /* Output the DLL functions table for debugging code */ + + fprintf( outfile, "\t.text\n" ); + fprintf( outfile, "\t.align 4\n" ); + fprintf( outfile, "Functions:\n" ); + for (i = Base, odp = OrdinalDefinitions + Base; i <= Limit; i++, odp++) + { + switch(odp->type) + { + case TYPE_INVALID: + fprintf( outfile, "\t.long 0\n" ); + break; + case TYPE_VARARGS: + fprintf( outfile, "\t.long " PREFIX "%s\n",odp->u.vargs.link_name); + break; case TYPE_EXTERN: fprintf( outfile, "\t.long " PREFIX "%s\n", odp->u.ext.link_name ); break; @@ -1128,8 +1214,7 @@ static int BuildSpec32File( char * specfile, FILE *outfile ) /* Output the DLL names table */ fprintf( outfile, "FuncNames:\n" ); - odp = OrdinalDefinitions; - for (i = 0; i <= Limit; i++, odp++) + for (i = Base, odp = OrdinalDefinitions + Base; i <= Limit; i++, odp++) { if (odp->type == TYPE_INVALID) fprintf( outfile, "\t.long 0\n" ); else fprintf( outfile, "\t.long Name_%d\n", i ); @@ -1137,7 +1222,7 @@ static int BuildSpec32File( char * specfile, FILE *outfile ) /* Output the DLL names */ - for (i = 0, odp = OrdinalDefinitions; i <= Limit; i++, odp++) + for (i = Base, odp = OrdinalDefinitions + Base; i <= Limit; i++, odp++) { if (odp->type != TYPE_INVALID) fprintf( outfile, "Name_%d:\t.ascii \"%s\\0\"\n", i, odp->name ); @@ -1153,9 +1238,10 @@ static int BuildSpec32File( char * specfile, FILE *outfile ) fprintf( outfile, "\t.long Module_Start\n" ); /* Module start */ fprintf( outfile, "\t.long %d\n", module_size ); /* Module size */ fprintf( outfile, "\t.long %d\n", Base ); /* Base */ - fprintf( outfile, "\t.long %d\n", Limit+1 ); /* Size */ + fprintf( outfile, "\t.long %d\n", Limit+1-Base ); /* Size */ fprintf( outfile, "\t.long Code_Start\n" ); /* Code start */ fprintf( outfile, "\t.long Functions\n" ); /* Functions */ + fprintf( outfile, "\t.long NoDbg_Functions\n" ); /* Funcs without debug*/ fprintf( outfile, "\t.long FuncNames\n" ); /* Function names */ #ifdef USE_STABS fprintf( outfile, "\t.text\n"); @@ -1297,6 +1383,7 @@ static int BuildSpec16File( char * specfile, FILE *outfile ) */ static int BuildSpecFile( FILE *outfile, char *specname ) { + SpecName = specname; SpecFp = fopen( specname, "r"); if (SpecFp == NULL) { @@ -1672,7 +1759,7 @@ static void BuildCallFrom16Func( FILE *outfile, char *profile ) /* Setup %ebp to point to the previous stack frame (built by CallTo16) */ - fprintf( outfile, "\taddl $24,%%ebp\n" ); + fprintf( outfile, "\taddl $32,%%ebp\n" ); /* Print the debug information before the call */ @@ -1695,6 +1782,14 @@ static void BuildCallFrom16Func( FILE *outfile, char *profile ) if (debugging) { + if (reg_func) + { + /* Push again the address of the context struct in case */ + /* it has been removed by an stdcall function */ + fprintf( outfile, "\tleal -%d(%%ebp),%%esp\n", + sizeof(CONTEXT) + 32 ); + fprintf( outfile, "\tpushl %%esp\n" ); + } fprintf( outfile, "\tpushl %%eax\n" ); fprintf( outfile, "\tpushl $%d\n", reg_func ? 2 : (short_ret ? 1 : 0)); fprintf( outfile, "\tcall " PREFIX "RELAY_DebugCallFrom16Ret\n" ); @@ -1702,6 +1797,13 @@ static void BuildCallFrom16Func( FILE *outfile, char *profile ) fprintf( outfile, "\tpopl %%eax\n" ); } +#if 0 + /* Restore the value of the saved 32-bit stack pointer */ + + fprintf( outfile, "\tleal -32(%%ebp),%%edx\n" ); + fprintf( outfile, "movl %%edx," PREFIX "IF1632_Saved32_esp\n" ); +#endif + /* Restore the 16-bit stack */ #ifdef __svr4__ @@ -1785,26 +1887,28 @@ static void BuildCallFrom16Func( FILE *outfile, char *profile ) * * Stack frame of the callback function: * ... ... - * (ebp+20) arg2 - * (ebp+16) arg1 - * (ebp+12) func to call - * (ebp+8) code selector + * (ebp+16) arg2 + * (ebp+12) arg1 + * (ebp+8) func to call * (ebp+4) return address * (ebp) previous ebp * * Prototypes for the CallTo16 functions: - * extern WORD CallTo16_word_xxx( FARPROC16 func, args... ); - * extern LONG CallTo16_long_xxx( FARPROC16 func, args... ); - * extern void CallTo16_regs_( const CONTEXT *context ); + * extern WINAPI WORD CallTo16_word_xxx( FARPROC16 func, args... ); + * extern WINAPI LONG CallTo16_long_xxx( FARPROC16 func, args... ); + * extern WINAPI LONG CallTo16_wndp_xxx( FARPROC16 func, args... ); + * extern WINAPI void CallTo16_regs_( const CONTEXT *context ); */ static void BuildCallTo16Func( FILE *outfile, char *profile ) { + int window_proc = 0; int short_ret = 0; int reg_func = 0; char *args = profile + 5; if (!strncmp( "word_", profile, 5 )) short_ret = 1; else if (!strncmp( "regs_", profile, 5 )) reg_func = short_ret = 1; + else if (!strncmp( "wndp_", profile, 5 )) window_proc = 1; else if (strncmp( "long_", profile, 5 )) { fprintf( stderr, "Invalid function name '%s', ignored\n", profile ); @@ -1821,19 +1925,33 @@ static void BuildCallTo16Func( FILE *outfile, char *profile ) fprintf( outfile, "\t.globl " PREFIX "CallTo16_%s\n", profile ); fprintf( outfile, PREFIX "CallTo16_%s:\n", profile ); - /* Push code selector before return address to simulate a lcall */ - - fprintf( outfile, "\tpopl %%eax\n" ); - fprintf( outfile, "\tpushl $0x%04x\n", WINE_CODE_SELECTOR ); - fprintf( outfile, "\tpushl %%eax\n" ); - /* Entry code */ fprintf( outfile, "\tpushl %%ebp\n" ); fprintf( outfile, "\tmovl %%esp,%%ebp\n" ); + /* Call the actual CallTo16 routine (simulate a lcall) */ + + fprintf( outfile, "\tpushw $0\n" ); + fprintf( outfile, "\tpushw %%cs\n" ); + fprintf( outfile, "\tcall do_callto16_%s\n", profile ); + + /* Exit code */ + + /* FIXME: this is a hack because of task.c */ + if (!strcmp( profile, "word_" )) + { + fprintf( outfile, ".globl " PREFIX "CALLTO16_Restore\n" ); + fprintf( outfile, PREFIX "CALLTO16_Restore:\n" ); + } + fprintf( outfile, "\tpopl %%ebp\n" ); + fprintf( outfile, "\tret $%d\n", strlen(args) + 1 ); + + /* Start of the actual CallTo16 routine */ + /* Save the 32-bit registers */ + fprintf( outfile, "do_callto16_%s:\n", profile ); fprintf( outfile, "\tpushl %%ebx\n" ); fprintf( outfile, "\tpushl %%ecx\n" ); fprintf( outfile, "\tpushl %%edx\n" ); @@ -1851,7 +1969,7 @@ static void BuildCallTo16Func( FILE *outfile, char *profile ) if (debugging) { /* Push the address of the first argument */ - fprintf( outfile, "\tleal 12(%%ebx),%%eax\n" ); + fprintf( outfile, "\tleal 8(%%ebx),%%eax\n" ); fprintf( outfile, "\tpushl $%d\n", reg_func ? -1 : strlen(args) ); fprintf( outfile, "\tpushl %%eax\n" ); fprintf( outfile, "\tcall " PREFIX "RELAY_DebugCallTo16\n" ); @@ -1872,7 +1990,7 @@ static void BuildCallTo16Func( FILE *outfile, char *profile ) if (reg_func) { /* Get the registers. ebx is handled later on. */ - fprintf( outfile, "\tmovl 12(%%ebx),%%ebx\n" ); + fprintf( outfile, "\tmovl 8(%%ebx),%%ebx\n" ); fprintf( outfile, "\tmovl %d(%%ebx),%%eax\n", CONTEXTOFFSET(SegEs) ); fprintf( outfile, "\tmovw %%ax,%%es\n" ); fprintf( outfile, "\tmovl %d(%%ebx),%%ebp\n", CONTEXTOFFSET(Ebp) ); @@ -1884,7 +2002,7 @@ static void BuildCallTo16Func( FILE *outfile, char *profile ) } else /* not a register function */ { - int pos = 16; /* first argument position */ + int pos = 12; /* first argument position */ /* Make %bp point to the previous stackframe (built by CallFrom16) */ fprintf( outfile, "\tmovzwl %%sp,%%ebp\n" ); @@ -1931,15 +2049,17 @@ static void BuildCallTo16Func( FILE *outfile, char *profile ) { /* Push the called routine address */ - fprintf( outfile, "\tpushl 12(%%ebx)\n" ); + fprintf( outfile, "\tpushl 8(%%ebx)\n" ); - /* Get previous ds from the 16-bit stack and */ - /* set ax equal to ds for window procedures. */ - fprintf( outfile, "\tmovw -10(%%ebp),%%ax\n" ); -#ifdef __svr4__ - fprintf( outfile, "\tdata16\n"); -#endif - fprintf( outfile, "\tmovw %%ax,%%ds\n" ); + if( window_proc ) + { + /* set ax to hInstance and initialize es and ds to ss */ + + fprintf( outfile, "\tmovw -10(%%ebp),%%ax\n" ); + fprintf( outfile, "\tmovw %%ss, %%cx\n" ); + fprintf( outfile, "\tmovw %%cx, %%ds\n" ); + fprintf( outfile, "\tmovw %%cx, %%es\n" ); + } } /* Jump to the called routine */ @@ -1962,9 +2082,9 @@ static void BuildRet16Func( FILE *outfile ) /* Put return value into eax */ fprintf( outfile, PREFIX "CALLTO16_Ret_long:\n" ); - fprintf( outfile, "\tpushw %%dx\n" ); - fprintf( outfile, "\tpushw %%ax\n" ); - fprintf( outfile, "\tpopl %%eax\n" ); + fprintf( outfile, "\tshll $16,%%edx\n" ); + fprintf( outfile, "\tmovw %%ax,%%dx\n" ); + fprintf( outfile, "\tmovl %%edx,%%eax\n" ); fprintf( outfile, PREFIX "CALLTO16_Ret_word:\n" ); /* Restore 32-bit segment registers */ @@ -1998,7 +2118,7 @@ static void BuildRet16Func( FILE *outfile ) /* Return to caller */ - fprintf( outfile, "\tpopl %%ebp\n" ); +/* fprintf( outfile, "\tpopl %%ebp\n" );*/ fprintf( outfile, "\tlret\n" ); /* Declare the return address variables */ @@ -2170,19 +2290,6 @@ static void BuildCallFrom32Func( FILE *outfile, const char *profile ) fprintf( outfile, "\t.globl " PREFIX "CallFrom32_%s\n", profile ); fprintf( outfile, PREFIX "CallFrom32_%s:\n", profile ); -#if 0 - fprintf( outfile, "\tleal 8(%%esp),%%ebp\n" ); - fprintf( outfile, "\tpushl $%d\n", /* Nb args */ - reg_func ? args | 0x80000000 : args); - fprintf( outfile, "\tpushl %%ebp\n" ); - fprintf( outfile, "\tcall " PREFIX "RELAY_DebugCallFrom32\n" ); - fprintf( outfile, "\tadd $8, %%esp\n" ); - fprintf( outfile, "\tpopl %%eax\n" ); - fprintf( outfile, "\tpopl %%eax\n" ); - fprintf( outfile, "\tpopl %%ebp\n" ); - fprintf( outfile, "\tjmp %%eax\n" ); -#endif - /* Entry code */ fprintf( outfile, "\tleal 8(%%esp),%%ebp\n" ); @@ -2205,10 +2312,12 @@ static void BuildCallFrom32Func( FILE *outfile, const char *profile ) fprintf( outfile, "\tpushl %%eax\n" ); } +#if 0 /* Set %es = %ds */ fprintf( outfile, "\tmovw %%ds,%%ax\n" ); fprintf( outfile, "\tmovw %%ax,%%es\n" ); +#endif /* Print the debugging info */ @@ -2311,7 +2420,8 @@ static void BuildCallTo32Func( FILE *outfile, int args ) fprintf( outfile, "\tmovl %%ebp,%%esp\n" ); fprintf( outfile, "\tpopl %%ebp\n" ); - fprintf( outfile, "\tret\n" ); + if (args) fprintf( outfile, "\tret $%d\n", args ); + else fprintf( outfile, "\tret\n" ); } diff --git a/win32/Makefile.in b/win32/Makefile.in index 834ad6247de..b83223cc48b 100644 --- a/win32/Makefile.in +++ b/win32/Makefile.in @@ -9,7 +9,6 @@ C_SRCS = \ advapi.c \ code_page.c \ console.c \ - cursoricon32.c \ environment.c \ error.c \ except.c \ diff --git a/win32/cursoricon32.c b/win32/cursoricon32.c deleted file mode 100644 index b5516630e95..00000000000 --- a/win32/cursoricon32.c +++ /dev/null @@ -1,514 +0,0 @@ -/* - * Cursor and icon support - * - * Copyright 1995 Alexandre Julliard - * Copyright 1996 Martin von Loewis - */ - -/* - * Theory: - * - * Cursors and icons are stored in a global heap block, with the - * following layout: - * - * CURSORICONINFO info; - * BYTE[] ANDbits; - * BYTE[] XORbits; - * - * The bits structures are in the format of a device-dependent bitmap. - * - * This layout is very sub-optimal, as the bitmap bits are stored in - * the X client instead of in the server like other bitmaps; however, - * some programs (notably Paint Brush) expect to be able to manipulate - * the bits directly :-( - */ - -#include -#include -#include "windows.h" -#include "callback.h" -#include "cursoricon.h" -#include "sysmetrics.h" -#include "win.h" -#include "bitmap.h" -#include "struct32.h" -#include "heap.h" -#include "task.h" -#include "stddebug.h" -#include "debug.h" -#include "xmalloc.h" - -/* This dictionary could might eventually become a macro for better reuse */ -struct MAP_DWORD_DWORD -{ - DWORD key; - HANDLE32 value; -}; - -struct MAP_DWORD_DWORD *CURSORICON_map; -int CURSORICON_count; - -BOOL32 CURSORICON_lookup(DWORD key,HANDLE32 *value) -{ - int i; - for(i=0;iidCount < 1) - { - fprintf( stderr, "Icon: empty directory!\n" ); - return NULL; - } - if (dir->idCount == 1) return &dir->idEntries[0].icon; /* No choice... */ - - /* First find the exact size with less colors */ - - maxcolors = 0; - for (i = 0, entry = &dir->idEntries[0].icon; i < dir->idCount; i++,entry++) - if ((entry->bWidth == width) && (entry->bHeight == height) && - (entry->bColorCount <= colors) && (entry->bColorCount > maxcolors)) - { - bestEntry = entry; - maxcolors = entry->bColorCount; - } - if (bestEntry) return bestEntry; - - /* First find the exact size with more colors */ - - maxcolors = 255; - for (i = 0, entry = &dir->idEntries[0].icon; i < dir->idCount; i++,entry++) - if ((entry->bWidth == width) && (entry->bHeight == height) && - (entry->bColorCount > colors) && (entry->bColorCount <= maxcolors)) - { - bestEntry = entry; - maxcolors = entry->bColorCount; - } - if (bestEntry) return bestEntry; - - /* Now find a smaller one with less colors */ - - maxcolors = maxwidth = maxheight = 0; - for (i = 0, entry = &dir->idEntries[0].icon; i < dir->idCount; i++,entry++) - if ((entry->bWidth <= width) && (entry->bHeight <= height) && - (entry->bWidth >= maxwidth) && (entry->bHeight >= maxheight) && - (entry->bColorCount <= colors) && (entry->bColorCount > maxcolors)) - { - bestEntry = entry; - maxwidth = entry->bWidth; - maxheight = entry->bHeight; - maxcolors = entry->bColorCount; - } - if (bestEntry) return bestEntry; - - /* Now find a smaller one with more colors */ - - maxcolors = 255; - maxwidth = maxheight = 0; - for (i = 0, entry = &dir->idEntries[0].icon; i < dir->idCount; i++,entry++) - if ((entry->bWidth <= width) && (entry->bHeight <= height) && - (entry->bWidth >= maxwidth) && (entry->bHeight >= maxheight) && - (entry->bColorCount > colors) && (entry->bColorCount <= maxcolors)) - { - bestEntry = entry; - maxwidth = entry->bWidth; - maxheight = entry->bHeight; - maxcolors = entry->bColorCount; - } - if (bestEntry) return bestEntry; - - /* Now find a larger one with less colors */ - - maxcolors = 0; - maxwidth = maxheight = 255; - for (i = 0, entry = &dir->idEntries[0].icon; i < dir->idCount; i++,entry++) - if ((entry->bWidth <= maxwidth) && (entry->bHeight <= maxheight) && - (entry->bColorCount <= colors) && (entry->bColorCount > maxcolors)) - { - bestEntry = entry; - maxwidth = entry->bWidth; - maxheight = entry->bHeight; - maxcolors = entry->bColorCount; - } - if (bestEntry) return bestEntry; - - /* Now find a larger one with more colors */ - - maxcolors = maxwidth = maxheight = 255; - for (i = 0, entry = &dir->idEntries[0].icon; i < dir->idCount; i++,entry++) - if ((entry->bWidth <= maxwidth) && (entry->bHeight <= maxheight) && - (entry->bColorCount > colors) && (entry->bColorCount <= maxcolors)) - { - bestEntry = entry; - maxwidth = entry->bWidth; - maxheight = entry->bHeight; - maxcolors = entry->bColorCount; - } - - return bestEntry; -} - - -/********************************************************************** - * CURSORICON32_FindBestCursor - * - * Find the cursor closest to the requested size. - */ -static CURSORDIRENTRY32 *CURSORICON32_FindBestCursor( CURSORICONDIR32 *dir, - int width, int height ) -{ - int i, maxwidth, maxheight; - CURSORDIRENTRY32 *entry, *bestEntry = NULL; - - if (dir->idCount < 1) - { - fprintf( stderr, "Cursor: empty directory!\n" ); - return NULL; - } - if (dir->idCount == 1) return &dir->idEntries[0].cursor; /* No choice... */ - - /* First find the largest one smaller than or equal to the requested size*/ - - maxwidth = maxheight = 0; - for(i = 0,entry = &dir->idEntries[0].cursor; i < dir->idCount; i++,entry++) - if ((entry->wWidth <= width) && (entry->wHeight <= height) && - (entry->wWidth > maxwidth) && (entry->wHeight > maxheight)) - { - bestEntry = entry; - maxwidth = entry->wWidth; - maxheight = entry->wHeight; - } - if (bestEntry) return bestEntry; - - /* Now find the smallest one larger than the requested size */ - - maxwidth = maxheight = 255; - for(i = 0,entry = &dir->idEntries[0].cursor; i < dir->idCount; i++,entry++) - if ((entry->wWidth < maxwidth) && (entry->wHeight < maxheight)) - { - bestEntry = entry; - maxwidth = entry->wWidth; - maxheight = entry->wHeight; - } - - return bestEntry; -} - - -/********************************************************************** - * CURSORICON32_LoadDirEntry - * - * Load the icon/cursor directory for a given resource name and find the - * best matching entry. - */ -static BOOL32 CURSORICON32_LoadDirEntry(HINSTANCE32 hInstance, LPCWSTR name, - int width, int height, int colors, - BOOL32 fCursor, CURSORICONDIRENTRY32 *dirEntry) -{ - HANDLE32 hRsrc; - HANDLE32 hMem; - CURSORICONDIR32 *dir; - CURSORICONDIRENTRY32 *entry = NULL; - - if (!(hRsrc = FindResource32W( hInstance, name, - (LPCWSTR)(fCursor ? RT_GROUP_CURSOR : RT_GROUP_ICON) ))) - return FALSE; - if (!(hMem = LoadResource32( hInstance, hRsrc ))) return FALSE; - if ((dir = (CURSORICONDIR32 *)LockResource32( hMem ))) - { - if (fCursor) - entry = (CURSORICONDIRENTRY32 *)CURSORICON32_FindBestCursor( dir, - width, height ); - else - entry = (CURSORICONDIRENTRY32 *)CURSORICON32_FindBestIcon( dir, - width, height, colors ); - if (entry) *dirEntry = *entry; - } - FreeResource32( hMem ); - return (entry != NULL); -} - - -/********************************************************************** - * CURSORICON32_LoadHandler - * - * Create a cursor or icon from a resource. - */ -static HGLOBAL32 CURSORICON32_LoadHandler( HANDLE32 handle, - HINSTANCE32 hInstance, - BOOL32 fCursor ) -{ - HBITMAP32 hAndBits, hXorBits; - HGLOBAL32 hRes; - HDC32 hdc; - int size, sizeAnd, sizeXor; - POINT16 hotspot = { 0 ,0 }; - BITMAPOBJ *bmpXor, *bmpAnd; - BITMAPINFO *bmi, *pInfo; - CURSORICONINFO *info; - char *bits; - - hRes=0; - if (fCursor) /* If cursor, get the hotspot */ - { - POINT16 *pt = (POINT16 *)LockResource32( handle ); - hotspot = *pt; - bmi = (BITMAPINFO *)(pt + 1); - } - else bmi = (BITMAPINFO *)LockResource32( handle ); - - /* Create a copy of the bitmap header */ - - size = DIB_BitmapInfoSize( bmi, DIB_RGB_COLORS ); - /* Make sure we have room for the monochrome bitmap later on */ - size = MAX( size, sizeof(BITMAPINFOHEADER) + 2*sizeof(RGBQUAD) ); - pInfo = (BITMAPINFO *)xmalloc( size ); - memcpy( pInfo, bmi, size ); - - if (pInfo->bmiHeader.biSize == sizeof(BITMAPINFOHEADER)) - { - if (pInfo->bmiHeader.biCompression != BI_RGB) - { - fprintf(stderr,"Unknown size for compressed icon bitmap.\n"); - free( pInfo ); - return 0; - } - pInfo->bmiHeader.biHeight /= 2; - } - else if (pInfo->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) - { - BITMAPCOREHEADER *core = (BITMAPCOREHEADER *)pInfo; - core->bcHeight /= 2; - } - else - { - fprintf( stderr, "CURSORICON32_Load: Unknown bitmap length %ld!\n", - pInfo->bmiHeader.biSize ); - free( pInfo ); - return 0; - } - - /* Create the XOR bitmap */ - - if (!(hdc = GetDC32( 0 ))) - { - free( pInfo ); - return 0; - } - - hXorBits = CreateDIBitmap32( hdc, &pInfo->bmiHeader, CBM_INIT, - (char*)bmi + size, pInfo, DIB_RGB_COLORS ); - - /* Fix the bitmap header to load the monochrome mask */ - - if (pInfo->bmiHeader.biSize == sizeof(BITMAPINFOHEADER)) - { - BITMAPINFOHEADER *bih = &pInfo->bmiHeader; - RGBQUAD *rgb = pInfo->bmiColors; - bits = (char *)bmi + size + - DIB_GetDIBWidthBytes(bih->biWidth,bih->biBitCount)*bih->biHeight; - bih->biBitCount = 1; - bih->biClrUsed = bih->biClrImportant = 2; - rgb[0].rgbBlue = rgb[0].rgbGreen = rgb[0].rgbRed = 0x00; - rgb[1].rgbBlue = rgb[1].rgbGreen = rgb[1].rgbRed = 0xff; - rgb[0].rgbReserved = rgb[1].rgbReserved = 0; - } - else - { - BITMAPCOREHEADER *bch = (BITMAPCOREHEADER *)pInfo; - RGBTRIPLE *rgb = (RGBTRIPLE *)(bch + 1); - bits = (char *)bmi + size + - DIB_GetDIBWidthBytes(bch->bcWidth,bch->bcBitCount)*bch->bcHeight; - bch->bcBitCount = 1; - rgb[0].rgbtBlue = rgb[0].rgbtGreen = rgb[0].rgbtRed = 0x00; - rgb[1].rgbtBlue = rgb[1].rgbtGreen = rgb[1].rgbtRed = 0xff; - } - - /* Create the AND bitmap */ - - hAndBits = CreateDIBitmap32( hdc, &pInfo->bmiHeader, CBM_INIT, - bits, pInfo, DIB_RGB_COLORS ); - ReleaseDC32( 0, hdc ); - - /* Now create the CURSORICONINFO structure */ - - bmpXor = (BITMAPOBJ *) GDI_GetObjPtr( hXorBits, BITMAP_MAGIC ); - bmpAnd = (BITMAPOBJ *) GDI_GetObjPtr( hAndBits, BITMAP_MAGIC ); - sizeXor = bmpXor->bitmap.bmHeight * bmpXor->bitmap.bmWidthBytes; - sizeAnd = bmpAnd->bitmap.bmHeight * bmpAnd->bitmap.bmWidthBytes; - - if (!(hRes = GlobalAlloc16( GMEM_MOVEABLE, - sizeof(CURSORICONINFO) + sizeXor + sizeAnd))) - { - DeleteObject32( hXorBits ); - DeleteObject32( hAndBits ); - return 0; - } - - /* Make it owned by the module */ - if (hInstance) FarSetOwner( hRes, (WORD)(DWORD)GetExePtr(hInstance) ); - - info = (CURSORICONINFO *)GlobalLock16( hRes ); - info->ptHotSpot.x = hotspot.x; - info->ptHotSpot.y = hotspot.y; - info->nWidth = bmpXor->bitmap.bmWidth; - info->nHeight = bmpXor->bitmap.bmHeight; - info->nWidthBytes = bmpXor->bitmap.bmWidthBytes; - info->bPlanes = bmpXor->bitmap.bmPlanes; - info->bBitsPerPixel = bmpXor->bitmap.bmBitsPixel; - - /* Transfer the bitmap bits to the CURSORICONINFO structure */ - - GetBitmapBits32( hAndBits, sizeAnd, (char *)(info + 1) ); - GetBitmapBits32( hXorBits, sizeXor, (char *)(info + 1) + sizeAnd ); - DeleteObject32( hXorBits ); - DeleteObject32( hAndBits ); - GlobalUnlock16( hRes ); - return hRes; -} - -/********************************************************************** - * CURSORICON32_Load - * - * Load a cursor or icon. - */ -static HGLOBAL32 CURSORICON32_Load( HINSTANCE32 hInstance, LPCWSTR name, - int width, int height, int colors, - BOOL32 fCursor ) -{ - HANDLE32 handle; - HANDLE32 hRet; - HANDLE32 hRsrc; - CURSORICONDIRENTRY32 dirEntry; - - if(!hInstance) /* OEM cursor/icon */ - { - WORD resid; - if(HIWORD(name)) - { - LPSTR ansi = HEAP_strdupWtoA(GetProcessHeap(),0,name); - if(ansi[0]=='#') /*Check for '#xxx' name */ - { - resid = atoi(ansi+1); - HeapFree( GetProcessHeap(), 0, ansi ); - } - else - { - HeapFree( GetProcessHeap(), 0, ansi ); - return 0; - } - } - else resid = LOWORD(name); - return OBM_LoadCursorIcon(resid, fCursor); - } - - /* Find the best entry in the directory */ - - if (!CURSORICON32_LoadDirEntry( hInstance, name, width, height, - colors, fCursor, &dirEntry )) return 0; - - /* Load the resource */ - - if (!(hRsrc = FindResource32W( hInstance, - (LPWSTR) (DWORD) dirEntry.icon.wResId, - (LPWSTR) (fCursor ? RT_CURSOR : RT_ICON )))) return 0; - if (!(handle = LoadResource32( hInstance, hRsrc ))) return 0; - - /* Use the resource handle as key to detect multiple loading */ - if(CURSORICON_lookup(handle,&hRet)) - return hRet; - - hRet = CURSORICON32_LoadHandler( handle, hInstance, fCursor ); - /* Obsolete - FreeResource32(handle);*/ - CURSORICON_insert(handle,hRet); - return hRet; -} - - -/*********************************************************************** - * LoadCursorW (USER32.361) - */ -HCURSOR32 WINAPI LoadCursor32W(HINSTANCE32 hInstance,LPCWSTR name) -{ - return CURSORICON32_Load( hInstance, name, - SYSMETRICS_CXCURSOR, SYSMETRICS_CYCURSOR, 1, TRUE); -} - -/*********************************************************************** - * LoadCursorA (USER32.358) - */ -HCURSOR32 WINAPI LoadCursor32A(HINSTANCE32 hInstance,LPCSTR name) -{ - HCURSOR32 res=0; - if(!HIWORD(name)) - return LoadCursor32W(hInstance,(LPCWSTR)name); - else - { - LPWSTR uni = HEAP_strdupAtoW( GetProcessHeap(), 0, name ); - res = LoadCursor32W(hInstance, uni); - HeapFree( GetProcessHeap(), 0, uni); - } - return res; -} - - -/*********************************************************************** - * LoadIconW (USER32.363) - */ -HICON32 WINAPI LoadIcon32W(HINSTANCE32 hInstance,LPCWSTR name) -{ - return CURSORICON32_Load( hInstance, name, - SYSMETRICS_CXICON, SYSMETRICS_CYICON, - MIN( 16, 1 << screenDepth ), FALSE ); -} - -/*********************************************************************** - * LoadIconA (USER32.362) - */ -HICON32 WINAPI LoadIcon32A(HINSTANCE32 hInstance,LPCSTR name) -{ - HICON32 res=0; - if(!HIWORD(name)) - return LoadIcon32W(hInstance, (LPCWSTR)name); - else - { - LPWSTR uni = HEAP_strdupAtoW( GetProcessHeap(), 0, name ); - res = LoadIcon32W( hInstance, uni ); - HeapFree( GetProcessHeap(), 0, uni ); - } - return res; -} - diff --git a/win32/environment.c b/win32/environment.c index cbe6259caa5..1d676f81d8d 100644 --- a/win32/environment.c +++ b/win32/environment.c @@ -24,7 +24,8 @@ LPCSTR WINAPI GetCommandLine32A(void) char *cp; PDB *pdb = (PDB *)GlobalLock16( GetCurrentPDB() ); - lstrcpyn32A( buffer, MODULE_GetModuleName( GetExePtr(GetCurrentTask()) ), + /* FIXME: should use pCurrentProcess->env_db->cmd_line here */ + lstrcpyn32A( buffer, MODULE_GetModuleName(GetCurrentTask()), sizeof(buffer) - 1 ); cp = buffer + strlen(buffer); if (pdb->cmdLine[0]) diff --git a/win32/file.c b/win32/file.c index 79b75c64903..23cfeccda89 100644 --- a/win32/file.c +++ b/win32/file.c @@ -239,7 +239,7 @@ BOOL32 WINAPI SetFileAttributes32W(LPCWSTR lpFileName, DWORD attributes) */ VOID WINAPI SetFileApisToOEM(void) { - fprintf(stdnimp,"SetFileApisToOEM(),stub!\n"); + /*fprintf(stdnimp,"SetFileApisToOEM(),stub!\n");*/ } @@ -248,7 +248,7 @@ VOID WINAPI SetFileApisToOEM(void) */ VOID WINAPI SetFileApisToANSI(void) { - fprintf(stdnimp,"SetFileApisToANSI(),stub!\n"); + /*fprintf(stdnimp,"SetFileApisToANSI(),stub!\n");*/ } diff --git a/win32/init.c b/win32/init.c index 80a8191784f..ed836ed7272 100644 --- a/win32/init.c +++ b/win32/init.c @@ -18,35 +18,6 @@ #include "debug.h" #include "xmalloc.h" -/*********************************************************************** - * GetModuleHandle (KERNEL32.237) - */ -HMODULE32 WINAPI WIN32_GetModuleHandleA(char *module) -{ - HMODULE32 hModule; - - dprintf_win32(stddeb, "GetModuleHandleA: %s\n", module ? module : "NULL"); -/* Freecell uses the result of GetModuleHandleA(0) as the hInstance in -all calls to e.g. CreateWindowEx. */ - if (module == NULL) { - TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() ); - hModule = pTask->hInstance; - } else - hModule = GetModuleHandle16(module); - dprintf_win32(stddeb, "GetModuleHandleA: returning %d\n", hModule ); - return hModule; -} - -HMODULE32 WINAPI WIN32_GetModuleHandleW(LPCWSTR module) -{ - HMODULE32 hModule; - LPSTR modulea = HEAP_strdupWtoA( GetProcessHeap(), 0, module ); - hModule = WIN32_GetModuleHandleA( modulea ); - HeapFree( GetProcessHeap(), 0, modulea ); - return hModule; -} - - /*********************************************************************** * GetStartupInfoA (KERNEL32.273) */ diff --git a/win32/k32obj.c b/win32/k32obj.c index 944ecd7bf25..9eb1b8cc986 100644 --- a/win32/k32obj.c +++ b/win32/k32obj.c @@ -89,6 +89,80 @@ void K32OBJ_DecCount( K32OBJ *ptr ) } +/*********************************************************************** + * K32OBJ_AddHead + * + * Add an object at the head of the list and increment its ref count. + */ +void K32OBJ_AddHead( K32OBJ_LIST *list, K32OBJ *ptr ) +{ + K32OBJ_ENTRY *entry = HeapAlloc( SystemHeap, 0, sizeof(*entry) ); + assert(entry); + K32OBJ_IncCount( ptr ); + entry->obj = ptr; + if ((entry->next = list->head) != NULL) entry->next->prev = entry; + else list->tail = entry; + entry->prev = NULL; + list->head = entry; +} + + +/*********************************************************************** + * K32OBJ_AddTail + * + * Add an object at the tail of the list and increment its ref count. + */ +void K32OBJ_AddTail( K32OBJ_LIST *list, K32OBJ *ptr ) +{ + K32OBJ_ENTRY *entry = HeapAlloc( SystemHeap, 0, sizeof(*entry) ); + assert(entry); + K32OBJ_IncCount( ptr ); + entry->obj = ptr; + if ((entry->prev = list->tail) != NULL) entry->prev->next = entry; + else list->head = entry; + entry->next = NULL; + list->tail = entry; +} + + +/*********************************************************************** + * K32OBJ_Remove + * + * Remove an object from the list and decrement its ref count. + */ +void K32OBJ_Remove( K32OBJ_LIST *list, K32OBJ *ptr ) +{ + K32OBJ_ENTRY *entry = list->head; + while ((entry && (entry->obj != ptr))) entry = entry->next; + assert(entry); + if (entry->next) entry->next->prev = entry->prev; + else list->tail = entry->prev; + if (entry->prev) entry->prev->next = entry->next; + else list->head = entry->next; + HeapFree( SystemHeap, 0, entry ); + K32OBJ_DecCount( ptr ); +} + + +/*********************************************************************** + * K32OBJ_RemoveHead + * + * Remove the head of the list; its ref count is NOT decremented. + */ +K32OBJ *K32OBJ_RemoveHead( K32OBJ_LIST *list ) +{ + K32OBJ *ptr; + K32OBJ_ENTRY *entry = list->head; + assert(entry); + assert(!entry->prev); + if ((list->head = entry->next) != NULL) entry->next->prev = NULL; + else list->tail = NULL; + ptr = entry->obj; + HeapFree( SystemHeap, 0, entry ); + return ptr; +} + + /*********************************************************************** * K32OBJ_AddName * diff --git a/win32/newfns.c b/win32/newfns.c index f8477fce3b9..7954e72439d 100644 --- a/win32/newfns.c +++ b/win32/newfns.c @@ -13,6 +13,30 @@ at a later date. */ #include "stddebug.h" #include "debug.h" +/**************************************************************************** + * UTRegister (KERNEL32.697) + */ +BOOL32 WINAPI UTRegister(HMODULE32 hModule, + LPSTR lpsz16BITDLL, + LPSTR lpszInitName, + LPSTR lpszProcName, + /*UT32PROC*/ LPVOID *ppfn32Thunk, + /*FARPROC*/ LPVOID pfnUT32CallBack, + LPVOID lpBuff) +{ + fprintf(stdnimp, "UTRegister Stub called!\n"); + return TRUE; +} + +/**************************************************************************** + * UTUnRegister (KERNEL32.698) + */ +BOOL32 WINAPI UTUnRegister(HMODULE32 hModule) +{ + fprintf(stdnimp, "UTUnRegister Stub called!\n"); + return TRUE; +} + /**************************************************************************** * QueryPerformanceCounter (KERNEL32.415) */ @@ -23,14 +47,3 @@ BOOL32 WINAPI QueryPerformanceCounter(LPLARGE_INTEGER counter) counter->HighPart = 0; return TRUE; } - -/**************************************************************************** - * DisableThreadLibraryCalls (KERNEL32.74) - * Don't call DllEntryPoint for DLL_THREAD_{ATTACH,DETACH} if set. - */ -BOOL32 WINAPI DisableThreadLibraryCalls(HMODULE32 hModule) -{ - fprintf(stdnimp, "DisableThreadLibraryCalls Stub called!\n"); - return TRUE; -} - diff --git a/win32/process.c b/win32/process.c index ff4f2c5bc98..6820269d9cc 100644 --- a/win32/process.c +++ b/win32/process.c @@ -364,56 +364,6 @@ BOOL32 WINAPI DuplicateHandle(HANDLE32 a, HANDLE32 b, HANDLE32 c, HANDLE32 * d, return TRUE; } -HINSTANCE32 WINAPI LoadLibraryEx32A(LPCSTR libname,HFILE32 hfile,DWORD flags) -{ - fprintf(stderr,"LoadLibraryEx32A(%s,%d,0x%08lx)\n",libname,hfile,flags); - return LoadLibrary32A(libname); -} - -/*********************************************************************** - * LoadLibraryA (KERNEL32.365) - * copied from LoadLibrary - * This does not currently support built-in libraries - */ -HINSTANCE32 WINAPI LoadLibrary32A(LPCSTR libname) -{ - HINSTANCE32 handle; - dprintf_module( stddeb, "LoadLibrary: (%08x) %s\n", (int)libname, libname); - handle = LoadModule16( libname, (LPVOID)-1 ); - if (handle == (HINSTANCE32) -1) - { - char buffer[256]; - strcpy( buffer, libname ); - strcat( buffer, ".dll" ); - handle = LoadModule16( buffer, (LPVOID)-1 ); - } - /* Obtain module handle and call initialization function */ -#ifndef WINELIB - if (handle >= (HINSTANCE32)32) PE_InitializeDLLs( GetExePtr(handle), DLL_PROCESS_ATTACH, NULL); -#endif - return handle; -} - -/*********************************************************************** - * LoadLibrary32W (KERNEL32.368) - */ -HINSTANCE32 WINAPI LoadLibrary32W(LPCWSTR libnameW) -{ - LPSTR libnameA = HEAP_strdupWtoA( GetProcessHeap(), 0, libnameW ); - HINSTANCE32 ret = LoadLibrary32A( libnameA ); - HeapFree( GetProcessHeap(), 0, libnameA ); - return ret; -} - -/*********************************************************************** - * FreeLibrary - */ -BOOL32 WINAPI FreeLibrary32(HINSTANCE32 hLibModule) -{ - fprintf(stderr,"FreeLibrary: empty stub\n"); - return TRUE; -} - /********************************************************************** * GetProcessAffinityMask */ @@ -462,7 +412,9 @@ BOOL32 WINAPI CreateProcess32A( appname,cmdline,processattributes,threadattributes, inherithandles,creationflags,env,curdir,startupinfo,processinfo ); - return TRUE; + /* make from lcc uses system as fallback if CreateProcess returns + FALSE, so return false */ + return FALSE; } BOOL32 WINAPI ContinueDebugEvent(DWORD pid,DWORD tid,DWORD contstatus) { diff --git a/windows/class.c b/windows/class.c index e6422e939ae..ca349f0c7fa 100644 --- a/windows/class.c +++ b/windows/class.c @@ -210,14 +210,13 @@ void CLASS_FreeModuleClasses( HMODULE16 hModule ) * CLASS_FindClassByAtom * * Return a pointer to the class. + * hinstance has been normalized by the caller. */ -CLASS *CLASS_FindClassByAtom( ATOM atom, HINSTANCE16 hinstance ) +CLASS *CLASS_FindClassByAtom( ATOM atom, HINSTANCE32 hinstance ) { CLASS * class; - if (hinstance != 0xffff) hinstance = GetExePtr(hinstance); - - /* First search task-specific classes */ + /* First search task-specific classes */ for (class = firstClass; (class); class = class->next) { @@ -308,8 +307,7 @@ ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc ) { ATOM atom; CLASS *classPtr; - - HINSTANCE32 hInstance = (HINSTANCE32)GetExePtr( wc->hInstance ); + HINSTANCE16 hInstance=GetExePtr(wc->hInstance); if (!(atom = GlobalAddAtom16( wc->lpszClassName ))) return 0; if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, @@ -347,11 +345,8 @@ ATOM WINAPI RegisterClass32A( const WNDCLASS32A* wc ) ATOM atom; CLASS *classPtr; - /* FIXME: this should not be necessary for Win32 */ - HINSTANCE32 hInstance = (HINSTANCE32)GetExePtr( wc->hInstance ); - if (!(atom = GlobalAddAtom32A( wc->lpszClassName ))) return 0; - if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, + if (!(classPtr = CLASS_RegisterClass( atom, wc->hInstance, wc->style, wc->cbClsExtra, wc->cbWndExtra, (WNDPROC16)wc->lpfnWndProc, WIN_PROC_32A ))) @@ -362,7 +357,7 @@ ATOM WINAPI RegisterClass32A( const WNDCLASS32A* wc ) dprintf_class( stddeb, "RegisterClass32A: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p name='%s'\n", - atom, (DWORD)wc->lpfnWndProc, hInstance, + atom, (DWORD)wc->lpfnWndProc, wc->hInstance, wc->hbrBackground, wc->style, wc->cbClsExtra, wc->cbWndExtra, classPtr, HIWORD(wc->lpszClassName) ? wc->lpszClassName : "" ); @@ -384,11 +379,8 @@ ATOM WINAPI RegisterClass32W( const WNDCLASS32W* wc ) ATOM atom; CLASS *classPtr; - /* FIXME: this should not be necessary for Win32 */ - HINSTANCE32 hInstance = (HINSTANCE32)GetExePtr( wc->hInstance ); - if (!(atom = GlobalAddAtom32W( wc->lpszClassName ))) return 0; - if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, + if (!(classPtr = CLASS_RegisterClass( atom, wc->hInstance, wc->style, wc->cbClsExtra, wc->cbWndExtra, (WNDPROC16)wc->lpfnWndProc, WIN_PROC_32W ))) @@ -398,7 +390,7 @@ ATOM WINAPI RegisterClass32W( const WNDCLASS32W* wc ) } dprintf_class( stddeb, "RegisterClass32W: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", - atom, (DWORD)wc->lpfnWndProc, hInstance, + atom, (DWORD)wc->lpfnWndProc, wc->hInstance, wc->hbrBackground, wc->style, wc->cbClsExtra, wc->cbWndExtra, classPtr ); @@ -418,8 +410,7 @@ ATOM WINAPI RegisterClassEx16( const WNDCLASSEX16 *wc ) { ATOM atom; CLASS *classPtr; - - HINSTANCE32 hInstance = (HINSTANCE32)GetExePtr( wc->hInstance ); + HINSTANCE16 hInstance = GetExePtr( wc->hInstance ); if (!(atom = GlobalAddAtom16( wc->lpszClassName ))) return 0; if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, @@ -454,11 +445,8 @@ ATOM WINAPI RegisterClassEx32A( const WNDCLASSEX32A* wc ) ATOM atom; CLASS *classPtr; - /* FIXME: this should not be necessary for Win32 */ - HINSTANCE32 hInstance = (HINSTANCE32)GetExePtr( wc->hInstance ); - if (!(atom = GlobalAddAtom32A( wc->lpszClassName ))) return 0; - if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, + if (!(classPtr = CLASS_RegisterClass( atom, wc->hInstance, wc->style, wc->cbClsExtra, wc->cbWndExtra, (WNDPROC16)wc->lpfnWndProc, WIN_PROC_32A ))) @@ -468,7 +456,7 @@ ATOM WINAPI RegisterClassEx32A( const WNDCLASSEX32A* wc ) } dprintf_class( stddeb, "RegisterClassEx32A: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", - atom, (DWORD)wc->lpfnWndProc, hInstance, + atom, (DWORD)wc->lpfnWndProc, wc->hInstance, wc->hbrBackground, wc->style, wc->cbClsExtra, wc->cbWndExtra, classPtr ); @@ -489,11 +477,8 @@ ATOM WINAPI RegisterClassEx32W( const WNDCLASSEX32W* wc ) ATOM atom; CLASS *classPtr; - /* FIXME: this should not be necessary for Win32 */ - HINSTANCE32 hInstance = (HINSTANCE32)GetExePtr( wc->hInstance ); - if (!(atom = GlobalAddAtom32W( wc->lpszClassName ))) return 0; - if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, + if (!(classPtr = CLASS_RegisterClass( atom, wc->hInstance, wc->style, wc->cbClsExtra, wc->cbWndExtra, (WNDPROC16)wc->lpfnWndProc, WIN_PROC_32W ))) @@ -503,7 +488,7 @@ ATOM WINAPI RegisterClassEx32W( const WNDCLASSEX32W* wc ) } dprintf_class( stddeb, "RegisterClassEx32W: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", - atom, (DWORD)wc->lpfnWndProc, hInstance, + atom, (DWORD)wc->lpfnWndProc, wc->hInstance, wc->hbrBackground, wc->style, wc->cbClsExtra, wc->cbWndExtra, classPtr ); @@ -540,7 +525,6 @@ BOOL32 WINAPI UnregisterClass32A( LPCSTR className, HINSTANCE32 hInstance ) CLASS *classPtr; ATOM atom; - hInstance = GetExePtr( hInstance ); /* FIXME: not needed in Win32 */ if (!(atom = GlobalFindAtom32A( className ))) return FALSE; if (!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || (classPtr->hInstance != hInstance)) return FALSE; @@ -556,7 +540,6 @@ BOOL32 WINAPI UnregisterClass32W( LPCWSTR className, HINSTANCE32 hInstance ) CLASS *classPtr; ATOM atom; - hInstance = GetExePtr( hInstance ); /* FIXME: not needed in Win32 */ if (!(atom = GlobalFindAtom32W( className ))) return FALSE; if (!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || (classPtr->hInstance != hInstance)) return FALSE; @@ -910,7 +893,6 @@ BOOL32 WINAPI GetClassInfo32A( HINSTANCE32 hInstance, LPCSTR name, ATOM atom; CLASS *classPtr; - hInstance = GetExePtr( hInstance ); /* FIXME: not needed in Win32 */ if (!(atom = GlobalFindAtom32A( name )) || !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || (classPtr->hInstance && (hInstance != classPtr->hInstance))) @@ -940,7 +922,6 @@ BOOL32 WINAPI GetClassInfo32W( HINSTANCE32 hInstance, LPCWSTR name, ATOM atom; CLASS *classPtr; - hInstance = GetExePtr( hInstance ); /* FIXME: not needed in Win32 */ if (!(atom = GlobalFindAtom32W( name )) || !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || (classPtr->hInstance && (hInstance != classPtr->hInstance))) @@ -1003,7 +984,6 @@ BOOL32 WINAPI GetClassInfoEx32A( HINSTANCE32 hInstance, LPCSTR name, ATOM atom; CLASS *classPtr; - hInstance = GetExePtr( hInstance ); /* FIXME: not needed in Win32 */ if (!(atom = GlobalFindAtom32A( name )) || !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || (hInstance != classPtr->hInstance)) return FALSE; @@ -1032,7 +1012,6 @@ BOOL32 WINAPI GetClassInfoEx32W( HINSTANCE32 hInstance, LPCWSTR name, ATOM atom; CLASS *classPtr; - hInstance = GetExePtr( hInstance ); /* FIXME: not needed in Win32 */ if (!(atom = GlobalFindAtom32W( name )) || !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || (hInstance != classPtr->hInstance)) return FALSE; diff --git a/windows/defwnd.c b/windows/defwnd.c index a5b5af4a6cb..8a2a7b338b5 100644 --- a/windows/defwnd.c +++ b/windows/defwnd.c @@ -418,7 +418,7 @@ LRESULT WINAPI DefWindowProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, break; } - SPY_ExitMessage( SPY_RESULT_OK16, hwnd, msg, result ); + SPY_ExitMessage( SPY_RESULT_DEFWND16, hwnd, msg, result ); return result; } @@ -479,7 +479,7 @@ LRESULT WINAPI DefWindowProc32A( HWND32 hwnd, UINT32 msg, WPARAM32 wParam, break; } - SPY_ExitMessage( SPY_RESULT_OK32, hwnd, msg, result ); + SPY_ExitMessage( SPY_RESULT_DEFWND32, hwnd, msg, result ); return result; } diff --git a/windows/dialog.c b/windows/dialog.c index 21ef5b087e7..31cd88057e1 100644 --- a/windows/dialog.c +++ b/windows/dialog.c @@ -486,11 +486,14 @@ HWND32 DIALOG_CreateIndirect( HINSTANCE32 hInst, LPCSTR dlgTemplate, /* Load menu */ - if (template.menuName) - { - LPSTR str = SEGPTR_STRDUP( template.menuName ); /* FIXME: win32 */ - hMenu = LoadMenu16( hInst, SEGPTR_GET(str) ); - SEGPTR_FREE( str ); + if (template.menuName) { + if (!HIWORD(hInst)) /* win32 modules always have hiword set */ + { + LPSTR str = SEGPTR_STRDUP( template.menuName ); + hMenu = LoadMenu16( hInst, SEGPTR_GET(str) ); + SEGPTR_FREE( str ); + } else /* win32 modules always have hiword set */ + hMenu = LoadMenu32A( hInst, template.menuName ); } /* Create custom font if needed */ @@ -566,7 +569,7 @@ HWND32 DIALOG_CreateIndirect( HINSTANCE32 hInst, LPCSTR dlgTemplate, rect.left, rect.top, rect.right, rect.bottom, owner, hMenu, hInst, NULL ); else - hwnd = CreateWindowEx16(template.exStyle, template.className, + hwnd = CreateWindowEx32A(template.exStyle, template.className, template.caption, template.style & ~WS_VISIBLE, rect.left, rect.top, rect.right, rect.bottom, owner, hMenu, hInst, NULL ); @@ -602,12 +605,17 @@ HWND32 DIALOG_CreateIndirect( HINSTANCE32 hInst, LPCSTR dlgTemplate, { /* Send initialisation messages and set focus */ - dlgInfo->hwndFocus = GetNextDlgTabItem32( hwnd, 0, FALSE ); - if (SendMessage32A( hwnd, WM_INITDIALOG, - (WPARAM32)dlgInfo->hwndFocus, param )) - SetFocus32( dlgInfo->hwndFocus ); - if (template.style & WS_VISIBLE) ShowWindow32( hwnd, SW_SHOW ); - return hwnd; + dlgInfo->hwndFocus = GetNextDlgTabItem32( hwnd, 0, FALSE ); + + if (SendMessage32A( hwnd, WM_INITDIALOG, (WPARAM32)dlgInfo->hwndFocus, param )) + SetFocus32( dlgInfo->hwndFocus ); + + if (template.style & WS_VISIBLE && !(wndPtr->dwStyle & WS_VISIBLE)) + { + ShowWindow32( hwnd, SW_SHOWNORMAL ); /* SW_SHOW doesn't always work */ + UpdateWindow32( hwnd ); + } + return hwnd; } if( IsWindow32(hwnd) ) DestroyWindow32( hwnd ); diff --git a/windows/event.c b/windows/event.c index 541bd46b4da..c843ec9bb43 100644 --- a/windows/event.c +++ b/windows/event.c @@ -290,6 +290,25 @@ void EVENT_DestroyWindow( WND *pWnd ) while( XCheckWindowEvent(display, pWnd->window, NoEventMask, &xe) ); } + +/*********************************************************************** + * IsUserIdle (USER.333) + * + * Check if we have pending X events. + */ +BOOL16 WINAPI IsUserIdle(void) +{ + struct timeval timeout = {0, 0}; + fd_set check_set; + + FD_ZERO(&check_set); + FD_SET(__event_x_connection, &check_set); + if( select(__event_x_connection + 1, &check_set, NULL, NULL, &timeout) > 0 ) + return TRUE; + return FALSE; +} + + /*********************************************************************** * EVENT_WaitNetEvent * diff --git a/windows/hook.c b/windows/hook.c index 7166bad5d0a..55e57857a2d 100644 --- a/windows/hook.c +++ b/windows/hook.c @@ -88,16 +88,18 @@ static void HOOK_Map16To32Common(INT32 id, INT32 code, WPARAM32 *pwParam, case WH_CALLWNDPROC: { - INT32 (*localMap)(UINT16, WPARAM16, UINT32*, WPARAM32*, LPARAM*) - = (bA) ? WINPROC_MapMsg16To32A : WINPROC_MapMsg16To32W; LPCWPSTRUCT16 lpcwp16 = PTR_SEG_TO_LIN(*plParam); LPCWPSTRUCT32 lpcwp32 = HeapAlloc( SystemHeap, 0, sizeof(*lpcwp32) ); lpcwp32->hwnd = lpcwp16->hwnd; lpcwp32->lParam = lpcwp16->lParam; - (*localMap)(lpcwp16->message, lpcwp16->wParam, - &lpcwp32->message, &lpcwp32->wParam, &lpcwp32->lParam ); + if (bA) WINPROC_MapMsg16To32A( lpcwp16->message, lpcwp16->wParam, + &lpcwp32->message, &lpcwp32->wParam, + &lpcwp32->lParam ); + else WINPROC_MapMsg16To32W( lpcwp16->message, lpcwp16->wParam, + &lpcwp32->message, &lpcwp32->wParam, + &lpcwp32->lParam ); break; } @@ -264,11 +266,11 @@ static void HOOK_UnMap16To32Common(INT32 id, INT32 code, WPARAM32 wParamOrig, case WH_CALLWNDPROC: { - void (*localUnMap)(UINT32, WPARAM32, LPARAM) - = (bA) ? WINPROC_UnmapMsg16To32A : WINPROC_UnmapMsg16To32W; LPCWPSTRUCT32 lpcwp32 = (LPCWPSTRUCT32)lParam; - - (*localUnMap)(lpcwp32->message, lpcwp32->wParam, lpcwp32->lParam ); + if (bA) WINPROC_UnmapMsg16To32A( lpcwp32->message, lpcwp32->wParam, + lpcwp32->lParam ); + else WINPROC_UnmapMsg16To32W( lpcwp32->message, lpcwp32->wParam, + lpcwp32->lParam ); HeapFree( SystemHeap, 0, lpcwp32 ); break; } @@ -392,16 +394,18 @@ static void HOOK_Map32To16Common(INT32 id, INT32 code, WPARAM32 *pwParam, case WH_CALLWNDPROC: { - INT32 (*localMap)(UINT32, WPARAM32, UINT16*, WPARAM16*, LPARAM*) - = (bA) ? WINPROC_MapMsg32ATo16 : WINPROC_MapMsg32WTo16; LPCWPSTRUCT32 lpcwp32 = (LPCWPSTRUCT32)*plParam; LPCWPSTRUCT16 lpcwp16 = SEGPTR_NEW( CWPSTRUCT16 ); lpcwp16->hwnd = lpcwp32->hwnd; lpcwp16->lParam = lpcwp32->lParam; - (*localMap)(lpcwp32->message, lpcwp32->wParam, - &lpcwp16->message, &lpcwp16->wParam, &lpcwp16->lParam ); + if (bA) WINPROC_MapMsg32ATo16( lpcwp32->message, lpcwp32->wParam, + &lpcwp16->message, &lpcwp16->wParam, + &lpcwp16->lParam ); + else WINPROC_MapMsg32WTo16( lpcwp32->message, lpcwp32->wParam, + &lpcwp16->message, &lpcwp16->wParam, + &lpcwp16->lParam ); *plParam = (LPARAM)SEGPTR_GET( lpcwp16 ); break; } @@ -575,13 +579,14 @@ static void HOOK_UnMap32To16Common(INT32 id, INT32 code, WPARAM32 wParamOrig, case WH_CALLWNDPROC: { - void (*localUnMap)(UINT32, WPARAM32, LPARAM, MSGPARAM16* ) - = (bA) ? WINPROC_UnmapMsg32ATo16 : WINPROC_UnmapMsg32WTo16; LPCWPSTRUCT16 lpcwp16 = (LPCWPSTRUCT16)PTR_SEG_TO_LIN(lParam); LPCWPSTRUCT32 lpcwp32 = (LPCWPSTRUCT32)lParamOrig; MSGPARAM16 mp16 = { lpcwp16->wParam, lpcwp16->lParam, 0 }; - (*localUnMap)(lpcwp32->message, lpcwp32->wParam, lpcwp32->lParam, &mp16 ); + if (bA) WINPROC_UnmapMsg32ATo16( lpcwp32->message, lpcwp32->wParam, + lpcwp32->lParam, &mp16 ); + else WINPROC_UnmapMsg32WTo16( lpcwp32->message, lpcwp32->wParam, + lpcwp32->lParam, &mp16 ); SEGPTR_FREE( PTR_SEG_TO_LIN(lParam) ); break; } @@ -691,6 +696,7 @@ static void HOOK_Map32ATo32W(INT32 id, INT32 code, WPARAM32 *pwParam, } else lpcbtcwW->lpcs->lpszClass = (LPCWSTR)lpcbtcwA->lpcs->lpszClass; + *plParam = lpcbtcwW; } return; } @@ -744,6 +750,7 @@ static void HOOK_Map32WTo32A(INT32 id, INT32 code, WPARAM32 *pwParam, lpcbtcwW->lpcs->lpszClass ); else lpcbtcwA->lpcs->lpszClass = (LPSTR)lpcbtcwW->lpcs->lpszClass; + *plParam = lpcbtcwA; } return; } @@ -840,11 +847,13 @@ static HANDLE16 HOOK_SetHook( INT16 id, LPVOID proc, INT32 type, HQUEUE16 hQueue = 0; if ((id < WH_MINHOOK) || (id > WH_MAXHOOK)) return 0; - if (!(hInst = GetExePtr( hInst ))) return 0; dprintf_hook( stddeb, "Setting hook %d: %08x %04x %04x\n", id, (UINT32)proc, hInst, hTask ); + if (!hInst && (type!=HOOK_WIN16)) + hInst = GetModuleHandle32A(NULL);/*FIXME: correct? probably not */ + if (id == WH_JOURNALPLAYBACK) EnableHardwareInput(FALSE); if (hTask) /* Task-specific hook */ @@ -1176,7 +1185,7 @@ FARPROC16 WINAPI SetWindowsHook16( INT16 id, HOOKPROC16 proc ) return 0; } - handle = HOOK_SetHook( id, proc, HOOK_WIN16, hInst, hTask ); + handle = HOOK_SetHook( id, proc, HOOK_WIN16, GetExePtr(hInst), hTask ); return (handle) ? (FARPROC16)MAKELONG( handle, HOOK_MAGIC ) : NULL; } @@ -1221,7 +1230,7 @@ HHOOK WINAPI SetWindowsHook32W( INT32 id, HOOKPROC32 proc ) HHOOK WINAPI SetWindowsHookEx16( INT16 id, HOOKPROC16 proc, HINSTANCE16 hInst, HTASK16 hTask ) { - HANDLE16 handle = HOOK_SetHook( id, proc, HOOK_WIN16, hInst, hTask ); + HANDLE16 handle = HOOK_SetHook( id, proc, HOOK_WIN16, GetExePtr(hInst), hTask ); return (handle) ? (HHOOK)MAKELONG( handle, HOOK_MAGIC ) : (HHOOK)NULL; } diff --git a/windows/keyboard.c b/windows/keyboard.c index be31d5913d6..9421737964a 100644 --- a/windows/keyboard.c +++ b/windows/keyboard.c @@ -1184,9 +1184,21 @@ INT32 WINAPI ToAscii32( UINT32 virtKey,UINT32 scanCode,LPBYTE lpKeyState, /*********************************************************************** * GetKeyboardLayout (USER32.249) */ -/*HKL*/ HANDLE32 WINAPI GetKeyboardLayout(DWORD dwLayout) +HKL32 WINAPI GetKeyboardLayout(DWORD dwLayout) { fprintf(stderr,"GetKeyboardLayout(%ld),STUB!\n",dwLayout); - return 0; + return (0xcafe<<16)|GetSystemDefaultLCID(); /* FIXME */ +} + +/*********************************************************************** + * GetKeyboardLayoutList (USER32.250) + * FIXME + */ +INT32 WINAPI GetKeyboardLayoutList(INT32 nBuff,HKL32 *layouts) +{ + fprintf(stderr,"GetKeyboardLayoutList(%d,%p),STUB!\n",nBuff,layouts); + if (layouts) + layouts[0] = GetKeyboardLayout(0); + return 1; } diff --git a/windows/mdi.c b/windows/mdi.c index fe881b96c66..3fd4b95350d 100644 --- a/windows/mdi.c +++ b/windows/mdi.c @@ -32,7 +32,6 @@ #define MDIF_NEEDUPDATE 0x0001 - static HBITMAP16 hBmpClose = 0; static HBITMAP16 hBmpRestore = 0; @@ -59,12 +58,12 @@ static HWND16 MDI_GetChildByID(WND* wndPtr,int id) static void MDI_PostUpdate(HWND16 hwnd, MDICLIENTINFO* ci, WORD recalc) { - if( !(ci->mdiFlags & MDIF_NEEDUPDATE) ) - { - ci->mdiFlags |= MDIF_NEEDUPDATE; - PostMessage16( hwnd, WM_MDICALCCHILDSCROLL, 0, 0); - } - ci->sbRecalc = recalc; + if( !(ci->mdiFlags & MDIF_NEEDUPDATE) ) + { + ci->mdiFlags |= MDIF_NEEDUPDATE; + PostMessage16( hwnd, WM_MDICALCCHILDSCROLL, 0, 0); + } + ci->sbRecalc = recalc; } /********************************************************************** @@ -92,22 +91,22 @@ static BOOL32 MDI_MenuAppendItem(WND *clientWnd, HWND16 hWndChild) */ static BOOL32 MDI_MenuModifyItem(WND* clientWnd, HWND16 hWndChild ) { - char buffer[128]; - MDICLIENTINFO *clientInfo = (MDICLIENTINFO*)clientWnd->wExtra; - WND *wndPtr = WIN_FindWndPtr(hWndChild); - UINT32 n = sprintf(buffer, "%d ", - wndPtr->wIDmenu - clientInfo->idFirstChild + 1); - BOOL32 bRet = 0; + char buffer[128]; + MDICLIENTINFO *clientInfo = (MDICLIENTINFO*)clientWnd->wExtra; + WND *wndPtr = WIN_FindWndPtr(hWndChild); + UINT32 n = sprintf(buffer, "%d ", + wndPtr->wIDmenu - clientInfo->idFirstChild + 1); + BOOL32 bRet = 0; - if( !clientInfo->hWindowMenu ) return 0; + if( !clientInfo->hWindowMenu ) return 0; - if (wndPtr->text) lstrcpyn32A(buffer + n, wndPtr->text, sizeof(buffer) - n ); + if (wndPtr->text) lstrcpyn32A(buffer + n, wndPtr->text, sizeof(buffer) - n ); - n = GetMenuState32(clientInfo->hWindowMenu,wndPtr->wIDmenu ,MF_BYCOMMAND); - bRet = ModifyMenu32A(clientInfo->hWindowMenu , wndPtr->wIDmenu, + n = GetMenuState32(clientInfo->hWindowMenu,wndPtr->wIDmenu ,MF_BYCOMMAND); + bRet = ModifyMenu32A(clientInfo->hWindowMenu , wndPtr->wIDmenu, MF_BYCOMMAND | MF_STRING, wndPtr->wIDmenu, buffer ); - CheckMenuItem32(clientInfo->hWindowMenu ,wndPtr->wIDmenu , n & MF_CHECKED); - return bRet; + CheckMenuItem32(clientInfo->hWindowMenu ,wndPtr->wIDmenu , n & MF_CHECKED); + return bRet; } /********************************************************************** @@ -115,29 +114,29 @@ static BOOL32 MDI_MenuModifyItem(WND* clientWnd, HWND16 hWndChild ) */ static BOOL32 MDI_MenuDeleteItem(WND* clientWnd, HWND16 hWndChild ) { - char buffer[128]; - MDICLIENTINFO *clientInfo = (MDICLIENTINFO*)clientWnd->wExtra; - WND *wndPtr = WIN_FindWndPtr(hWndChild); - UINT32 index = 0,id,n; + char buffer[128]; + MDICLIENTINFO *clientInfo = (MDICLIENTINFO*)clientWnd->wExtra; + WND *wndPtr = WIN_FindWndPtr(hWndChild); + UINT32 index = 0,id,n; - if( !clientInfo->nActiveChildren || - !clientInfo->hWindowMenu ) return 0; + if( !clientInfo->nActiveChildren || + !clientInfo->hWindowMenu ) return 0; - id = wndPtr->wIDmenu; - DeleteMenu32(clientInfo->hWindowMenu,id,MF_BYCOMMAND); + id = wndPtr->wIDmenu; + DeleteMenu32(clientInfo->hWindowMenu,id,MF_BYCOMMAND); /* walk the rest of MDI children to prevent gaps in the id * sequence and in the menu child list */ - for( index = id+1; index <= clientInfo->nActiveChildren + - clientInfo->idFirstChild; index++ ) + for( index = id+1; index <= clientInfo->nActiveChildren + + clientInfo->idFirstChild; index++ ) { wndPtr = WIN_FindWndPtr(MDI_GetChildByID(clientWnd,index)); if( !wndPtr ) - { + { dprintf_mdi(stddeb,"MDIMenuDeleteItem: no window for id=%i\n",index); continue; - } + } /* set correct id */ wndPtr->wIDmenu--; @@ -150,40 +149,34 @@ static BOOL32 MDI_MenuDeleteItem(WND* clientWnd, HWND16 hWndChild ) ModifyMenu32A(clientInfo->hWindowMenu ,index ,MF_BYCOMMAND | MF_STRING, index - 1 , buffer ); } - return 1; + return 1; } /********************************************************************** * MDI_GetWindow * - * returns "activateable" child or zero + * returns "activateable" child different from the current or zero */ -static HWND16 MDI_GetWindow(WND *clientWnd, HWND16 hWnd, WORD wTo ) +static HWND16 MDI_GetWindow(WND *clientWnd, HWND16 hWnd, BOOL16 bNext, DWORD dwStyleMask ) { MDICLIENTINFO *clientInfo = (MDICLIENTINFO*)clientWnd->wExtra; - WND *wndPtr, *pWnd, *pWndLast; + WND *wndPtr, *pWnd, *pWndLast = NULL; + dwStyleMask |= WS_DISABLED | WS_VISIBLE; if( !hWnd ) hWnd = clientInfo->hwndActiveChild; if( !(wndPtr = WIN_FindWndPtr(hWnd)) ) return 0; - pWnd = wndPtr; - pWndLast = NULL; - for (;;) + for ( pWnd = wndPtr->next; ; pWnd = pWnd->next ) { - pWnd = pWnd->next; - if (!pWnd) pWnd = wndPtr->parent->child; - if (pWnd == wndPtr) /* not found */ - { - if (!wTo || !pWndLast) return 0; - break; - } + if (!pWnd ) pWnd = wndPtr->parent->child; - if ( !pWnd->owner && (pWnd->dwStyle & - (WS_VISIBLE | WS_DISABLED)) == WS_VISIBLE ) + if ( pWnd == wndPtr ) break; /* went full circle */ + + if (!pWnd->owner && (pWnd->dwStyle & dwStyleMask) == WS_VISIBLE ) { - pWndLast = pWnd; - if (!wTo) break; + pWndLast = pWnd; + if ( bNext ) break; } } return pWndLast ? pWndLast->hwndSelf : 0; @@ -192,23 +185,23 @@ static HWND16 MDI_GetWindow(WND *clientWnd, HWND16 hWnd, WORD wTo ) /********************************************************************** * MDI_CalcDefaultChildPos * - * It seems that default height is 2/3 of client rect + * It seems that the default height is about 2/3 of the client rect */ static void MDI_CalcDefaultChildPos( WND* w, WORD n, LPPOINT16 lpPos, INT32 delta) { - RECT32 rect = w->rectClient; - INT32 spacing = GetSystemMetrics32(SM_CYCAPTION) + - GetSystemMetrics32(SM_CYFRAME) - 1; - INT32 nstagger; + INT32 nstagger; + RECT32 rect = w->rectClient; + INT32 spacing = GetSystemMetrics32(SM_CYCAPTION) + + GetSystemMetrics32(SM_CYFRAME) - 1; - if( rect.bottom - rect.top - delta >= spacing ) - rect.bottom -= delta; + if( rect.bottom - rect.top - delta >= spacing ) + rect.bottom -= delta; - nstagger = (rect.bottom - rect.top)/(3*spacing); - lpPos[1].x = (rect.right - rect.left - nstagger*spacing); - lpPos[1].y = (rect.bottom - rect.top - nstagger*spacing); - lpPos[0].x = lpPos[0].y = spacing*(n%(nstagger+1)); + nstagger = (rect.bottom - rect.top)/(3 * spacing); + lpPos[1].x = (rect.right - rect.left - nstagger * spacing); + lpPos[1].y = (rect.bottom - rect.top - nstagger * spacing); + lpPos[0].x = lpPos[0].y = spacing * (n%(nstagger+1)); } /********************************************************************** @@ -226,7 +219,7 @@ static HMENU16 MDISetMenu(HWND16 hwnd, BOOL32 fRefresh, HMENU16 hmenuFrame, ci = (MDICLIENTINFO *) w->wExtra; if (!fRefresh) - { + { HWND16 hwndFrame = GetParent16(hwnd); HMENU32 oldFrameMenu = GetMenu32(hwndFrame); @@ -234,7 +227,7 @@ static HMENU16 MDISetMenu(HWND16 hwnd, BOOL32 fRefresh, HMENU16 hmenuFrame, MDI_RestoreFrameMenu(w->parent, ci->hwndChildMaximized ); if( hmenuWindow && hmenuWindow!=ci->hWindowMenu ) - { + { /* delete menu items from ci->hWindowMenu * and add them to hmenuWindow */ @@ -244,13 +237,13 @@ static HMENU16 MDISetMenu(HWND16 hwnd, BOOL32 fRefresh, HMENU16 hmenuFrame, AppendMenu32A( hmenuWindow, MF_SEPARATOR, 0, NULL); if( ci->nActiveChildren ) - { + { INT32 j = i - ci->nActiveChildren + 1; char buffer[100]; UINT32 id,state; for( ; i >= j ; i-- ) - { + { id = GetMenuItemID32(ci->hWindowMenu,i ); state = GetMenuState32(ci->hWindowMenu,i,MF_BYPOSITION); @@ -260,24 +253,24 @@ static HMENU16 MDISetMenu(HWND16 hwnd, BOOL32 fRefresh, HMENU16 hmenuFrame, InsertMenu32A(hmenuWindow, pos, MF_BYPOSITION | MF_STRING, id, buffer); CheckMenuItem32(hmenuWindow ,pos , MF_BYPOSITION | (state & MF_CHECKED)); - } - } + } + } /* remove separator */ DeleteMenu32(ci->hWindowMenu, i, MF_BYPOSITION); ci->hWindowMenu = hmenuWindow; - } + } if( hmenuFrame && hmenuFrame!=oldFrameMenu) - { + { SetMenu32(hwndFrame, hmenuFrame); if( ci->hwndChildMaximized ) MDI_AugmentFrameMenu(ci, w->parent, ci->hwndChildMaximized ); return oldFrameMenu; - } + } - } + } return 0; } @@ -319,21 +312,21 @@ static HWND16 MDICreateChild( WND *w, MDICLIENTINFO *ci, HWND16 parent, cs->cy = pos[1].y; if( cs->x == CW_USEDEFAULT16 ) - { + { cs->x = pos[0].x; cs->y = pos[0].y; - } + } /* restore current maximized child */ if( style & WS_VISIBLE && ci->hwndChildMaximized ) - { + { if( style & WS_MAXIMIZE ) - SendMessage16(w->hwndSelf, WM_SETREDRAW, FALSE, 0L ); + SendMessage16(w->hwndSelf, WM_SETREDRAW, FALSE, 0L ); hwndMax = ci->hwndChildMaximized; ShowWindow16( hwndMax, SW_SHOWNOACTIVATE ); if( style & WS_MAXIMIZE ) - SendMessage16(w->hwndSelf, WM_SETREDRAW, TRUE, 0L ); - } + SendMessage16(w->hwndSelf, WM_SETREDRAW, TRUE, 0L ); + } /* this menu is needed to set a check mark in MDI_ChildActivate */ AppendMenu32A(ci->hWindowMenu ,MF_STRING ,wIDmenu, lpstrDef ); @@ -342,11 +335,11 @@ static HWND16 MDICreateChild( WND *w, MDICLIENTINFO *ci, HWND16 parent, /* fix window style */ if( !(w->dwStyle & MDIS_ALLCHILDSTYLES) ) - { + { style &= (WS_CHILD | WS_CLIPSIBLINGS | WS_MINIMIZE | WS_MAXIMIZE | WS_CLIPCHILDREN | WS_DISABLED | WS_VSCROLL | WS_HSCROLL ); style |= (WS_VISIBLE | WS_OVERLAPPEDWINDOW); - } + } hwnd = CreateWindow16( (LPCSTR)PTR_SEG_TO_LIN(cs->szClass), (LPCSTR)PTR_SEG_TO_LIN(cs->szTitle), style, @@ -364,20 +357,20 @@ static HWND16 MDICreateChild( WND *w, MDICLIENTINFO *ci, HWND16 parent, if( wnd->dwStyle & WS_MINIMIZE && ci->hwndActiveChild ) ShowWindow16( hwnd, SW_SHOWMINNOACTIVE ); else - { + { SetWindowPos32( hwnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE ); /* Set maximized state here in case hwnd didn't receive WM_SIZE * during CreateWindow - bad! */ - if( wnd->dwStyle & WS_MAXIMIZE && !ci->hwndChildMaximized ) - { + if((wnd->dwStyle & WS_MAXIMIZE) && !ci->hwndChildMaximized ) + { ci->hwndChildMaximized = wnd->hwndSelf; MDI_AugmentFrameMenu( ci, w->parent, hwnd ); MDI_UpdateFrameText( w->parent, ci->self, MDI_REPAINTFRAME, NULL ); - } - } + } + } dprintf_mdi(stddeb, "MDICreateChild: created child - %04x\n",hwnd); } else @@ -393,77 +386,73 @@ static HWND16 MDICreateChild( WND *w, MDICLIENTINFO *ci, HWND16 parent, /********************************************************************** * MDI_ChildGetMinMaxInfo + * + * Note: The rule here is that client rect of the maximized MDI child + * is equal to the client rect of the MDI client window. */ static void MDI_ChildGetMinMaxInfo( WND* clientWnd, HWND16 hwnd, MINMAXINFO16* lpMinMax ) { - WND* childWnd = WIN_FindWndPtr(hwnd); - RECT32 rect = clientWnd->rectClient; + WND* childWnd = WIN_FindWndPtr(hwnd); + RECT32 rect = clientWnd->rectClient; - MapWindowPoints32(clientWnd->parent->hwndSelf, - ((MDICLIENTINFO*)clientWnd->wExtra)->self, - (LPPOINT32)&rect, 2); - AdjustWindowRectEx32( &rect, childWnd->dwStyle, 0, childWnd->dwExStyle ); + MapWindowPoints32( clientWnd->parent->hwndSelf, + ((MDICLIENTINFO*)clientWnd->wExtra)->self, (LPPOINT32)&rect, 2); + AdjustWindowRectEx32( &rect, childWnd->dwStyle, 0, childWnd->dwExStyle ); - lpMinMax->ptMaxSize.x = rect.right -= rect.left; - lpMinMax->ptMaxSize.y = rect.bottom -= rect.top; + lpMinMax->ptMaxSize.x = rect.right -= rect.left; + lpMinMax->ptMaxSize.y = rect.bottom -= rect.top; - lpMinMax->ptMaxPosition.x = rect.left; - lpMinMax->ptMaxPosition.y = rect.top; + lpMinMax->ptMaxPosition.x = rect.left; + lpMinMax->ptMaxPosition.y = rect.top; - dprintf_mdi(stddeb,"\tChildMinMaxInfo: max rect (%i,%i - %i, %i)\n", + dprintf_mdi(stddeb,"\tChildMinMaxInfo: max rect (%i,%i - %i, %i)\n", rect.left,rect.top,rect.right,rect.bottom); - } /********************************************************************** * MDI_SwitchActiveChild * - * Notes: SetWindowPos sends WM_CHILDACTIVATE to the child window that is - * being activated - * - * wTo is basically lParam of WM_MDINEXT message or explicit - * window handle + * Note: SetWindowPos sends WM_CHILDACTIVATE to the child window that is + * being activated */ static void MDI_SwitchActiveChild( HWND16 clientHwnd, HWND16 childHwnd, - BOOL32 wTo ) + BOOL32 bNextWindow ) { WND *w = WIN_FindWndPtr(clientHwnd); HWND16 hwndTo = 0; HWND16 hwndPrev = 0; MDICLIENTINFO *ci; - hwndTo = MDI_GetWindow(w,childHwnd,(WORD)wTo); + hwndTo = MDI_GetWindow(w, childHwnd, bNextWindow, 0); ci = (MDICLIENTINFO *) w->wExtra; dprintf_mdi(stddeb, "MDI_SwitchActiveChild: from %04x, to %04x\n",childHwnd,hwndTo); - if ( !hwndTo ) return; + if ( !hwndTo ) return; /* no window to switch to */ hwndPrev = ci->hwndActiveChild; if ( hwndTo != hwndPrev ) + { + BOOL32 bOptimize = 0; + + if( ci->hwndChildMaximized ) { - BOOL32 bOptimize = 0; - - if( ci->hwndChildMaximized ) - { - bOptimize = 1; - w->dwStyle &= ~WS_VISIBLE; - } - - SetWindowPos32( hwndTo, HWND_TOP, 0, 0, 0, 0, - SWP_NOMOVE | SWP_NOSIZE ); - if( !wTo && hwndPrev ) - { - SetWindowPos32( hwndPrev, HWND_BOTTOM, 0, 0, 0, 0, - SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - } - - if( bOptimize ) - ShowWindow16( clientHwnd, SW_SHOW ); + bOptimize = 1; + w->dwStyle &= ~WS_VISIBLE; } + + SetWindowPos32( hwndTo, HWND_TOP, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE ); + + if( bNextWindow && hwndPrev ) + SetWindowPos32( hwndPrev, HWND_BOTTOM, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE ); + if( bOptimize ) + ShowWindow16( clientHwnd, SW_SHOW ); + } } @@ -478,21 +467,21 @@ static HWND16 MDIDestroyChild( WND *w_parent, MDICLIENTINFO *ci, HWND16 parent, if( childPtr ) { if( child == ci->hwndActiveChild ) - { - MDI_SwitchActiveChild(parent,child,0); + { + MDI_SwitchActiveChild(parent, child, TRUE); if( child == ci->hwndActiveChild ) - { + { ShowWindow16( child, SW_HIDE); if( child == ci->hwndChildMaximized ) - { + { MDI_RestoreFrameMenu(w_parent->parent, child); ci->hwndChildMaximized = 0; MDI_UpdateFrameText(w_parent->parent,parent,TRUE,NULL); - } + } - MDI_ChildActivate(w_parent,0); - } + MDI_ChildActivate(w_parent, 0); + } MDI_MenuDeleteItem(w_parent, child); } @@ -501,10 +490,10 @@ static HWND16 MDIDestroyChild( WND *w_parent, MDICLIENTINFO *ci, HWND16 parent, dprintf_mdi(stddeb,"MDIDestroyChild: child destroyed - %04x\n",child); if (flagDestroy) - { + { MDI_PostUpdate(GetParent16(child), ci, SB_BOTH+1); DestroyWindow32(child); - } + } } return 0; @@ -552,16 +541,16 @@ static LONG MDI_ChildActivate( WND *clientPtr, HWND16 hWndChild ) if( clientInfo->hWindowMenu ) CheckMenuItem32( clientInfo->hWindowMenu, wndPrev->wIDmenu, 0); - } + } /* set appearance */ if( clientInfo->hwndChildMaximized ) if( clientInfo->hwndChildMaximized != hWndChild ) if( hWndChild ) - { + { clientInfo->hwndActiveChild = hWndChild; ShowWindow16( hWndChild, SW_SHOWMAXIMIZED); - } + } else ShowWindow16( clientInfo->hwndActiveChild, SW_SHOWNORMAL ); @@ -570,11 +559,11 @@ static LONG MDI_ChildActivate( WND *clientPtr, HWND16 hWndChild ) /* check if we have any children left */ if( !hWndChild ) - { - if( isActiveFrameWnd ) - SetFocus32( clientInfo->self ); - return 0; - } + { + if( isActiveFrameWnd ) + SetFocus32( clientInfo->self ); + return 0; + } /* check menu item */ if( clientInfo->hWindowMenu ) @@ -585,7 +574,7 @@ static LONG MDI_ChildActivate( WND *clientPtr, HWND16 hWndChild ) SetWindowPos32( hWndChild, 0,0,0,0,0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); if( isActiveFrameWnd ) - { + { SendMessage16( hWndChild, WM_NCACTIVATE, TRUE, 0L); if( GetFocus32() == clientInfo->self ) SendMessage16( clientInfo->self, WM_SETFOCUS, @@ -767,39 +756,42 @@ static LONG MDITile(WND* wndClient, MDICLIENTINFO *ci,WORD wParam) static BOOL32 MDI_AugmentFrameMenu( MDICLIENTINFO* ci, WND *frame, HWND16 hChild ) { - WND* child = WIN_FindWndPtr(hChild); - HMENU16 hSysPopup = 0; + WND* child = WIN_FindWndPtr(hChild); + HMENU16 hSysPopup = 0; - dprintf_mdi(stddeb,"MDI_AugmentFrameMenu: frame %p,child %04x\n",frame,hChild); + dprintf_mdi(stddeb,"MDI_AugmentFrameMenu: frame %p,child %04x\n",frame,hChild); - if( !frame->wIDmenu || !child->hSysMenu ) return 0; + if( !frame->wIDmenu || !child->hSysMenu ) return 0; - /* create a copy of sysmenu popup and insert it into frame menu bar */ + /* create a copy of sysmenu popup and insert it into frame menu bar */ - if (!(hSysPopup = LoadMenuIndirect32A(SYSRES_GetResPtr(SYSRES_MENU_SYSMENU)))) - return 0; + if (!(hSysPopup = LoadMenuIndirect32A(SYSRES_GetResPtr(SYSRES_MENU_SYSMENU)))) + return 0; - dprintf_mdi(stddeb,"\t\tgot popup %04x\n in sysmenu %04x",hSysPopup,child->hSysMenu); + dprintf_mdi(stddeb,"\t\tgot popup %04x\n in sysmenu %04x",hSysPopup,child->hSysMenu); - if( !InsertMenu32A(frame->wIDmenu,0,MF_BYPOSITION | MF_BITMAP | MF_POPUP, + if( !InsertMenu32A(frame->wIDmenu,0,MF_BYPOSITION | MF_BITMAP | MF_POPUP, hSysPopup, (LPSTR)(DWORD)hBmpClose )) - { DestroyMenu32(hSysPopup); return 0; } + { + DestroyMenu32(hSysPopup); + return 0; + } - if( !AppendMenu32A(frame->wIDmenu,MF_HELP | MF_BITMAP, + if( !AppendMenu32A(frame->wIDmenu,MF_HELP | MF_BITMAP, SC_RESTORE, (LPSTR)(DWORD)hBmpRestore )) - { - RemoveMenu32(frame->wIDmenu,0,MF_BYPOSITION); - return 0; - } + { + RemoveMenu32(frame->wIDmenu,0,MF_BYPOSITION); + return 0; + } - EnableMenuItem32(hSysPopup, SC_SIZE, MF_BYCOMMAND | MF_GRAYED); - EnableMenuItem32(hSysPopup, SC_MOVE, MF_BYCOMMAND | MF_GRAYED); - EnableMenuItem32(hSysPopup, SC_MAXIMIZE, MF_BYCOMMAND | MF_GRAYED); + EnableMenuItem32(hSysPopup, SC_SIZE, MF_BYCOMMAND | MF_GRAYED); + EnableMenuItem32(hSysPopup, SC_MOVE, MF_BYCOMMAND | MF_GRAYED); + EnableMenuItem32(hSysPopup, SC_MAXIMIZE, MF_BYCOMMAND | MF_GRAYED); - /* redraw menu */ - DrawMenuBar32(frame->hwndSelf); + /* redraw menu */ + DrawMenuBar32(frame->hwndSelf); - return 1; + return 1; } /********************************************************************** @@ -807,20 +799,19 @@ static BOOL32 MDI_AugmentFrameMenu( MDICLIENTINFO* ci, WND *frame, */ static BOOL32 MDI_RestoreFrameMenu( WND *frameWnd, HWND16 hChild ) { - INT32 nItems = GetMenuItemCount32(frameWnd->wIDmenu) - 1; + INT32 nItems = GetMenuItemCount32(frameWnd->wIDmenu) - 1; - dprintf_mdi(stddeb,"MDI_RestoreFrameMenu: for child %04x\n",hChild); + dprintf_mdi(stddeb,"MDI_RestoreFrameMenu: for child %04x\n",hChild); - if( GetMenuItemID32(frameWnd->wIDmenu,nItems) != SC_RESTORE ) - return 0; + if( GetMenuItemID32(frameWnd->wIDmenu,nItems) != SC_RESTORE ) + return 0; + RemoveMenu32(frameWnd->wIDmenu,0,MF_BYPOSITION); + DeleteMenu32(frameWnd->wIDmenu,nItems-1,MF_BYPOSITION); - RemoveMenu32(frameWnd->wIDmenu,0,MF_BYPOSITION); - DeleteMenu32(frameWnd->wIDmenu,nItems-1,MF_BYPOSITION); + DrawMenuBar32(frameWnd->hwndSelf); - DrawMenuBar32(frameWnd->hwndSelf); - - return 1; + return 1; } /********************************************************************** @@ -833,65 +824,63 @@ static BOOL32 MDI_RestoreFrameMenu( WND *frameWnd, HWND16 hChild ) static void MDI_UpdateFrameText( WND *frameWnd, HWND16 hClient, BOOL32 repaint, LPCSTR lpTitle ) { - char lpBuffer[MDI_MAXTITLELENGTH+1]; - WND* clientWnd = WIN_FindWndPtr(hClient); + char lpBuffer[MDI_MAXTITLELENGTH+1]; + WND* clientWnd = WIN_FindWndPtr(hClient); + MDICLIENTINFO *ci = (MDICLIENTINFO *) clientWnd->wExtra; - MDICLIENTINFO *ci = (MDICLIENTINFO *) clientWnd->wExtra; + dprintf_mdi(stddeb, "MDI: repaint %i, frameText %s\n", repaint, (lpTitle)?lpTitle:"NULL"); - dprintf_mdi(stddeb, "MDI: repaint %i, frameText %s\n", repaint, (lpTitle)?lpTitle:"NULL"); + /* store new "default" title if lpTitle is not NULL */ + if (lpTitle) + { + if (ci->frameTitle) HeapFree( SystemHeap, 0, ci->frameTitle ); + ci->frameTitle = HEAP_strdupA( SystemHeap, 0, lpTitle ); + } - /* store new "default" title if lpTitle is not NULL */ - if (lpTitle) - { - if (ci->frameTitle) HeapFree( SystemHeap, 0, ci->frameTitle ); - ci->frameTitle = HEAP_strdupA( SystemHeap, 0, lpTitle ); - } + if (ci->frameTitle) + { + WND* childWnd = WIN_FindWndPtr( ci->hwndChildMaximized ); - if (ci->frameTitle) - { - WND* childWnd = WIN_FindWndPtr( ci->hwndChildMaximized ); + if( childWnd && childWnd->text ) + { + /* combine frame title and child title if possible */ - if( childWnd && childWnd->text ) - { - /* combine frame title and child title if possible */ + LPCSTR lpBracket = " - ["; + int i_frame_text_length = strlen(ci->frameTitle); + int i_child_text_length = strlen(childWnd->text); - LPCSTR lpBracket = " - ["; - int i_frame_text_length = strlen(ci->frameTitle); - int i_child_text_length = strlen(childWnd->text); + lstrcpyn32A( lpBuffer, ci->frameTitle, MDI_MAXTITLELENGTH); - lstrcpyn32A( lpBuffer, ci->frameTitle, MDI_MAXTITLELENGTH); + if( i_frame_text_length + 6 < MDI_MAXTITLELENGTH ) + { + strcat( lpBuffer, lpBracket ); - if( i_frame_text_length + 6 < MDI_MAXTITLELENGTH ) - { - strcat( lpBuffer, lpBracket ); - - if( i_frame_text_length + i_child_text_length + 6 < MDI_MAXTITLELENGTH ) - { - strcat( lpBuffer, childWnd->text ); - strcat( lpBuffer, "]" ); - } - else - { - lstrcpyn32A( lpBuffer + i_frame_text_length + 4, - childWnd->text, - MDI_MAXTITLELENGTH - i_frame_text_length - 5 ); - strcat( lpBuffer, "]" ); + if( i_frame_text_length + i_child_text_length + 6 < MDI_MAXTITLELENGTH ) + { + strcat( lpBuffer, childWnd->text ); + strcat( lpBuffer, "]" ); } - } - } - else - { - strncpy(lpBuffer, ci->frameTitle, MDI_MAXTITLELENGTH ); - lpBuffer[MDI_MAXTITLELENGTH]='\0'; - } - } - else - lpBuffer[0] = '\0'; + else + { + lstrcpyn32A( lpBuffer + i_frame_text_length + 4, + childWnd->text, MDI_MAXTITLELENGTH - i_frame_text_length - 5 ); + strcat( lpBuffer, "]" ); + } + } + } + else + { + strncpy(lpBuffer, ci->frameTitle, MDI_MAXTITLELENGTH ); + lpBuffer[MDI_MAXTITLELENGTH]='\0'; + } + } + else + lpBuffer[0] = '\0'; - DEFWND_SetText( frameWnd, lpBuffer ); - if( repaint == MDI_REPAINTFRAME) - SetWindowPos32(frameWnd->hwndSelf, 0,0,0,0,0, SWP_FRAMECHANGED | - SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER ); + DEFWND_SetText( frameWnd, lpBuffer ); + if( repaint == MDI_REPAINTFRAME) + SetWindowPos32( frameWnd->hwndSelf, 0,0,0,0,0, SWP_FRAMECHANGED | + SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER ); } @@ -901,7 +890,7 @@ static void MDI_UpdateFrameText( WND *frameWnd, HWND16 hClient, /********************************************************************** * MDIClientWndProc * - * This function is the handler for all MDI requests. + * This function handles all MDI requests. */ LRESULT WINAPI MDIClientWndProc(HWND16 hwnd, UINT16 message, WPARAM16 wParam, LPARAM lParam) @@ -960,13 +949,15 @@ LRESULT WINAPI MDIClientWndProc(HWND16 hwnd, UINT16 message, WPARAM16 wParam, NC_HandleNCCalcSize( w, &rect ); w->rectClient = rect; - dprintf_mdi(stddeb,"MDI: Client created - hwnd = %04x, idFirst = %u\n",hwnd,ci->idFirstChild); + dprintf_mdi(stddeb,"MDI: Client created - hwnd = %04x, idFirst = %u\n", + hwnd, ci->idFirstChild ); return 0; case WM_DESTROY: if( ci->hwndChildMaximized ) MDI_RestoreFrameMenu(w, frameWnd->hwndSelf); - if((nItems = GetMenuItemCount32(ci->hWindowMenu)) > 0) { + if((nItems = GetMenuItemCount32(ci->hWindowMenu)) > 0) + { ci->idFirstChild = nItems - 1; ci->nActiveChildren++; /* to delete a separator */ while( ci->nActiveChildren-- ) @@ -1001,15 +992,15 @@ LRESULT WINAPI MDIClientWndProc(HWND16 hwnd, UINT16 message, WPARAM16 wParam, ci->mdiFlags |= MDIF_NEEDUPDATE; MDIIconArrange(hwnd); ci->sbRecalc = SB_BOTH+1; - SendMessage16(hwnd,WM_MDICALCCHILDSCROLL,0,0L); + SendMessage16(hwnd, WM_MDICALCCHILDSCROLL, 0, 0L); return 0; case WM_MDIMAXIMIZE: ShowWindow16((HWND16)wParam, SW_MAXIMIZE); return 0; - case WM_MDINEXT: - MDI_SwitchActiveChild(hwnd, (HWND16)wParam, (lParam)?1:0); + case WM_MDINEXT: /* lParam != 0 means previous window */ + MDI_SwitchActiveChild(hwnd, (HWND16)wParam, (lParam)? FALSE : TRUE ); break; case WM_MDIRESTORE: @@ -1026,24 +1017,24 @@ LRESULT WINAPI MDIClientWndProc(HWND16 hwnd, UINT16 message, WPARAM16 wParam, case WM_MDITILE: ci->mdiFlags |= MDIF_NEEDUPDATE; ShowScrollBar32(hwnd,SB_BOTH,FALSE); - MDITile(w, ci,wParam); + MDITile(w, ci, wParam); ci->mdiFlags &= ~MDIF_NEEDUPDATE; return 0; case WM_VSCROLL: case WM_HSCROLL: ci->mdiFlags |= MDIF_NEEDUPDATE; - ScrollChildren32(hwnd,message,wParam,lParam); + ScrollChildren32(hwnd, message, wParam, lParam); ci->mdiFlags &= ~MDIF_NEEDUPDATE; return 0; case WM_SETFOCUS: if( ci->hwndActiveChild ) - { + { w = WIN_FindWndPtr( ci->hwndActiveChild ); if( !(w->dwStyle & WS_MINIMIZE) ) SetFocus32( ci->hwndActiveChild ); - } + } return 0; case WM_NCACTIVATE: @@ -1076,7 +1067,7 @@ LRESULT WINAPI MDIClientWndProc(HWND16 hwnd, UINT16 message, WPARAM16 wParam, rect.right - rect.left, rect.bottom - rect.top, 1); } else - MDI_PostUpdate(hwnd, ci, SB_BOTH+1); + MDI_PostUpdate(hwnd, ci, SB_BOTH+1); break; @@ -1251,7 +1242,8 @@ LRESULT WINAPI DefFrameProc32W( HWND32 hwnd, HWND32 hwndMDIClient, SendMessage32W(hwndMDIClient, message, wParam, lParam); break; - case WM_SETTEXT: { + case WM_SETTEXT: + { LPSTR txt = HEAP_strdupWtoA(GetProcessHeap(),0,(LPWSTR)lParam); LRESULT ret = DefFrameProc32A( hwnd, hwndMDIClient, message, wParam, (DWORD)txt ); @@ -1311,7 +1303,7 @@ LRESULT WINAPI DefMDIChildProc16( HWND16 hwnd, UINT16 message, case WM_SYSCOMMAND: switch( wParam ) - { + { case SC_MOVE: if( ci->hwndChildMaximized == hwnd) return 0; break; @@ -1331,7 +1323,7 @@ LRESULT WINAPI DefMDIChildProc16( HWND16 hwnd, UINT16 message, case SC_PREVWINDOW: SendMessage16( ci->self, WM_MDINEXT, 0, 1); return 0; - } + } break; case WM_GETMINMAXINFO: @@ -1348,29 +1340,29 @@ LRESULT WINAPI DefMDIChildProc16( HWND16 hwnd, UINT16 message, /* do not change */ if( ci->hwndActiveChild == hwnd && wParam != SIZE_MAXIMIZED ) - { + { ci->hwndChildMaximized = 0; MDI_RestoreFrameMenu( clientWnd->parent, hwnd); MDI_UpdateFrameText( clientWnd->parent, ci->self, MDI_REPAINTFRAME, NULL ); - } + } if( wParam == SIZE_MAXIMIZED ) - { + { HWND16 hMaxChild = ci->hwndChildMaximized; if( hMaxChild == hwnd ) break; if( hMaxChild) - { - SendMessage16( hMaxChild, WM_SETREDRAW, FALSE, 0L ); + { + SendMessage16( hMaxChild, WM_SETREDRAW, FALSE, 0L ); - MDI_RestoreFrameMenu( clientWnd->parent, hMaxChild); - ShowWindow16( hMaxChild, SW_SHOWNOACTIVATE); + MDI_RestoreFrameMenu( clientWnd->parent, hMaxChild); + ShowWindow16( hMaxChild, SW_SHOWNOACTIVATE); - SendMessage16( hMaxChild, WM_SETREDRAW, TRUE, 0L ); - } + SendMessage16( hMaxChild, WM_SETREDRAW, TRUE, 0L ); + } dprintf_mdi(stddeb,"\tMDI: maximizing child %04x\n", hwnd ); @@ -1379,16 +1371,16 @@ LRESULT WINAPI DefMDIChildProc16( HWND16 hwnd, UINT16 message, MDI_AugmentFrameMenu( ci, clientWnd->parent, hwnd); MDI_UpdateFrameText( clientWnd->parent, ci->self, MDI_REPAINTFRAME, NULL ); - } + } if( wParam == SIZE_MINIMIZED ) - { - HWND16 switchTo = MDI_GetWindow(clientWnd, hwnd, 0); + { + HWND16 switchTo = MDI_GetWindow(clientWnd, hwnd, TRUE, WS_MINIMIZE); if( switchTo ) SendMessage16( switchTo, WM_CHILDACTIVATE, 0, 0L); - } - + } + MDI_PostUpdate(clientWnd->hwndSelf, ci, SB_BOTH+1); break; diff --git a/windows/message.c b/windows/message.c index 6d4aa846824..9470710a971 100644 --- a/windows/message.c +++ b/windows/message.c @@ -54,6 +54,32 @@ BOOL32 MSG_CheckFilter(WORD uMsg, DWORD filter) return TRUE; } +/*********************************************************************** + * MSG_SendParentNotify + * + * Send a WM_PARENTNOTIFY to all ancestors of the given window, unless + * the window has the WS_EX_NOPARENTNOTIFY style. + */ +static void MSG_SendParentNotify(WND* wndPtr, WORD event, WORD idChild, LPARAM lValue) +{ +#define lppt ((LPPOINT16)&lValue) + + /* pt has to be in the client coordinates of the parent window */ + + MapWindowPoints16( 0, wndPtr->hwndSelf, lppt, 1 ); + while (wndPtr) + { + if (!(wndPtr->dwStyle & WS_CHILD) || (wndPtr->dwExStyle & WS_EX_NOPARENTNOTIFY)) break; + lppt->x += wndPtr->rectClient.left; + lppt->y += wndPtr->rectClient.top; + wndPtr = wndPtr->parent; + SendMessage32A( wndPtr->hwndSelf, WM_PARENTNOTIFY, + MAKEWPARAM( event, idChild ), lValue ); + } +#undef lppt +} + + /*********************************************************************** * MSG_TranslateMouseMsg * @@ -192,8 +218,7 @@ static DWORD MSG_TranslateMouseMsg( HWND16 hTopWnd, DWORD filter, * notification message is still WM_L/M/RBUTTONDOWN. */ - WIN_SendParentNotify( hWnd, msg->message, 0, - MAKELPARAM( screen_pt.x, screen_pt.y ) ); + MSG_SendParentNotify( pWnd, msg->message, 0, MAKELPARAM(screen_pt.x, screen_pt.y) ); /* Activate the window if needed */ diff --git a/windows/nonclient.c b/windows/nonclient.c index 03f60917312..fa30a1edffa 100644 --- a/windows/nonclient.c +++ b/windows/nonclient.c @@ -709,23 +709,23 @@ static void NC_DrawFrame( HDC32 hdc, RECT32 *rect, BOOL32 dlgFrame, lpt[4].x = lpt[0].x = rect->left; lpt[5].x = lpt[1].x = rect->left + width; - lpt[6].x = lpt[2].x = rect->right - width - 1; - lpt[7].x = lpt[3].x = rect->right - 1; + lpt[6].x = lpt[2].x = rect->right - 1; + lpt[7].x = lpt[3].x = rect->right - width - 1; lpt[0].y = lpt[1].y = lpt[2].y = lpt[3].y = rect->top + SYSMETRICS_CYFRAME + SYSMETRICS_CYSIZE; lpt[4].y = lpt[5].y = lpt[6].y = lpt[7].y = - rect->bottom - 1 - SYSMETRICS_CYFRAME - SYSMETRICS_CYSIZE; + rect->bottom - SYSMETRICS_CYFRAME - SYSMETRICS_CYSIZE; lpt[8].x = lpt[9].x = lpt[10].x = lpt[11].x = rect->left + SYSMETRICS_CXFRAME + SYSMETRICS_CXSIZE; lpt[12].x = lpt[13].x = lpt[14].x = lpt[15].x = - rect->right - 1 - SYSMETRICS_CXFRAME - SYSMETRICS_CYSIZE; + rect->right - SYSMETRICS_CXFRAME - SYSMETRICS_CYSIZE; lpt[12].y = lpt[8].y = rect->top; lpt[13].y = lpt[9].y = rect->top + height; - lpt[14].y = lpt[10].y = rect->bottom - height - 1; - lpt[15].y = lpt[11].y = rect->bottom - 1; + lpt[14].y = lpt[10].y = rect->bottom - 1; + lpt[15].y = lpt[11].y = rect->bottom - height - 1; GRAPH_DrawLines( hdc, lpt, 8, (HPEN32)0 ); /* 8 is the maximum */ InflateRect32( rect, -width - 1, -height - 1 ); @@ -868,7 +868,7 @@ static void NC_DrawCaption( HDC32 hdc, RECT32 *rect, HWND32 hwnd, } MoveTo( hdc, r.left, r.bottom ); - LineTo32( hdc, r.right-1, r.bottom ); + LineTo32( hdc, r.right, r.bottom ); if (style & WS_SYSMENU) { diff --git a/windows/queue.c b/windows/queue.c index a0f50c42937..f9534cd35c4 100644 --- a/windows/queue.c +++ b/windows/queue.c @@ -85,7 +85,7 @@ void QUEUE_WalkQueues(void) } fprintf( stderr, "%04x %5d %4d %04x %s\n", hQueue, queue->msgSize, queue->msgCount, queue->hTask, - MODULE_GetModuleName( GetExePtr(queue->hTask) ) ); + MODULE_GetModuleName( queue->hTask ) ); hQueue = queue->next; } fprintf( stderr, "\n" ); @@ -761,7 +761,7 @@ BOOL32 WINAPI SetMessageQueue32( INT32 size ) HOOK_ResetQueueHooks( hNewQueue ); if( WIN_GetDesktop()->hmemTaskQ == hQueue ) WIN_GetDesktop()->hmemTaskQ = hNewQueue; - WIN_ResetQueueWindows( WIN_GetDesktop()->child, hQueue, hNewQueue ); + WIN_ResetQueueWindows( WIN_GetDesktop(), hQueue, hNewQueue ); QUEUE_DeleteMsgQueue( hQueue ); } diff --git a/windows/syscolor.c b/windows/syscolor.c index 9f86835cf3d..e722daa0048 100644 --- a/windows/syscolor.c +++ b/windows/syscolor.c @@ -39,7 +39,11 @@ static const char * const DefSysColors[] = "GrayText", "192 192 192", /* COLOR_GRAYTEXT */ "ButtonText", "0 0 0", /* COLOR_BTNTEXT */ "InactiveTitleText", "0 0 0", /* COLOR_INACTIVECAPTIONTEXT */ - "ButtonHilight", "255 255 255" /* COLOR_BTNHIGHLIGHT */ + "ButtonHilight", "255 255 255", /* COLOR_BTNHIGHLIGHT */ + "3DDarkShadow", "32 32 32", /* COLOR_3DDKSHADOW */ + "3DLight", "192 192 192", /* COLOR_3DLIGHT */ + "InfoText", "0 0 0", /* COLOR_INFOTEXT */ + "InfoBackground", "255 255 192" /* COLOR_INFOBK */ }; static const char * const DefSysColors95[] = @@ -64,11 +68,15 @@ static const char * const DefSysColors95[] = "GrayText", "192 192 192", /* COLOR_GRAYTEXT */ "ButtonText", "0 0 0", /* COLOR_BTNTEXT */ "InactiveTitleText", "0 0 0", /* COLOR_INACTIVECAPTIONTEXT */ - "ButtonHilight", "255 255 255" /* COLOR_BTNHIGHLIGHT */ + "ButtonHilight", "255 255 255", /* COLOR_BTNHIGHLIGHT */ + "3DDarkShadow", "32 32 32", /* COLOR_3DDKSHADOW */ + "3DLight", "192 192 192", /* COLOR_3DLIGHT */ + "InfoText", "0 0 0", /* COLOR_INFOTEXT */ + "InfoBackground", "255 255 192" /* COLOR_INFOBK */ }; -#define NUM_SYS_COLORS (COLOR_BTNHIGHLIGHT+1) +#define NUM_SYS_COLORS (COLOR_INFOBK+1) static COLORREF SysColors[NUM_SYS_COLORS]; @@ -80,6 +88,7 @@ static COLORREF SysColors[NUM_SYS_COLORS]; */ static void SYSCOLOR_SetColor( int index, COLORREF color ) { + if (index < 0 || index >= NUM_SYS_COLORS) return; SysColors[index] = color; switch(index) { @@ -149,6 +158,11 @@ static void SYSCOLOR_SetColor( int index, COLORREF color ) DeleteObject32( sysColorObjects.hbrushBtnHighlight ); sysColorObjects.hbrushBtnHighlight = CreateSolidBrush32( color ); break; + case COLOR_3DDKSHADOW: + case COLOR_3DLIGHT: + case COLOR_INFOTEXT: + case COLOR_INFOBK: + break; } } @@ -166,7 +180,7 @@ void SYSCOLOR_Init(void) i < NUM_SYS_COLORS; i++, p += 2) { GetProfileString32A( "colors", p[0], p[1], buffer, 100 ); - if (!sscanf( buffer, " %d %d %d", &r, &g, &b )) r = g = b = 0; + if (sscanf( buffer, " %d %d %d", &r, &g, &b ) != 3) r = g = b = 0; SYSCOLOR_SetColor( i, RGB(r,g,b) ); } } @@ -177,7 +191,7 @@ void SYSCOLOR_Init(void) */ COLORREF WINAPI GetSysColor16( INT16 nIndex ) { - return SysColors[nIndex]; + return GetSysColor32 (nIndex); } @@ -186,15 +200,19 @@ COLORREF WINAPI GetSysColor16( INT16 nIndex ) */ COLORREF WINAPI GetSysColor32( INT32 nIndex ) { - return SysColors[nIndex]; + if (nIndex >= 0 && nIndex < NUM_SYS_COLORS) + return SysColors[nIndex]; + else + return 0; } /************************************************************************* * SetSysColors16 (USER.181) */ +/* FIXME -- check return type and insert comment if correct. */ VOID WINAPI SetSysColors16( INT16 nChanges, const INT16 *lpSysColor, - const COLORREF *lpColorValues ) + const COLORREF *lpColorValues ) { int i; diff --git a/windows/user.c b/windows/user.c index 8c7c9a5e8d4..90e7567fcde 100644 --- a/windows/user.c +++ b/windows/user.c @@ -8,6 +8,7 @@ #include #include #include "windows.h" +#include "resource.h" #include "heap.h" #include "gdi.h" #include "user.h" @@ -22,6 +23,8 @@ WORD USER_HeapSel = 0; +extern HGLOBAL16 LoadDIBCursorHandler( HGLOBAL16, HINSTANCE16, HRSRC16 ); +extern HGLOBAL16 LoadDIBIconHandler( HGLOBAL16, HINSTANCE16, HRSRC16 ); extern BOOL32 MENU_PatchResidentPopup( HQUEUE16, WND* ); extern void QUEUE_FlushMessages(HQUEUE16); @@ -93,6 +96,35 @@ BOOL16 WINAPI TimerCount( TIMERINFO *pTimerInfo ) return TRUE; } +static RESOURCEHANDLER16 __r16loader = NULL; + +/********************************************************************** + * USER_CallDefaultRsrcHandler + * + * Called by the LoadDIBIcon/CursorHandler(). + */ +HGLOBAL16 USER_CallDefaultRsrcHandler( HGLOBAL16 hMemObj, HMODULE16 hModule, HRSRC16 hRsrc ) +{ + return __r16loader( hMemObj, hModule, hRsrc ); +} + +/********************************************************************** + * USER_InstallRsrcHandler + */ +static void USER_InstallRsrcHandler( HINSTANCE16 hInstance ) +{ + FARPROC16 proc; + + /* SetResourceHandler() returns previous function which is set + * when a module's resource table is loaded. */ + + proc = SetResourceHandler( hInstance, RT_ICON, (FARPROC32)LoadDIBIconHandler ); + if(!__r16loader ) + __r16loader = (RESOURCEHANDLER16)proc; + proc = SetResourceHandler( hInstance, RT_CURSOR, (FARPROC32)LoadDIBCursorHandler ); + if(!__r16loader ) + __r16loader = (RESOURCEHANDLER16)proc; +} /********************************************************************** * InitApp (USER.5) @@ -101,6 +133,15 @@ INT16 WINAPI InitApp( HINSTANCE16 hInstance ) { int queueSize; + /* InitTask() calls LibMain()'s of implicitly loaded DLLs + * prior to InitApp() so there is no clean way to do + * SetTaskSignalHandler() in time. So, broken Windows bypasses + * a pTask->userhandler on startup and simply calls a global + * function pointer to the default USER signal handler. + */ + + USER_InstallRsrcHandler( hInstance ); + /* Create task message queue */ queueSize = GetProfileInt32A( "windows", "DefaultQueueSize", 8 ); if (!SetMessageQueue32( queueSize )) return 0; @@ -108,10 +149,19 @@ INT16 WINAPI InitApp( HINSTANCE16 hInstance ) return 1; } +/********************************************************************** + * USER_ModuleUnload + */ +static void USER_ModuleUnload( HMODULE16 hModule ) +{ + HOOK_FreeModuleHooks( hModule ); + CLASS_FreeModuleClasses( hModule ); +} + /********************************************************************** * USER_AppExit */ -void USER_AppExit( HTASK16 hTask, HINSTANCE16 hInstance, HQUEUE16 hQueue ) +static void USER_AppExit( HTASK16 hTask, HINSTANCE16 hInstance, HQUEUE16 hQueue ) { /* FIXME: empty clipboard if needed, maybe destroy menus (Windows * only complains about them but does nothing); @@ -132,12 +182,18 @@ void USER_AppExit( HTASK16 hTask, HINSTANCE16 hInstance, HQUEUE16 hQueue ) HOOK_FreeQueueHooks( hQueue ); QUEUE_SetExitingQueue( hQueue ); - WIN_ResetQueueWindows( desktop->child, hQueue, (HQUEUE16)0); + WIN_ResetQueueWindows( desktop, hQueue, (HQUEUE16)0); QUEUE_SetExitingQueue( 0 ); /* Free the message queue */ QUEUE_DeleteMsgQueue( hQueue ); + + /* ModuleUnload() in "Internals" */ + + hInstance = GetExePtr( hInstance ); + if( GetModuleUsage( hInstance ) <= 1 ) + USER_ModuleUnload( hInstance ); } @@ -159,6 +215,34 @@ void USER_ExitWindows(void) } +/*********************************************************************** + * USER_SignalProc (USER.314) + */ +void WINAPI USER_SignalProc( HANDLE16 hTaskOrModule, UINT16 uCode, + UINT16 uExitFn, HINSTANCE16 hInstance, + HQUEUE16 hQueue ) +{ + switch( uCode ) + { + case USIG_GPF: + case USIG_TERMINATION: + USER_AppExit( hTaskOrModule, hInstance, hQueue ); /* task */ + break; + + case USIG_DLL_LOAD: + USER_InstallRsrcHandler( hTaskOrModule ); /* module */ + break; + + case USIG_DLL_UNLOAD: + USER_ModuleUnload( hTaskOrModule ); /* module */ + break; + + default: + fprintf(stderr,"Unimplemented USER signal: %i\n", (int)uCode ); + } +} + + /*********************************************************************** * ExitWindows16 (USER.7) */ diff --git a/windows/win.c b/windows/win.c index 9f4375bbc10..22d8eaff754 100644 --- a/windows/win.c +++ b/windows/win.c @@ -269,41 +269,6 @@ HWND32 WIN_FindWinToRepaint( HWND32 hwnd, HQUEUE16 hQueue ) } -/*********************************************************************** - * WIN_SendParentNotify - * - * Send a WM_PARENTNOTIFY to all ancestors of the given window, unless - * the window has the WS_EX_NOPARENTNOTIFY style. - */ -void WIN_SendParentNotify(HWND32 hwnd, WORD event, WORD idChild, LPARAM lValue) -{ - LPPOINT16 lppt = (LPPOINT16)&lValue; - WND *wndPtr = WIN_FindWndPtr( hwnd ); - BOOL32 bMouse = ((event <= WM_MOUSELAST) && (event >= WM_MOUSEFIRST)); - - /* if lValue contains cursor coordinates they have to be - * mapped to the client area of parent window */ - - if (bMouse) MapWindowPoints16( 0, hwnd, lppt, 1 ); - - while (wndPtr) - { - if ((wndPtr->dwExStyle & WS_EX_NOPARENTNOTIFY) || - !(wndPtr->dwStyle & WS_CHILD)) break; - - if (bMouse) - { - lppt->x += wndPtr->rectClient.left; - lppt->y += wndPtr->rectClient.top; - } - - wndPtr = wndPtr->parent; - SendMessage32A( wndPtr->hwndSelf, WM_PARENTNOTIFY, - MAKEWPARAM( event, idChild ), lValue ); - } -} - - /*********************************************************************** * WIN_DestroyWindow * @@ -377,20 +342,50 @@ static WND* WIN_DestroyWindow( WND* wndPtr ) /*********************************************************************** * WIN_ResetQueueWindows + * + * Reset the queue of all the children of a given window. + * Return TRUE if something was done. */ -void WIN_ResetQueueWindows( WND* wnd, HQUEUE16 hQueue, HQUEUE16 hNew ) +BOOL32 WIN_ResetQueueWindows( WND* wnd, HQUEUE16 hQueue, HQUEUE16 hNew ) { - WND* next; + BOOL32 ret = FALSE; - while (wnd) + if (hNew) /* Set a new queue */ { - next = wnd->next; - if (wnd->hmemTaskQ == hQueue) - if( hNew ) wnd->hmemTaskQ = hNew; - else DestroyWindow32( wnd->hwndSelf ); - else WIN_ResetQueueWindows( wnd->child, hQueue, hNew ); - wnd = next; + for (wnd = wnd->child; (wnd); wnd = wnd->next) + { + if (wnd->hmemTaskQ == hQueue) + { + wnd->hmemTaskQ = hNew; + ret = TRUE; + } + if (wnd->child) + ret |= WIN_ResetQueueWindows( wnd->child, hQueue, hNew ); + } } + else /* Queue is being destroyed */ + { + while (wnd->child) + { + WND *tmp = wnd->child; + ret = FALSE; + while (tmp) + { + if (tmp->hmemTaskQ == hQueue) + { + DestroyWindow32( tmp->hwndSelf ); + ret = TRUE; + break; + } + if (tmp->child && WIN_ResetQueueWindows(tmp->child,hQueue,0)) + ret = TRUE; + else + tmp = tmp->next; + } + if (!ret) break; + } + } + return ret; } /*********************************************************************** @@ -465,7 +460,7 @@ static HWND32 WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom, WND *wndPtr; HWND16 hwnd, hwndLinkAfter; POINT32 maxSize, maxPos, minTrack, maxTrack; - LRESULT (*localSend32)(HWND32, UINT32, WPARAM32, LPARAM); + LRESULT (WINAPI *localSend32)(HWND32, UINT32, WPARAM32, LPARAM); dprintf_win( stddeb, "CreateWindowEx: " ); if (HIWORD(cs->lpszName)) dprintf_win( stddeb, "'%s' ", cs->lpszName ); @@ -495,9 +490,7 @@ static HWND32 WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom, } /* Find the window class */ - - if (!(classPtr = CLASS_FindClassByAtom( classAtom, - GetExePtr(cs->hInstance) ))) + if (!(classPtr = CLASS_FindClassByAtom( classAtom, win32?cs->hInstance:GetExePtr(cs->hInstance) ))) { char buffer[256]; GlobalGetAtomName32A( classAtom, buffer, sizeof(buffer) ); @@ -703,8 +696,11 @@ static HWND32 WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom, LoadMenu(cs->hInstance,SEGPTR_GET(classPtr->menuNameA)): LoadMenu(cs->hInstance,(SEGPTR)classPtr->menuNameA); #else - SEGPTR menuName = (SEGPTR)GetClassLong16( hwnd, GCL_MENUNAME ); - if (menuName) cs->hMenu = LoadMenu16( cs->hInstance, menuName ); + SEGPTR menuName = (SEGPTR)GetClassLong16( hwnd, GCL_MENUNAME ); + if (HIWORD(cs->hInstance)) + cs->hMenu = LoadMenu32A(cs->hInstance,PTR_SEG_TO_LIN(menuName)); + else + cs->hMenu = LoadMenu16(cs->hInstance,menuName); #endif } if (cs->hMenu) SetMenu32( hwnd, cs->hMenu ); @@ -732,6 +728,7 @@ static HWND32 WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom, if (!(wndPtr->flags & WIN_NEED_SIZE)) { /* send it anyway */ + SendMessage32A( hwnd, WM_SIZE, SIZE_RESTORED, MAKELONG(wndPtr->rectClient.right-wndPtr->rectClient.left, wndPtr->rectClient.bottom-wndPtr->rectClient.top)); @@ -740,28 +737,28 @@ static HWND32 WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom, wndPtr->rectClient.top ) ); } - WIN_SendParentNotify( hwnd, WM_CREATE, wndPtr->wIDmenu, (LPARAM)hwnd ); - if (!IsWindow32(hwnd)) return 0; - /* Show the window, maximizing or minimizing if needed */ - if (wndPtr->dwStyle & WS_MINIMIZE) + if (wndPtr->dwStyle & (WS_MINIMIZE | WS_MAXIMIZE)) { RECT16 newPos; + UINT16 swFlag = (wndPtr->dwStyle & WS_MINIMIZE) ? SW_MINIMIZE : SW_MAXIMIZE; wndPtr->dwStyle &= ~(WS_MAXIMIZE | WS_MINIMIZE); - WINPOS_MinMaximize( wndPtr, SW_MINIMIZE, &newPos ); - SetWindowPos32( hwnd, 0, newPos.left, newPos.top, newPos.right, newPos.bottom, - SWP_FRAMECHANGED | ((GetActiveWindow32())? SWP_NOACTIVATE : 0)); - } - else if (wndPtr->dwStyle & WS_MAXIMIZE) - { - RECT16 newPos; - wndPtr->dwStyle &= ~(WS_MAXIMIZE | WS_MINIMIZE); - WINPOS_MinMaximize( wndPtr, SW_MAXIMIZE, &newPos ); - SetWindowPos32( hwnd, 0, newPos.left, newPos.top, newPos.right, newPos.bottom, - ((GetActiveWindow32())? SWP_NOACTIVATE : 0) | SWP_FRAMECHANGED ); + WINPOS_MinMaximize( wndPtr, swFlag, &newPos ); + swFlag = ((wndPtr->dwStyle & WS_CHILD) || GetActiveWindow32()) ? SWP_NOACTIVATE : 0; + SetWindowPos32( hwnd, 0, newPos.left, newPos.top, + newPos.right, newPos.bottom, SWP_FRAMECHANGED | swFlag ); } + if( wndPtr->dwStyle & WS_CHILD && !(wndPtr->dwExStyle & WS_EX_NOPARENTNOTIFY) ) + { + /* Notify the parent window only */ + + SendMessage32A( wndPtr->parent->hwndSelf, WM_PARENTNOTIFY, + MAKEWPARAM(WM_CREATE, wndPtr->wIDmenu), (LPARAM)hwnd ); + if( !IsWindow32(hwnd) ) return 0; + } + if (cs->style & WS_VISIBLE) ShowWindow32( hwnd, SW_SHOW ); /* Call WH_SHELL hook */ @@ -1000,8 +997,13 @@ BOOL32 WINAPI DestroyWindow32( HWND32 hwnd ) } if( !QUEUE_IsExitingQueue(wndPtr->hmemTaskQ) ) - WIN_SendParentNotify( hwnd, WM_DESTROY, wndPtr->wIDmenu, (LPARAM)hwnd ); - if (!IsWindow32(hwnd)) return TRUE; + if( wndPtr->dwStyle & WS_CHILD && !(wndPtr->dwExStyle & WS_EX_NOPARENTNOTIFY) ) + { + /* Notify the parent window only */ + SendMessage32A( wndPtr->parent->hwndSelf, WM_PARENTNOTIFY, + MAKEWPARAM(WM_DESTROY, wndPtr->wIDmenu), (LPARAM)hwnd ); + if( !IsWindow32(hwnd) ) return TRUE; + } if( wndPtr->window ) CLIPBOARD_DisOwn( wndPtr ); /* before window is unmapped */ @@ -1020,7 +1022,7 @@ BOOL32 WINAPI DestroyWindow32( HWND32 hwnd ) if( !(wndPtr->dwStyle & WS_CHILD) ) { /* make sure top menu popup doesn't get destroyed */ - MENU_PatchResidentPopup( TRUE, wndPtr ); + MENU_PatchResidentPopup( (HQUEUE16)0xFFFF, wndPtr ); for (;;) { @@ -1214,7 +1216,7 @@ HWND32 WINAPI FindWindowEx32A( HWND32 parent, HWND32 child, /* with this name exists either. */ if (!(atom = GlobalFindAtom32A( className ))) return 0; } - return WIN_FindWindow( 0, 0, atom, title ); + return WIN_FindWindow( parent, child, atom, title ); } @@ -1235,7 +1237,7 @@ HWND32 WINAPI FindWindowEx32W( HWND32 parent, HWND32 child, if (!(atom = GlobalFindAtom32W( className ))) return 0; } buffer = HEAP_strdupWtoA( GetProcessHeap(), 0, title ); - hwnd = WIN_FindWindow( 0, 0, atom, buffer ); + hwnd = WIN_FindWindow( parent, child, atom, buffer ); HeapFree( GetProcessHeap(), 0, buffer ); return hwnd; } @@ -1388,9 +1390,15 @@ WORD WINAPI GetWindowWord32( HWND32 hwnd, INT32 offset ) } switch(offset) { - case GWW_ID: return (WORD)wndPtr->wIDmenu; + case GWW_ID: + if (HIWORD(wndPtr->wIDmenu)) + fprintf(stderr,"GetWindowWord32(GWW_ID) discards high bits of 0x%08x!\n",wndPtr->wIDmenu); + return (WORD)wndPtr->wIDmenu; case GWW_HWNDPARENT: return wndPtr->parent ? wndPtr->parent->hwndSelf : 0; - case GWW_HINSTANCE: return (WORD)wndPtr->hInstance; + case GWW_HINSTANCE: + if (HIWORD(wndPtr->hInstance)) + fprintf(stderr,"GetWindowWord32(GWW_HINSTANCE) discards high bits of 0x%08x!\n",wndPtr->hInstance); + return (WORD)wndPtr->hInstance; default: fprintf( stderr, "GetWindowWord: invalid offset %d\n", offset ); return 0; @@ -1401,10 +1409,10 @@ WORD WINAPI GetWindowWord32( HWND32 hwnd, INT32 offset ) /********************************************************************** * WIN_GetWindowInstance */ -HINSTANCE16 WIN_GetWindowInstance( HWND32 hwnd ) +HINSTANCE32 WIN_GetWindowInstance( HWND32 hwnd ) { WND * wndPtr = WIN_FindWndPtr( hwnd ); - if (!wndPtr) return (HINSTANCE16)0; + if (!wndPtr) return (HINSTANCE32)0; return wndPtr->hInstance; } @@ -1483,7 +1491,7 @@ static LONG WIN_GetWindowLong( HWND32 hwnd, INT32 offset, WINDOWPROCTYPE type ) type ); case GWL_HWNDPARENT: return wndPtr->parent ? (HWND32)wndPtr->parent->hwndSelf : 0; - case GWL_HINSTANCE: return (HINSTANCE32)wndPtr->hInstance; + case GWL_HINSTANCE: return wndPtr->hInstance; default: fprintf( stderr, "GetWindowLong: unknown offset %d\n", offset ); } @@ -1501,6 +1509,7 @@ static LONG WIN_SetWindowLong( HWND32 hwnd, INT32 offset, LONG newval, { LONG *ptr, retval; WND * wndPtr = WIN_FindWndPtr( hwnd ); + if (!wndPtr) return 0; if (offset >= 0) { @@ -1522,8 +1531,10 @@ static LONG WIN_SetWindowLong( HWND32 hwnd, INT32 offset, LONG newval, else switch(offset) { case GWL_ID: + ptr = (DWORD*)&wndPtr->wIDmenu; + break; case GWL_HINSTANCE: - return SetWindowWord32( hwnd, offset, (WORD)newval ); + return SetWindowWord32( hwnd, offset, newval ); case GWL_WNDPROC: retval = (LONG)WINPROC_GetProc( wndPtr->winproc, type ); WINPROC_SetProc( &wndPtr->winproc, (WNDPROC16)newval, diff --git a/windows/winhelp.c b/windows/winhelp.c index 856d2d5b011..89be98bf22c 100644 --- a/windows/winhelp.c +++ b/windows/winhelp.c @@ -52,11 +52,12 @@ BOOL32 WINAPI WinHelp32A( HWND32 hWnd, LPCSTR lpHelpFile, UINT32 wCommand, switch(wCommand) { case HELP_CONTEXT: - case HELP_CONTENTS: case HELP_SETCONTENTS: + case HELP_CONTENTS: case HELP_CONTEXTPOPUP: case HELP_FORCEFILE: case HELP_HELPONHELP: + case HELP_FINDER: case HELP_QUIT: dsize=0; break; diff --git a/windows/winpos.c b/windows/winpos.c index e418e7e2929..b7cadcbbeb3 100644 --- a/windows/winpos.c +++ b/windows/winpos.c @@ -274,10 +274,9 @@ void WINAPI GetClientRect32( HWND32 hwnd, LPRECT32 rect ) /******************************************************************* * ClientToScreen16 (USER.28) */ -BOOL16 WINAPI ClientToScreen16( HWND16 hwnd, LPPOINT16 lppnt ) +void WINAPI ClientToScreen16( HWND16 hwnd, LPPOINT16 lppnt ) { MapWindowPoints16( hwnd, 0, lppnt, 1 ); - return TRUE; } @@ -1566,14 +1565,19 @@ LONG WINPOS_SendNCCalcSize( HWND32 hwnd, BOOL32 calcValidRect, */ LONG WINPOS_HandleWindowPosChanging16( WND *wndPtr, WINDOWPOS16 *winpos ) { - POINT32 maxSize; + POINT32 maxSize, minTrack; if (winpos->flags & SWP_NOSIZE) return 0; if ((wndPtr->dwStyle & WS_THICKFRAME) || ((wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) == 0)) { - WINPOS_GetMinMaxInfo( wndPtr, &maxSize, NULL, NULL, NULL ); - winpos->cx = MIN( winpos->cx, maxSize.x ); - winpos->cy = MIN( winpos->cy, maxSize.y ); + WINPOS_GetMinMaxInfo( wndPtr, &maxSize, NULL, &minTrack, NULL ); + if (maxSize.x < winpos->cx) winpos->cx = maxSize.x; + if (maxSize.y < winpos->cy) winpos->cy = maxSize.y; + if (!(wndPtr->dwStyle & WS_MINIMIZE)) + { + if (winpos->cx < minTrack.x ) winpos->cx = minTrack.x; + if (winpos->cy < minTrack.y ) winpos->cy = minTrack.y; + } } return 0; } @@ -2380,14 +2384,19 @@ HDWP32 WINAPI DeferWindowPos32( HDWP32 hdwp, HWND32 hwnd, HWND32 hwndAfter, int i; HDWP32 newhdwp = hdwp; HWND32 parent; + WND *pWnd; pDWP = (DWP *) USER_HEAP_LIN_ADDR( hdwp ); if (!pDWP) return 0; if (hwnd == GetDesktopWindow32()) return 0; - /* All the windows of a DeferWindowPos() must have the same parent */ - - parent = WIN_FindWndPtr( hwnd )->parent->hwndSelf; + /* All the windows of a DeferWindowPos() must have the same parent */ + if (!(pWnd=WIN_FindWndPtr( hwnd ))) { + USER_HEAP_FREE( hdwp ); + return 0; + } + + parent = pWnd->parent->hwndSelf; if (pDWP->actualCount == 0) pDWP->hwndParent = parent; else if (parent != pDWP->hwndParent) { diff --git a/windows/winproc.c b/windows/winproc.c index b2a9207b9e9..267029e0b04 100644 --- a/windows/winproc.c +++ b/windows/winproc.c @@ -42,11 +42,6 @@ typedef struct BYTE pushl_func; /* pushl $proc */ WNDPROC16 proc WINE_PACKED; BYTE pushl_eax; /* pushl %eax */ - BYTE pushl_ebp; /* pushl %ebp */ - BYTE pushl_name; /* pushl $name */ - LPCSTR name WINE_PACKED; - BYTE pushl_thunk; /* pushl $thunkfrom32 */ - void (*thunk32)() WINE_PACKED; BYTE jmp; /* jmp relay (relative jump)*/ void (*relay)() WINE_PACKED; /* WINPROC_CallProc32ATo16() */ } WINPROC_THUNK_FROM32; @@ -87,15 +82,14 @@ LRESULT WINPROC_CallProc16To32A( HWND16 hwnd, UINT16 msg, LRESULT WINPROC_CallProc16To32W( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPARAM lParam, WNDPROC32 func ); -static LRESULT WINPROC_CallProc32ATo16( WNDPROC16 func, HWND32 hwnd, - UINT32 msg, WPARAM32 wParam, - LPARAM lParam ); -static LRESULT WINPROC_CallProc32WTo16( WNDPROC16 func, HWND32 hwnd, - UINT32 msg, WPARAM32 wParam, - LPARAM lParam ); +static LRESULT WINAPI WINPROC_CallProc32ATo16( WNDPROC16 func, HWND32 hwnd, + UINT32 msg, WPARAM32 wParam, + LPARAM lParam ); +static LRESULT WINAPI WINPROC_CallProc32WTo16( WNDPROC16 func, HWND32 hwnd, + UINT32 msg, WPARAM32 wParam, + LPARAM lParam ); extern void CallFrom16_long_wwwll(void); -extern void CallFrom32_stdcall_5(void); static HANDLE32 WinProcHeap; @@ -105,7 +99,6 @@ static LRESULT WINPROC_CallWndProc32( WNDPROC32 proc, HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam ); static WINPROC_CALLWNDPROC16 WINPROC_CallWndProc16Ptr = WINPROC_CallWndProc16; -static WINPROC_CALLWNDPROC32 WINPROC_CallWndProc32Ptr = WINPROC_CallWndProc32; /********************************************************************** @@ -143,8 +136,8 @@ static LRESULT WINPROC_CallWndProc16( WNDPROC16 proc, HWND16 hwnd, UINT16 msg, static LRESULT WINPROC_CallWndProc32( WNDPROC32 proc, HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam ) { -/* dprintf_relay( stddeb, "CallTo32(wndproc=%p,hwnd=%08x,msg=%08x,wp=%08x,lp=%08lx)\n", - proc, hwnd, msg, wParam, lParam ); */ + dprintf_relay( stddeb, "CallTo32(wndproc=%p,hwnd=%08x,msg=%08x,wp=%08x,lp=%08lx)\n", + proc, hwnd, msg, wParam, lParam ); return proc( hwnd, msg, wParam, lParam ); } @@ -158,15 +151,6 @@ void WINPROC_SetCallWndProc16( WINPROC_CALLWNDPROC16 proc ) } -/********************************************************************** - * WINPROC_SetCallWndProc32 - */ -void WINPROC_SetCallWndProc32( WINPROC_CALLWNDPROC32 proc ) -{ - WINPROC_CallWndProc32Ptr = proc; -} - - /********************************************************************** * WINPROC_GetPtr * @@ -238,14 +222,9 @@ static WINDOWPROC *WINPROC_AllocWinProc( WNDPROC16 func, WINDOWPROCTYPE type, proc->thunk.t_from32.pushl_func = 0x68; /* pushl $proc */ proc->thunk.t_from32.proc = func; proc->thunk.t_from32.pushl_eax = 0x50; /* pushl %eax */ - proc->thunk.t_from32.pushl_ebp = 0x55; /* pushl %ebp */ - proc->thunk.t_from32.pushl_name = 0x68; /* pushl $name */ - proc->thunk.t_from32.name = "WINPROC_CallProc32ATo16"; - proc->thunk.t_from32.pushl_thunk = 0x68; /* pushl $thunkfrom32 */ - proc->thunk.t_from32.thunk32 = (void(*)())WINPROC_CallProc32ATo16; proc->thunk.t_from32.jmp = 0xe9; /* jmp relay*/ proc->thunk.t_from32.relay = /* relative jump */ - (void (*)())((DWORD)CallFrom32_stdcall_5 - + (void(*)())((DWORD)WINPROC_CallProc32ATo16 - (DWORD)(&proc->thunk.t_from32.relay + 1)); break; case WIN_PROC_32A: @@ -1723,7 +1702,7 @@ static LRESULT WINPROC_CallProc32ATo32W( WNDPROC32 func, HWND32 hwnd, LRESULT result; if (WINPROC_MapMsg32ATo32W( msg, wParam, &lParam ) == -1) return 0; - result = WINPROC_CallWndProc32Ptr( func, hwnd, msg, wParam, lParam ); + result = WINPROC_CallWndProc32( func, hwnd, msg, wParam, lParam ); WINPROC_UnmapMsg32ATo32W( msg, wParam, lParam ); return result; } @@ -1741,7 +1720,7 @@ static LRESULT WINPROC_CallProc32WTo32A( WNDPROC32 func, HWND32 hwnd, LRESULT result; if (WINPROC_MapMsg32WTo32A( msg, wParam, &lParam ) == -1) return 0; - result = WINPROC_CallWndProc32Ptr( func, hwnd, msg, wParam, lParam ); + result = WINPROC_CallWndProc32( func, hwnd, msg, wParam, lParam ); WINPROC_UnmapMsg32WTo32A( msg, wParam, lParam ); return result; } @@ -1762,7 +1741,7 @@ LRESULT WINPROC_CallProc16To32A( HWND16 hwnd, UINT16 msg, if (WINPROC_MapMsg16To32A( msg, wParam, &msg32, &wParam32, &lParam ) == -1) return 0; - result = WINPROC_CallWndProc32Ptr( func, hwnd, msg32, wParam32, lParam ); + result = WINPROC_CallWndProc32( func, hwnd, msg32, wParam32, lParam ); WINPROC_UnmapMsg16To32A( msg32, wParam32, lParam ); return result; } @@ -1783,7 +1762,7 @@ LRESULT WINPROC_CallProc16To32W( HWND16 hwnd, UINT16 msg, if (WINPROC_MapMsg16To32W( msg, wParam, &msg32, &wParam32, &lParam ) == -1) return 0; - result = WINPROC_CallWndProc32Ptr( func, hwnd, msg32, wParam32, lParam ); + result = WINPROC_CallWndProc32( func, hwnd, msg32, wParam32, lParam ); WINPROC_UnmapMsg16To32W( msg32, wParam32, lParam ); return result; } @@ -1794,9 +1773,9 @@ LRESULT WINPROC_CallProc16To32W( HWND16 hwnd, UINT16 msg, * * Call a 16-bit window procedure, translating the 32-bit args. */ -static LRESULT WINPROC_CallProc32ATo16( WNDPROC16 func, HWND32 hwnd, - UINT32 msg, WPARAM32 wParam, - LPARAM lParam ) +static LRESULT WINAPI WINPROC_CallProc32ATo16( WNDPROC16 func, HWND32 hwnd, + UINT32 msg, WPARAM32 wParam, + LPARAM lParam ) { UINT16 msg16; MSGPARAM16 mp16; @@ -1821,9 +1800,9 @@ static LRESULT WINPROC_CallProc32ATo16( WNDPROC16 func, HWND32 hwnd, * * Call a 16-bit window procedure, translating the 32-bit args. */ -static LRESULT WINPROC_CallProc32WTo16( WNDPROC16 func, HWND32 hwnd, - UINT32 msg, WPARAM32 wParam, - LPARAM lParam ) +static LRESULT WINAPI WINPROC_CallProc32WTo16( WNDPROC16 func, HWND32 hwnd, + UINT32 msg, WPARAM32 wParam, + LPARAM lParam ) { UINT16 msg16; MSGPARAM16 mp16; @@ -1906,12 +1885,11 @@ LRESULT WINAPI CallWindowProc32A( WNDPROC32 func, HWND32 hwnd, UINT32 msg, { WINDOWPROC *proc = WINPROC_GetPtr( (WNDPROC16)func ); - if (!proc) return WINPROC_CallWndProc32Ptr( func, hwnd, msg, - wParam, lParam ); + if (!proc) return WINPROC_CallWndProc32( func, hwnd, msg, wParam, lParam ); #if testing func = WINPROC_GetProc( (HWINDOWPROC)proc, WIN_PROC_32A ); - return WINPROC_CallWndProc32Ptr( func, hwnd, msg, wParam, lParam ); + return WINPROC_CallWndProc32( func, hwnd, msg, wParam, lParam ); #endif switch(proc->type) @@ -1922,8 +1900,8 @@ LRESULT WINAPI CallWindowProc32A( WNDPROC32 func, HWND32 hwnd, UINT32 msg, hwnd, msg, wParam, lParam ); case WIN_PROC_32A: if (!proc->thunk.t_from16.proc) return 0; - return WINPROC_CallWndProc32Ptr( proc->thunk.t_from16.proc, - hwnd, msg, wParam, lParam ); + return WINPROC_CallWndProc32( proc->thunk.t_from16.proc, + hwnd, msg, wParam, lParam ); case WIN_PROC_32W: if (!proc->thunk.t_from16.proc) return 0; return WINPROC_CallProc32ATo32W( proc->thunk.t_from16.proc, @@ -1943,12 +1921,11 @@ LRESULT WINAPI CallWindowProc32W( WNDPROC32 func, HWND32 hwnd, UINT32 msg, { WINDOWPROC *proc = WINPROC_GetPtr( (WNDPROC16)func ); - if (!proc) return WINPROC_CallWndProc32Ptr( func, hwnd, msg, - wParam, lParam ); + if (!proc) return WINPROC_CallWndProc32( func, hwnd, msg, wParam, lParam ); #if testing func = WINPROC_GetProc( (HWINDOWPROC)proc, WIN_PROC_32W ); - return WINPROC_CallWndProc32Ptr( func, hwnd, msg, wParam, lParam ); + return WINPROC_CallWndProc32( func, hwnd, msg, wParam, lParam ); #endif switch(proc->type) @@ -1963,8 +1940,8 @@ LRESULT WINAPI CallWindowProc32W( WNDPROC32 func, HWND32 hwnd, UINT32 msg, hwnd, msg, wParam, lParam ); case WIN_PROC_32W: if (!proc->thunk.t_from16.proc) return 0; - return WINPROC_CallWndProc32Ptr( proc->thunk.t_from16.proc, - hwnd, msg, wParam, lParam ); + return WINPROC_CallWndProc32( proc->thunk.t_from16.proc, + hwnd, msg, wParam, lParam ); default: fprintf( stderr, "CallWindowProc32W: invalid proc %p\n", proc ); return 0;