Commit 7e56f684 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 960131

Wed Jan 31 10:58:00 1996 Alexandre Julliard <julliard@sunsite.unc.edu> * [configure.in] Added --with-dll option to build libwine.so. * [controls/listbox.c] Fixed ListBoxDirectory(), DlgDirSelect() and DlgDirList(). Hopefully their behavior is correct now. * [controls/menu.c] Use SEGPTRs in ChangeMenu(), InsertMenu(), AppendMenu() and ModifyMenu() for the item data, to avoid corrupting the pointer for owner-drawn items. * [controls/static.c] Attempt to load OEM icons for SS_ICON controls. Probably not entirely correct. Don't clip the text output. * [files/directory.c] Add temp dir and Windows dir to environment. * [files/dos_fs.c] Fixed a few path handling bugs in DOSFS_GetUnixFileName(). Cache last used directory in DOSFS_FindNext() to avoid quadratic search time. * [files/drive.c] New format for drives configuration in wine.conf; allows specifying the type, label and serial number of a drive. * [files/file.c] New function FILE_OpenUnixFile to make sure we don't open a directory instead of a file. Fixed DOSFS_GetUnixFileName() check_last flag in FILE_MakeDir(). * [files/profile.c] Rewrote profile handling. Should be closer to Windows behavior now. New function PROFILE_GetWineIniString() to get a string from wine.conf. Support environment variables in wine.conf. * [loader/task.c] Fixed the order of deletion in TASK_DeleteTask() to avoid memory corruption. * [memory/global.c] Create a discarded block on GlobalAlloc() if the size is 0; thanks to John Harvey for noticing this. * [memory/local.c] LOCAL_GetHeap: make sure the pointer is valid before checking magic number. * [misc/main.c] Moved profile and registry saving to ExitWindows(), so we don't try to save them in case of a crash. * [miscemu/int21.c] INT21_GetFreeDiskSpace: try to compute the cluster size from the filesystem size instead of hard-coding it to 64. Fixed functions 0x3f and 0x40 to use _hread and _hwrite to allow reading or writing 65535 bytes (thanks to Bruce Milner for this one). * [windows/message.c] Fixed bug in linked-list handling in MSG_DeleteQueue(). Simplified SetMessageQueue(). * [wine.ini] [wine.man] Updated for new drives configuration format. Tue Jan 30 11:24:46 1996 William Magro <wmagro@tc.cornell.edu> * [controls/edit.c] Implemented ES_PASSWORD style, EM_SETPASSWORDCHAR and EM_GETPASSWORDCHAR messages. * [controls/widgets.c] Adjusted class creation flags to better match values Windows uses. * [include/windows.h] Fixed ES_NOHIDESEL typo. * [loader/ne_image.c] Added detection for zero offset in RADDR fixups. Quicken was in an infinite loop here. Mon Jan 29 20:12:22 1996 Albrecht Kleine <kleine@ak.sax.de> * [files/dos_fs.c] Bugfix: range error in month value (0..11 set to 1..12). * [windows/caret.c] Changed ROP2-mode to R2_NOTXORPEN in CARET_Callback for pulsed appearance of the caret. * [windows/mdi.c] [include/mdi.h] Changed MDITile(): added a new parameter WORD wParam for WM_MDITILE second tiling method (MDITILE_HORIZONTAL in wParam) as used in Win3.1 Sun Jan 28 14:20:00 1996 Cameron Heide <heide@ee.ualberta.ca> * [miscemu/int2f.c] Added a small bit of MSCDEX emulation. * [windows/alias.c] ALIAS_RegisterAlias was returning the hash value when it should have been returning the record number. Sat Jan 27 10:53:51 1996 Jim Peterson <jspeter@birch.ee.vt.edu> * [include/shell.h] [include/wintypes.h] Moved definition of HKEY and LPHKEY types to include/wintypes.h. Declared FONTENUMPROC in wintypes.h. * [include/windows.h] Added definition of KERNINGPAIR and LPKERNINGPAIR types. Added declarations for CopyCursor(), CopyIcon(), EnumFontFamilies(), ExtractIcon(), FatalAppExit(), FindExecutable(), GetClipCursor(), GetKerningPairs(), GetQueueStatus(), GetRasterizerCaps(), IsGDIObject(), IsMenu(), IsTask(), RegCloseKey(), RegCreateKey(), RegDeleteKey(), RegEnumKey(), RegOpenKey(), RegQueryValue(), RegSetValue(), ResetDC(), ShellExecute(), SystemParametersInfo(), and wsprintf(). * [tools/makehtml.pl] [documentation/apiw.index] New files that scan windows.h, commdlg.h, and toolhelp.h and output an HTML sorted list with optional links to www.willows.com and a tally of unimplemented APIW functions. * [objects/cursoricon.c] Added Win32 versions of CopyIcon() and CopyCursor() for use in libwine. * [win32/resource.c] [win32/winprocs.c] Added '#include "libres.h"' and explicit declarations of windows procs in order to avoid warnings. * [windows/utility.c] Added Win32 version of MulDiv() for libwine. * [*/*] [include/windows.h] Changed several function declarations to comply more strictly to the windows API (without, hopefully, altering their functionality). * [controls/menu.c] Made the return value of CheckMenuItem be the previous state of the menu item if it was found, otherwise -1 as specified in the SDK. This conflicts with the APIW specification, which says it should return TRUE if successful, otherwise FALSE. * [include/windows.h] Added obsolete WM_SIZE message wParam names for compatibility. Added WinHelp() command constants, even though they are not yet supported. * [rc/winerc.c] Tidied up transform_binary_file(). In argument checking, flattened any invalid characters specified with the prefix argument. * [library/libres.c] Made FindResource() case-insensitive when parameter 'name' is a string. Sat Jan 27 02:30 1996 Uwe Bonnes <bon@elektron.ikp.physik.th-darmstadt.de * [files/drive.c] If root "/" is given in wine.conf, use it as last resort. * [files/file.c] Report ER_AccessDenied it disk ist not writable More Debug Output * [miscemu/int21.c] Squeezed some bugs in ExtendedOpenCreateFile * [windows/winpos.c] Some windows may not be moved or resized. We are missing some structures to be exact, but the approach should help in some cases and make things worse in much fewer. Fri Jan 26 10:24:00 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk> * [loader/pe_image.c] fixup_imports: Find builtins for Borland style entries, too Fri Jan 26 10:24:00 1996 Martin von Loewis <loewis@informatik.hu-berlin.de> * [controls/menu.c] LoadMenu: branch to Win32 for PE modules * [if1632/gdi.spec][if1632/kernel32.spec][if1632/user32.spec] DeleteObject, GetPixel, SetPixel,WritePrivateProfileStringA, WriteProfileStringA, EmptyClipboard, EnableMenuItem, EnableScrollBar, EnableWindow, InvalidateRect, SetWindowTextA, WinHelpA: new relays DrawTextA, MoveToEx, GetClientRect, InvalidateRect, LoadBitmapA/W, LoadAcceleratorsA/W, LoadMenu[Indirect]A/W, LoadStringA/W: changed to convert parameters or naming convention * [include/kernel32.h][include/wintypes.h] moved WCHAR, defined LPWSTR * [include/string32.h][win32/string32.c][include/struct32.h] New files * [loader/module.h] LoadModule: exit after returning from PE_LoadModule * [loader/pe_image.c] my_wcstombs: isascii does not work on Linux for Unicode PE_LoadImage: Handle directories * [misc/user32.c] USER32_RECT32to16, USER32_RECT16to32: new functions implemented new user32 relays * [misc/newfns.c] WIN32_WinHelpA: new function * [win32/param32.c] New file * [win32/resource.c] GetResDirEntry: added support for named entries WIN32_LoadAcceleratorsW: invoke *32 resource functions WIN32_LoadBitmapA: convert name to unicode if appropriate WIN32_ParseMenu: new function implemented new resource functions from user32.spec Wed Jan 24 18:09:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu> * [objects/cursoricon.c] GetIconId() and LoadIconHandler() functions. * [windows/mdi.c] Better maximization support, TranslateMDISysAccel() function, misc improvements. * [windows/defwnd.c] Fix for WM_WINDOWPOSCHANGED message handler. * [windows/winpos.c] Rewrote WindowFromPoint() function. Sun Jan 21 1996 17:05:09 Marcus Meissner <msmeissn@faui01.informatik.uni-erlangen.de> * [include/toolhelp.h] [misc/toolhelp.c] Added Notify(Un)Register, but no callbacks yet. Fri Jan 19 01:43:37 1996 Victor Schneider <root@tailor.roman.org> * [Makefile.in] Added target for libwine.so.1.0. * [library/winmain.c] For WINELIBDLL, _WinMain just returns hInstance instead of calling WinMain(). * [misc/main.c] For WINELIBDLL, renamed main() to _wine_main() for calling from the stub main function. * [library/winestub.c] (new file) Provides a stub main() function for using libwine.so. Tue Jan 16 11:04:34 1996 Anand Kumria <akumria@ozemail.com.au> * [winsocket.c] Fix EPERM problem. * [global.c] Attempt to do some sanity checking in MemManInfo(). * [Changelog] Fix changelog oversight for previous entry.
parent 4f8c37b4
This is release 960114 of Wine the MS Windows emulator. This is still a
This is release 960131 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.
Patches should be submitted to "wine-new@amscons.com". Please don't forget
to include a ChangeLog entry. I'll make a new release every other week.
WHAT'S NEW with Wine-960114: (see ChangeLog for details)
- Complete rewrite of the file handling; still has a few bugs.
- Tons of new Win32 code.
WHAT'S NEW with Wine-960131: (see ChangeLog for details)
- New format for drives configuration in wine.conf; please
check your configuration files.
- Many MDI improvements.
- Even more Win32 code.
- Lots of bug fixes.
See the README file in the distribution for installation instructions.
......@@ -16,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:
sunsite.unc.edu:/pub/Linux/ALPHA/wine/Wine-960114.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-960114.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-960114.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-960114.tar.gz
sunsite.unc.edu:/pub/Linux/ALPHA/wine/Wine-960131.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-960131.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-960131.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-960131.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite.
......
----------------------------------------------------------------------
Wed Jan 31 10:58:00 1996 Alexandre Julliard <julliar@sunsite.unc.edu>
* [configure.in]
Added --with-dll option to build libwine.so.
* [controls/listbox.c]
Fixed ListBoxDirectory(), DlgDirSelect() and
DlgDirList(). Hopefully their behavior is correct now.
* [controls/menu.c]
Use SEGPTRs in ChangeMenu(), InsertMenu(), AppendMenu() and
ModifyMenu() for the item data, to avoid corrupting the pointer
for owner-drawn items.
* [controls/static.c]
Attempt to load OEM icons for SS_ICON controls. Probably not
entirely correct.
Don't clip the text output.
* [files/directory.c]
Add temp dir and Windows dir to environment.
* [files/dos_fs.c]
Fixed a few path handling bugs in DOSFS_GetUnixFileName().
Cache last used directory in DOSFS_FindNext() to avoid quadratic
search time.
* [files/drive.c]
New format for drives configuration in wine.conf; allows
specifying the type, label and serial number of a drive.
* [files/file.c]
New function FILE_OpenUnixFile to make sure we don't open a
directory instead of a file.
Fixed DOSFS_GetUnixFileName() check_last flag in FILE_MakeDir().
* [files/profile.c]
Rewrote profile handling. Should be closer to Windows behavior now.
New function PROFILE_GetWineIniString() to get a string from wine.conf.
Support environment variables in wine.conf.
* [loader/task.c]
Fixed the order of deletion in TASK_DeleteTask() to avoid memory
corruption.
* [memory/global.c]
Create a discarded block on GlobalAlloc() if the size is 0; thanks
to John Harvey for noticing this.
* [memory/local.c]
LOCAL_GetHeap: make sure the pointer is valid before checking
magic number.
* [misc/main.c]
Moved profile and registry saving to ExitWindows(), so we don't
try to save them in case of a crash.
* [miscemu/int21.c]
INT21_GetFreeDiskSpace: try to compute the cluster size from the
filesystem size instead of hard-coding it to 64.
Fixed functions 0x3f and 0x40 to use _hread and _hwrite to allow
reading or writing 65535 bytes (thanks to Bruce Milner for this one).
* [windows/message.c]
Fixed bug in linked-list handling in MSG_DeleteQueue().
Simplified SetMessageQueue().
* [wine.ini] [wine.man]
Updated for new drives configuration format.
Tue Jan 30 11:24:46 1996 William Magro <wmagro@tc.cornell.edu>
* [controls/edit.c]
Implemented ES_PASSWORD style, EM_SETPASSWORDCHAR and
EM_GETPASSWORDCHAR messages.
* [controls/widgets.c]
Adjusted class creation flags to better match values Windows uses.
* [include/windows.h]
Fixed ES_NOHIDESEL typo.
* [loader/ne_image.c]
Added detection for zero offset in RADDR fixups. Quicken
was in an infinite loop here.
Mon Jan 29 20:12:22 1996 Albrecht Kleine <kleine@ak.sax.de>
* [files/dos_fs.c]
Bugfix: range error in month value (0..11 set to 1..12).
* [windows/caret.c]
Changed ROP2-mode to R2_NOTXORPEN in CARET_Callback for pulsed
appearance of the caret.
* [windows/mdi.c] [include/mdi.h]
Changed MDITile(): added a new parameter WORD wParam for
WM_MDITILE second tiling method (MDITILE_HORIZONTAL in wParam) as
used in Win3.1
Sun Jan 28 14:20:00 1996 Cameron Heide <heide@ee.ualberta.ca>
* [miscemu/int2f.c]
Added a small bit of MSCDEX emulation.
* [windows/alias.c]
ALIAS_RegisterAlias was returning the hash value when it should
have been returning the record number.
Sat Jan 27 10:53:51 1996 Jim Peterson <jspeter@birch.ee.vt.edu>
* [include/shell.h] [include/wintypes.h]
Moved definition of HKEY and LPHKEY types to include/wintypes.h.
Declared FONTENUMPROC in wintypes.h.
* [include/windows.h]
Added definition of KERNINGPAIR and LPKERNINGPAIR types. Added
declarations for CopyCursor(), CopyIcon(), EnumFontFamilies(),
ExtractIcon(), FatalAppExit(), FindExecutable(), GetClipCursor(),
GetKerningPairs(), GetQueueStatus(), GetRasterizerCaps(),
IsGDIObject(), IsMenu(), IsTask(), RegCloseKey(), RegCreateKey(),
RegDeleteKey(), RegEnumKey(), RegOpenKey(), RegQueryValue(),
RegSetValue(), ResetDC(), ShellExecute(), SystemParametersInfo(),
and wsprintf().
* [tools/makehtml.pl] [documentation/apiw.index]
New files that scan windows.h, commdlg.h, and toolhelp.h and output
an HTML sorted list with optional links to www.willows.com and a
tally of unimplemented APIW functions.
* [objects/cursoricon.c]
Added Win32 versions of CopyIcon() and CopyCursor() for use in
libwine.
* [win32/resource.c] [win32/winprocs.c]
Added '#include "libres.h"' and explicit declarations of windows
procs in order to avoid warnings.
* [windows/utility.c]
Added Win32 version of MulDiv() for libwine.
* [*/*] [include/windows.h]
Changed several function declarations to comply more strictly to
the windows API (without, hopefully, altering their functionality).
* [controls/menu.c]
Made the return value of CheckMenuItem be the previous state of
the menu item if it was found, otherwise -1 as specified in the
SDK. This conflicts with the APIW specification, which says it
should return TRUE if successful, otherwise FALSE.
* [include/windows.h]
Added obsolete WM_SIZE message wParam names for compatibility.
Added WinHelp() command constants, even though they are not yet
supported.
* [rc/winerc.c]
Tidied up transform_binary_file(). In argument checking, flattened
any invalid characters specified with the prefix argument.
* [library/libres.c]
Made FindResource() case-insensitive when parameter 'name' is a string.
Sat Jan 27 02:30 1996 Uwe Bonnes <bon@elektron.ikp.physik.th-darmstadt.de
* [files/drive.c]
If root "/" is given in wine.conf, use it as last resort.
* [files/file.c]
Report ER_AccessDenied it disk ist not writable
More Debug Output
* [miscemu/int21.c]
Squeezed some bugs in ExtendedOpenCreateFile
* [windows/winpos.c]
Some windows may not be moved or resized. We are missing some
structures to be exact, but the approach should help in some cases
and make things worse in much fewer.
Fri Jan 26 10:24:00 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>
* [loader/pe_image.c]
fixup_imports: Find builtins for Borland style entries, too
Fri Jan 26 10:24:00 1996 Martin von Loewis <loewis@informatik.hu-berlin.de>
* [controls/menu.c]
LoadMenu: branch to Win32 for PE modules
* [if1632/gdi.spec][if1632/kernel32.spec][if1632/user32.spec]
DeleteObject, GetPixel, SetPixel,WritePrivateProfileStringA,
WriteProfileStringA, EmptyClipboard, EnableMenuItem, EnableScrollBar,
EnableWindow, InvalidateRect, SetWindowTextA, WinHelpA: new relays
DrawTextA, MoveToEx, GetClientRect, InvalidateRect, LoadBitmapA/W,
LoadAcceleratorsA/W, LoadMenu[Indirect]A/W, LoadStringA/W: changed
to convert parameters or naming convention
* [include/kernel32.h][include/wintypes.h]
moved WCHAR, defined LPWSTR
* [include/string32.h][win32/string32.c][include/struct32.h]
New files
* [loader/module.h]
LoadModule: exit after returning from PE_LoadModule
* [loader/pe_image.c]
my_wcstombs: isascii does not work on Linux for Unicode
PE_LoadImage: Handle directories
* [misc/user32.c]
USER32_RECT32to16, USER32_RECT16to32: new functions
implemented new user32 relays
* [misc/newfns.c]
WIN32_WinHelpA: new function
* [win32/param32.c]
New file
* [win32/resource.c]
GetResDirEntry: added support for named entries
WIN32_LoadAcceleratorsW: invoke *32 resource functions
WIN32_LoadBitmapA: convert name to unicode if appropriate
WIN32_ParseMenu: new function
implemented new resource functions from user32.spec
Wed Jan 24 18:09:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu>
* [objects/cursoricon.c]
GetIconId() and LoadIconHandler() functions.
* [windows/mdi.c]
Better maximization support, TranslateMDISysAccel() function,
misc improvements.
* [windows/defwnd.c]
Fix for WM_WINDOWPOSCHANGED message handler.
* [windows/winpos.c]
Rewrote WindowFromPoint() function.
Sun Jan 21 1996 17:05:09 Marcus Meissner <msmeissn@faui01.informatik.uni-erlangen.de>
* [include/toolhelp.h] [misc/toolhelp.c]
Added Notify(Un)Register, but no callbacks yet.
Fri Jan 19 01:43:37 1996 Victor Schneider <root@tailor.roman.org>
* [Makefile.in]
Added target for libwine.so.1.0.
* [library/winmain.c]
For WINELIBDLL, _WinMain just returns hInstance instead of calling
WinMain().
* [misc/main.c]
For WINELIBDLL, renamed main() to _wine_main() for calling from the
stub main function.
* [library/winestub.c] (new file)
Provides a stub main() function for using libwine.so.
Tue Jan 16 11:04:34 1996 Anand Kumria <akumria@ozemail.com.au>
* [winsocket.c]
Fix EPERM problem.
* [global.c]
Attempt to do some sanity checking in MemManInfo().
* [Changelog]
Fix changelog oversight for previous entry.
---------------------------------------------------------------------
Sun Jan 14 13:45:22 1996 Alexandre Julliard <julliard@sunsite.unc.edu>
* [configure.in]
......@@ -113,6 +389,9 @@ Tue Jan 02 14:00:00 1996 Anand Kumria <akumria@ozemail.com.au>
[misc/user.c] [windows/message.c]
Implement TOOLHELP.80 TimerCount. Fix GetTickCount.
* [winsocket.c]
Fixed ENOENT error.
* [miscemu/dpmi.c]
Implement DPMI Get Page Size (AX=0604, INT 31)
......
......@@ -73,10 +73,7 @@ depend:: $(C_SRCS)
mv tmp_make Makefile
clean::
$(RM) *.o \#*\# *~ *.bak *.flc tmp_make winerctmp.c
distclean:: clean
$(RM) Makefile
$(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc tmp_make winerctmp.c
dummy:
......
......@@ -113,6 +113,12 @@ libwine.a: $(COMMONSUBDIRS) $(LIBSUBDIRS) dummy
install_libwine.a: dummy
$(INSTALL_DATA) libwine.a $(libdir)
libwine.so.1.0: $(COMMONSUBDIRS) $(LIBSUBDIRS) dummy
$(CC) -shared -Wl,-soname,libwine.so.1 -o$@ $(COMMONOBJS) $(LIBOBJS) $(LDOPTIONS) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LDLIBS)
install_libwine.so.1.0: dummy
$(INSTALL_DATA) libwine.so.1.0 $(libdir)
$(ALLSUBDIRS): dummy
@cd $@; $(SUBMAKE)
......@@ -124,13 +130,12 @@ etags:
clean:
for i in $(ALLSUBDIRS); do (cd $$i; $(MAKE) clean); done
$(RM) *.o \#*\# *~ *.bak *.flc wine wine.sym libwine.a TAGS
$(RM) include/\#*\# include/*~ include/*.bak include/*.flc
distclean:
for i in $(ALLSUBDIRS); do (cd $$i; $(MAKE) distclean); done
$(RM) *.o \#*\# *~ *.bak wine wine.sym libwine.a TAGS
$(RM) include/\#*\# include/*~ include/*.bak include/*.flc
$(RM) config.* include/config.h Make.rules Makefile
$(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc
$(RM) wine wine.sym libwine.a libwine.so.1.0 TAGS
(cd include; $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc)
distclean: clean
$(RM) config.* Make.rules
$(RM) `find . \( -name Makefile -o -size 0 \) -print`
dummy:
......@@ -38,81 +38,15 @@ run "make depend; make".
3. SETUP
Once Wine has been built correctly, you can do "make install"; this
will install the wine executable and the man page.
Wine requires you to have a file /usr/local/etc/wine.conf (you can
supply a different name when configuring wine) or a file called .winerc
in your home directory.
The format of this config file is just like a Windows .ini file.
The file wine.ini contains a config file example.
Here's an explanation of each section:
* [drives]
format: <driveletter> = <rootdirectory>
default: none
This section is used to specify the root directory of each `dos'drive
as Windows' applications require a dos/mswindows based diskdrive &
directory scheme.
If you mounted your dos-partition as /dos and installed Microsoft Windows
in c:\windows than you should specify c=/dos in the drives section.
* [wine]
format: windows = <directory>
default: c:\windows
Used to specify an different windows directory.
format: system = <directory>
default: c:\windows\system
Used to specify an different system directory.
format: temp = <directory>
default: c:\temp
Used to specify a directory where Windows applications can store temporary
files.
format: path = <directories separated by semi-colons>
default: c:\windows;c:\windows\system
Used to specify the path which will be used to find executables and DLL's.
format: symboltablefile = <filename>
default: wine.sym
Used to specify the path and file name of the symbol table used by the
built-in debugger.
* [serialports]
format: com[12345678] = <devicename>
default: none
Used to specify the devices which are used as com1 - com8.
* [parallelports]
format: lpt[12345678] = <devicename>
default: none
Used to specify the devices which are used as lpt1 - lpt8.
* [spy]
format: exclude = <message names and/or EXCLUDEALL separated by commas >
default: none
Used to specify which messages will be excluded from the message logging.
format: include = <message names and/or INCLUDEALL separated by commas >
default: none
Used to specify which messages will be included in the message logging.
The format of this file is explained in the man page. The file
wine.ini contains a config file example.
4. RUNNING PROGRAMS
......
......@@ -15,6 +15,8 @@ ac_default_prefix=/usr/local
ac_help="$ac_help
--with-library build Wine as a library instead of an emulator"
ac_help="$ac_help
--with-dll build Wine as a DLL instead of an emulator"
ac_help="$ac_help
--with-ipc use inter-process communication for DDE"
ac_help="$ac_help
--with-malloc-debug enable malloc() debugging"
......@@ -562,6 +564,20 @@ else
fi
# Check whether --with-dll or --without-dll was given.
if test "${with_dll+set}" = set; then
withval="$with_dll"
cat >> confdefs.h <<\EOF
#define WINELIB 1
EOF
cat >> confdefs.h <<\EOF
#define WINELIBDLL 1
EOF
MAIN_TARGET="libwine.so.1.0" CFLAGS="$CFLAGS -fPIC"
fi
# Check whether --with-ipc or --without-ipc was given.
if test "${with_ipc+set}" = set; then
......@@ -700,7 +716,7 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 704 "configure"
#line 720 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
......@@ -714,7 +730,7 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 718 "configure"
#line 734 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
......@@ -820,7 +836,7 @@ test -z "$x_direct_test_library" && x_direct_test_library=Xt
test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
cat > conftest.$ac_ext <<EOF
#line 824 "configure"
#line 840 "configure"
#include "confdefs.h"
#include <$x_direct_test_include>
EOF
......@@ -883,7 +899,7 @@ rm -f conftest*
ac_save_LIBS="$LIBS"
LIBS="-l$x_direct_test_library $LIBS"
cat > conftest.$ac_ext <<EOF
#line 887 "configure"
#line 903 "configure"
#include "confdefs.h"
int main() { return 0; }
......@@ -1002,7 +1018,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lICE $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1006 "configure"
#line 1022 "configure"
#include "confdefs.h"
int main() { return 0; }
......@@ -1046,7 +1062,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1050 "configure"
#line 1066 "configure"
#include "confdefs.h"
int main() { return 0; }
......@@ -1081,7 +1097,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet_stub $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1085 "configure"
#line 1101 "configure"
#include "confdefs.h"
int main() { return 0; }
......@@ -1121,7 +1137,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1125 "configure"
#line 1141 "configure"
#include "confdefs.h"
int main() { return 0; }
......@@ -1160,7 +1176,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1164 "configure"
#line 1180 "configure"
#include "confdefs.h"
int main() { return 0; }
......@@ -1265,7 +1281,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-l$ac_lib $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1269 "configure"
#line 1285 "configure"
#include "confdefs.h"
int main() { return 0; }
......@@ -1388,7 +1404,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-li386 $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1392 "configure"
#line 1408 "configure"
#include "confdefs.h"
int main() { return 0; }
......@@ -1428,7 +1444,7 @@ else
ac_cv_c_cross=yes
else
cat > conftest.$ac_ext <<EOF
#line 1432 "configure"
#line 1448 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
......@@ -1453,7 +1469,7 @@ else
ac_cv_c_gcc_strength_bug="yes"
else
cat > conftest.$ac_ext <<EOF
#line 1457 "configure"
#line 1473 "configure"
#include "confdefs.h"
int main(void) {
......@@ -1489,7 +1505,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1493 "configure"
#line 1509 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
......@@ -1541,7 +1557,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1545 "configure"
#line 1561 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
......@@ -1574,7 +1590,7 @@ if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1578 "configure"
#line 1594 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
......@@ -1629,7 +1645,7 @@ if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1633 "configure"
#line 1649 "configure"
#include "confdefs.h"
int main() { return 0; }
......@@ -1703,7 +1719,7 @@ if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1707 "configure"
#line 1723 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
......@@ -1725,7 +1741,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 1729 "configure"
#line 1745 "configure"
#include "confdefs.h"
#include <string.h>
EOF
......@@ -1743,7 +1759,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 1747 "configure"
#line 1763 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
......@@ -1764,7 +1780,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
#line 1768 "configure"
#line 1784 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
......@@ -1799,7 +1815,7 @@ if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1803 "configure"
#line 1819 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
......
......@@ -15,6 +15,11 @@ dnl **** Command-line arguments ****
AC_ARG_WITH(library,
[ --with-library build Wine as a library instead of an emulator],
[AC_DEFINE(WINELIB) MAIN_TARGET="libwine.a"],[MAIN_TARGET="wine"])
AC_ARG_WITH(dll,
[ --with-dll build Wine as a DLL instead of an emulator],
[AC_DEFINE(WINELIB) AC_DEFINE(WINELIBDLL)
MAIN_TARGET="libwine.so.1.0" CFLAGS="$CFLAGS -fPIC"])
AC_SUBST(MAIN_TARGET)
AC_ARG_WITH(ipc,
......
......@@ -71,7 +71,8 @@ typedef struct
unsigned short *TabStops;/* tab stops buffer */
BOOL HaveFocus; /* TRUE if this edit has the focus */
int ClientWidth; /* computed from the window's ClientRect */
int ClientHeight; /* dito */
int ClientHeight; /* ditto */
char PasswordChar; /* The password character */
} EDITSTATE;
#define EditBufStartLen(hwnd) (GetWindowLong(hwnd,GWL_STYLE) & ES_MULTILINE \
......@@ -509,11 +510,11 @@ static void EDIT_WriteText(HWND hwnd, char *lp, int off, int len, int row,
es->BlankLine[(es->ClientWidth / es->CharWidths[32]) + 1] = 0;
}
if ((GetWindowLong( hwnd, GWL_STYLE ) & ES_PASSWORD))
if ((es->PasswordChar && GetWindowLong( hwnd, GWL_STYLE ) & ES_PASSWORD))
{
int len = strlen(str);
char *buff = xmalloc( len+1 );
memset( buff, '*', len );
memset( buff, es->PasswordChar, len );
buff[len] = '\0';
TextOut( hdc, col - diff, row * es->txtht, buff, len );
}
......@@ -2269,6 +2270,7 @@ static long EDIT_WM_NCCreate(HWND hwnd, LONG lParam)
es->ClientWidth = es->ClientHeight = 1;
/* --- text buffer */
es->MaxTextLen = MAXTEXTLEN + 1;
es->PasswordChar = '*';
/*
* Hack - If there is no local heap then hwnd should be a globalHeap block
* and the local heap needs to be initilised to the same size(minus something)
......@@ -2758,7 +2760,8 @@ LRESULT EditWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
case EM_GETPASSWORDCHAR:
fprintf(stdnimp,"edit: cannot process EM_GETPASSWORDCHAR message\n");
/* FIXME: is this the right place to return the character? */
lResult = es->PasswordChar;
break;
case EM_GETRECT:
......@@ -2820,7 +2823,7 @@ LRESULT EditWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
case EM_SETPASSWORDCHAR:
fprintf(stdnimp,"edit: cannot process EM_SETPASSWORDCHAR message\n");
es->PasswordChar = (char) wParam;
break;
case EM_SETREADONLY:
......
......@@ -88,8 +88,13 @@ LONG StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
CREATESTRUCT * createStruct = (CREATESTRUCT *)PTR_SEG_TO_LIN(lParam);
if (createStruct->lpszName)
STATIC_SetIcon( hWnd, LoadIcon( createStruct->hInstance,
(SEGPTR)createStruct->lpszName ));
{
HICON hicon = LoadIcon( createStruct->hInstance,
(SEGPTR)createStruct->lpszName );
if (!hicon) /* Try OEM icon (FIXME: is this right?) */
hicon = LoadIcon( 0, (SEGPTR)createStruct->lpszName );
STATIC_SetIcon( hWnd, hicon );
}
return 1;
}
return DefWindowProc(hWnd, uMsg, wParam, lParam);
......@@ -195,23 +200,23 @@ static void PaintTextfn( HWND hwnd, HDC hdc )
switch (style & 0x0000000F)
{
case SS_LEFT:
wFormat = DT_LEFT | DT_EXPANDTABS | DT_WORDBREAK;
wFormat = DT_LEFT | DT_EXPANDTABS | DT_WORDBREAK | DT_NOCLIP;
break;
case SS_CENTER:
wFormat = DT_CENTER | DT_EXPANDTABS | DT_WORDBREAK;
wFormat = DT_CENTER | DT_EXPANDTABS | DT_WORDBREAK | DT_NOCLIP;
break;
case SS_RIGHT:
wFormat = DT_RIGHT | DT_EXPANDTABS | DT_WORDBREAK;
wFormat = DT_RIGHT | DT_EXPANDTABS | DT_WORDBREAK | DT_NOCLIP;
break;
case SS_SIMPLE:
wFormat = DT_LEFT | DT_SINGLELINE | DT_VCENTER;
wFormat = DT_LEFT | DT_SINGLELINE | DT_VCENTER | DT_NOCLIP;
break;
case SS_LEFTNOWORDWRAP:
wFormat = DT_LEFT | DT_SINGLELINE | DT_EXPANDTABS | DT_VCENTER;
wFormat = DT_LEFT | DT_SINGLELINE | DT_EXPANDTABS | DT_VCENTER | DT_NOCLIP;
break;
default:
......
......@@ -23,16 +23,16 @@ static WNDCLASS WIDGETS_BuiltinClasses[] =
sizeof(BUTTONINFO), 0, 0, 0, 0, 0, (SEGPTR)"BUTTON" },
{ CS_GLOBALCLASS | CS_PARENTDC, (WNDPROC)"StaticWndProc", 0,
sizeof(STATICINFO), 0, 0, 0, 0, 0, (SEGPTR)"STATIC" },
{ CS_GLOBALCLASS | CS_PARENTDC, (WNDPROC)"ScrollBarWndProc", 0,
{ CS_GLOBALCLASS | CS_HREDRAW | CS_VREDRAW | CS_PARENTDC , (WNDPROC)"ScrollBarWndProc", 0,
sizeof(SCROLLINFO), 0, 0, 0, 0, 0, (SEGPTR)"SCROLLBAR" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS, (WNDPROC)"ListBoxWndProc", 0,
8, 0, 0, 0, 0, 0, (SEGPTR)"LISTBOX" },
{ CS_GLOBALCLASS | CS_PARENTDC, (WNDPROC)"ComboBoxWndProc", 0, 8,
0, 0, 0, 0, 0, (SEGPTR)"COMBOBOX" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS, (WNDPROC)"ComboLBoxWndProc",
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS | CS_SAVEBITS, (WNDPROC)"ComboLBoxWndProc",
0, 8, 0, 0, 0, 0, 0, (SEGPTR)"COMBOLBOX" },
{ CS_GLOBALCLASS, (WNDPROC)"EditWndProc", 0, sizeof(DWORD),
0, 0, 0, 0, 0, (SEGPTR)"EDIT" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS, (WNDPROC)"EditWndProc",
0, sizeof(DWORD), 0, 0, 0, 0, 0, (SEGPTR)"EDIT" },
{ CS_GLOBALCLASS | CS_SAVEBITS, (WNDPROC)"PopupMenuWndProc", 0, 8,
0, 0, 0, 0, 0, (SEGPTR)POPUPMENU_CLASS_NAME },
{ CS_GLOBALCLASS, (WNDPROC)"DesktopWndProc", 0, sizeof(DESKTOPINFO),
......
......@@ -12,7 +12,6 @@
#include "debugger.h"
#define INT3 0xcc /* int 3 opcode */
#define STEP_FLAG 0x100 /* single-step flag */
#define MAX_BREAKPOINTS 25
......
......@@ -215,8 +215,8 @@ void wine_debug( int signal, struct sigcontext_struct *regs )
if (!loaded_symbols)
{
loaded_symbols++;
GetPrivateProfileString("wine", "SymbolTableFile", "wine.sym",
SymbolTableFile, sizeof(SymbolTableFile), WINE_INI);
PROFILE_GetWineIniString( "wine", "SymbolTableFile", "wine.sym",
SymbolTableFile, sizeof(SymbolTableFile) );
DEBUG_ReadSymbolTable( SymbolTableFile );
DEBUG_LoadEntryPoints();
}
......
......@@ -5,7 +5,8 @@ C_SRCS = \
directory.c \
dos_fs.c \
drive.c \
file.c
file.c \
profile.c
all: $(MODULE).o
......
......@@ -13,6 +13,7 @@
#include "drive.h"
#include "file.h"
#include "msdos.h"
#include "options.h"
#include "xmalloc.h"
#include "stddebug.h"
#include "debug.h"
......@@ -42,8 +43,7 @@ static int DIR_GetPath( const char *keyname, const char *defval,
const char *dos_name ,*unix_name;
BYTE attr;
GetPrivateProfileString( "wine", keyname, defval,
path, sizeof(path), WineIniFileName() );
PROFILE_GetWineIniString( "wine", keyname, defval, path, sizeof(path) );
if (!(unix_name = DOSFS_GetUnixFileName( path, TRUE )) ||
!FILE_Stat( unix_name, &attr, NULL, NULL, NULL ) ||
!(attr & FA_DIRECTORY))
......@@ -117,7 +117,7 @@ void DIR_ParseWindowsPath( char *path )
*/
int DIR_Init(void)
{
char path[MAX_PATHNAME_LEN];
char path[MAX_PATHNAME_LEN], *env_p;
int drive;
const char *cwd;
......@@ -153,14 +153,26 @@ int DIR_Init(void)
DRIVE_Chdir( drive, DIR_WindowsDosDir + 2 );
}
GetPrivateProfileString( "wine", "path", "c:\\windows;c:\\windows\\system",
path, sizeof(path), WineIniFileName() );
PROFILE_GetWineIniString("wine", "path", "c:\\windows;c:\\windows\\system",
path, sizeof(path) );
DIR_ParseWindowsPath( path );
dprintf_dosfs( stddeb, "WindowsDir = %s\nSystemDir = %s\n",
DIR_WindowsDosDir, DIR_SystemDosDir );
dprintf_dosfs( stddeb, "TempDir = %s\nCwd = %c:\\%s\n",
DIR_TempDosDir, 'A' + drive, DRIVE_GetDosCwd( drive ) );
/* Put the temp and Windows directories into the environment */
env_p = (char *)xmalloc( strlen(DIR_TempDosDir) + 5 );
strcpy( env_p, "TEMP=" );
strcpy( env_p + 5, DIR_TempDosDir );
putenv( env_p );
env_p = (char *)xmalloc( strlen(DIR_WindowsDosDir) + 7 );
strcpy( env_p, "windir=" );
strcpy( env_p + 7, DIR_WindowsDosDir );
putenv( env_p );
return 1;
}
......
......@@ -25,7 +25,7 @@
#include "debug.h"
/* Chars we don't want to see in DOS file names */
#define INVALID_DOS_CHARS "*?<>|\"+=,; "
#define INVALID_DOS_CHARS "*?<>|\"+=,;[] \345"
static const char *DOSFS_Devices[][2] =
{
......@@ -264,7 +264,8 @@ void DOSFS_ToDosDateTime( time_t *unixtime, WORD *pDate, WORD *pTime )
if (pTime)
*pTime = (tm->tm_hour << 11) + (tm->tm_min << 5) + (tm->tm_sec / 2);
if (pDate)
*pDate = ((tm->tm_year - 80) << 9) + (tm->tm_mon << 5) + tm->tm_mday;
*pDate = ((tm->tm_year - 80) << 9) + ((tm->tm_mon + 1) << 5)
+ tm->tm_mday;
}
......@@ -506,7 +507,7 @@ const char * DOSFS_GetUnixFileName( const char * name, int check_last )
p += strlen(p);
while (!IS_END_OF_NAME(*name)) name++;
}
else
else if (!check_last)
{
*p++ = '/';
for (len--; !IS_END_OF_NAME(*name) && (len > 1); name++, len--)
......@@ -517,14 +518,14 @@ const char * DOSFS_GetUnixFileName( const char * name, int check_last )
}
if (!found)
{
if (*name) /* Not last */
if (check_last)
{
DOS_ERROR( ER_PathNotFound, EC_NotFound, SA_Abort, EL_Disk );
DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
return NULL;
}
if (check_last)
if (*name) /* Not last */
{
DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
DOS_ERROR( ER_PathNotFound, EC_NotFound, SA_Abort, EL_Disk );
return NULL;
}
}
......@@ -571,19 +572,20 @@ const char * DOSFS_GetDosTrueName( const char *name, int unix_format )
return NULL;
}
strcpy( buffer, "A:\\" );
buffer[0] += drive;
if ((name[0] == '\\') || (name[0] == '/'))
p = buffer;
*p++ = 'A' + drive;
*p++ = ':';
if (IS_END_OF_NAME(*name))
{
while ((*name == '\\') || (*name == '/')) name++;
p = buffer + 2;
}
else
{
lstrcpyn( buffer + 3, DRIVE_GetDosCwd(drive), len - 3 );
if (buffer[3]) p = buffer + strlen(buffer);
else p = buffer + 2;
*p++ = '\\';
lstrcpyn( p, DRIVE_GetDosCwd(drive), sizeof(buffer) - 3 );
if (*p) p += strlen(p); else p--;
}
*p = '\0';
len = MAX_PATHNAME_LEN - (int)(p - buffer);
while (*name)
......@@ -616,10 +618,10 @@ const char * DOSFS_GetDosTrueName( const char *name, int unix_format )
name++;
len--;
}
*p = '\0';
}
while ((*name == '\\') || (*name == '/')) name++;
}
*p = '\0';
if (!buffer[2])
{
buffer[2] = '\\';
......@@ -639,10 +641,12 @@ const char * DOSFS_GetDosTrueName( const char *name, int unix_format )
int DOSFS_FindNext( const char *path, const char *mask, int drive,
BYTE attr, int skip, DOS_DIRENT *entry )
{
DIR *dir;
static DIR *dir = NULL;
struct dirent *dirent;
int count = 0;
char buffer[MAX_PATHNAME_LEN], *p;
static char buffer[MAX_PATHNAME_LEN];
static int cur_pos = 0;
char *p;
const char *hash_name;
if ((attr & ~(FA_UNUSED | FA_ARCHIVE | FA_RDONLY)) == FA_LABEL)
......@@ -656,8 +660,17 @@ int DOSFS_FindNext( const char *path, const char *mask, int drive,
return 1;
}
if (!(dir = opendir( path ))) return 0;
strcpy( buffer, path );
/* Check the cached directory */
if (dir && !strcmp( buffer, path ) && (cur_pos <= skip)) skip -= cur_pos;
else /* Not in the cache, open it anew */
{
dprintf_dosfs( stddeb, "DOSFS_FindNext: cache miss, path=%s skip=%d buf=%s cur=%d\n",
path, skip, buffer, cur_pos );
cur_pos = skip;
if (dir) closedir(dir);
if (!(dir = opendir( path ))) return 0;
lstrcpyn( buffer, path, sizeof(buffer) - 1 );
}
strcat( buffer, "/" );
p = buffer + strlen(buffer);
attr |= FA_UNUSED | FA_ARCHIVE | FA_RDONLY;
......@@ -668,7 +681,7 @@ int DOSFS_FindNext( const char *path, const char *mask, int drive,
count++;
hash_name = DOSFS_Hash( dirent->d_name, TRUE );
if (!DOSFS_Match( mask, hash_name )) continue;
strcpy( p, dirent->d_name );
lstrcpyn( p, dirent->d_name, sizeof(buffer) - (int)(p - buffer) );
if (!FILE_Stat( buffer, &entry->attr, &entry->size,
&entry->date, &entry->time ))
......@@ -681,9 +694,11 @@ int DOSFS_FindNext( const char *path, const char *mask, int drive,
lstrcpyn( entry->unixname, dirent->d_name, sizeof(entry->unixname) );
dprintf_dosfs( stddeb, "DOSFS_FindNext: returning %s %02x %ld\n",
entry->name, entry->attr, entry->size );
closedir( dir );
cur_pos += count;
p[-1] = '\0'; /* Remove trailing slash in buffer */
return count;
}
closedir( dir );
dir = NULL;
return 0; /* End of directory */
}
/*
* DOS drive handling functions
* DOS drives handling functions
*
* Copyright 1993 Erik Bos
* Copyright 1996 Alexandre Julliard
......@@ -7,12 +7,26 @@
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#if defined(__linux__) || defined(sun)
#include <sys/vfs.h>
#endif
#if defined(__NetBSD__) || defined(__FreeBSD__)
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/errno.h>
#endif
#ifdef __svr4__
#include <sys/statfs.h>
#endif
#include "windows.h"
#include "dos_fs.h"
#include "drive.h"
#include "file.h"
#include "msdos.h"
#include "options.h"
#include "task.h"
#include "xmalloc.h"
#include "stddebug.h"
......@@ -20,74 +34,128 @@
typedef struct
{
char *root; /* root dir in Unix format without trailing '/' */
char *dos_cwd; /* cwd in DOS format without leading or trailing '\' */
char *unix_cwd; /* cwd in Unix format without leading or trailing '/' */
char label[12]; /* drive label */
DWORD serial; /* drive serial number */
WORD type; /* drive type */
BYTE disabled; /* disabled flag */
char *root; /* root dir in Unix format without trailing / */
char *dos_cwd; /* cwd in DOS format without leading or trailing \ */
char *unix_cwd; /* cwd in Unix format without leading or trailing / */
char label[12]; /* drive label */
DWORD serial; /* drive serial number */
DRIVETYPE type; /* drive type */
BYTE disabled; /* disabled flag */
} DOSDRIVE;
static const char *DRIVE_Types[] =
{
"floppy", /* TYPE_FLOPPY */
"hd", /* TYPE_HD */
"cdrom", /* TYPE_CDROM */
"network" /* TYPE_NETWORK */
};
static DOSDRIVE DOSDrives[MAX_DOS_DRIVES];
static int DRIVE_CurDrive = 0;
static int DRIVE_CurDrive = -1;
static HTASK DRIVE_LastTask = 0;
/***********************************************************************
* DRIVE_GetDriveType
*/
static DRIVETYPE DRIVE_GetDriveType( const char *name )
{
char buffer[20];
int i;
PROFILE_GetWineIniString( name, "Type", "hd", buffer, sizeof(buffer) );
for (i = 0; i < sizeof(DRIVE_Types)/sizeof(DRIVE_Types[0]); i++)
{
if (!lstrcmpi( buffer, DRIVE_Types[i] )) return (DRIVETYPE)i;
}
fprintf( stderr, "%s: unknown type '%s', defaulting to 'hd'.\n",
name, buffer );
return TYPE_HD;
}
/***********************************************************************
* DRIVE_Init
*/
int DRIVE_Init(void)
{
int i, count = 0;
char drive[2] = "A";
int i, len, count = 0;
char name[] = "Drive A";
char path[MAX_PATHNAME_LEN];
char buffer[20];
char *p;
DOSDRIVE *drive;
for (i = 0; i < MAX_DOS_DRIVES; i++, drive[0]++)
for (i = 0, drive = DOSDrives; i < MAX_DOS_DRIVES; i++, name[6]++, drive++)
{
GetPrivateProfileString( "drives", drive, "",
path, sizeof(path)-1, WineIniFileName() );
PROFILE_GetWineIniString( name, "Path", "", path, sizeof(path)-1 );
if (path[0])
{
p = path + strlen(path) - 1;
while ((p > path) && ((*p == '/') || (*p == '\\'))) *p-- = '\0';
DOSDrives[i].root = xstrdup( path );
DOSDrives[i].dos_cwd = xstrdup( "" );
DOSDrives[i].unix_cwd = xstrdup( "" );
sprintf( DOSDrives[i].label, "DRIVE-%c ", drive[0] );
DOSDrives[i].serial = 0x12345678;
DOSDrives[i].type = (i < 2) ? DRIVE_REMOVABLE : DRIVE_FIXED;
DOSDrives[i].disabled = 0;
drive->root = xstrdup( path );
drive->dos_cwd = xstrdup( "" );
drive->unix_cwd = xstrdup( "" );
drive->type = DRIVE_GetDriveType( name );
drive->disabled = 0;
/* Get the drive label */
PROFILE_GetWineIniString( name, "Label", name, drive->label, 12 );
if ((len = strlen(drive->label)) < 11)
{
/* Pad label with spaces */
memset( drive->label + len, ' ', 11 - len );
drive->label[12] = '\0';
}
/* Get the serial number */
PROFILE_GetWineIniString( name, "Serial", "12345678",
buffer, sizeof(buffer) );
drive->serial = strtoul( buffer, NULL, 16 );
/* Make the first hard disk the current drive */
if ((DRIVE_CurDrive == -1) && (drive->type == TYPE_HD))
DRIVE_CurDrive = i;
count++;
dprintf_dosfs( stddeb, "%s: path=%s type=%s label='%s' serial=%08lx\n",
name, path, DRIVE_Types[drive->type],
drive->label, drive->serial );
}
dprintf_dosfs( stddeb, "Drive %c -> %s\n", 'A' + i,
path[0] ? path : "** None **" );
else dprintf_dosfs( stddeb, "%s: not defined\n", name );
}
if (!count)
{
fprintf( stderr, "Warning: no valid DOS drive found\n" );
/* Create a C drive pointing to Unix root dir */
DOSDrives[i].root = xstrdup( "/" );
DOSDrives[i].dos_cwd = xstrdup( "" );
DOSDrives[i].unix_cwd = xstrdup( "" );
sprintf( DOSDrives[i].label, "DRIVE-%c ", drive[0] );
DOSDrives[i].serial = 0x12345678;
DOSDrives[i].type = DRIVE_FIXED;
DOSDrives[i].disabled = 0;
DOSDrives[2].root = xstrdup( "/" );
DOSDrives[2].dos_cwd = xstrdup( "" );
DOSDrives[2].unix_cwd = xstrdup( "" );
strcpy( DOSDrives[2].label, "Drive C " );
DOSDrives[2].serial = 0x12345678;
DOSDrives[2].type = TYPE_HD;
DOSDrives[2].disabled = 0;
DRIVE_CurDrive = 2;
}
/* Make the first hard disk the current drive */
for (i = 0; i < MAX_DOS_DRIVES; i++, drive[0]++)
/* Make sure the current drive is valid */
if (DRIVE_CurDrive == -1)
{
if (DOSDrives[i].root && !DOSDrives[i].disabled &&
DOSDrives[i].type != DRIVE_REMOVABLE)
for (i = 0, drive = DOSDrives; i < MAX_DOS_DRIVES; i++, drive++)
{
DRIVE_CurDrive = i;
break;
if (drive->root && !drive->disabled)
{
DRIVE_CurDrive = i;
break;
}
}
}
return 1;
}
......@@ -143,7 +211,7 @@ int DRIVE_SetCurrentDrive( int drive )
*/
int DRIVE_FindDriveRoot( const char **path )
{
int drive;
int drive, rootdrive = -1;
const char *p1, *p2;
dprintf_dosfs( stddeb, "DRIVE_FindDriveRoot: searching '%s'\n", *path );
......@@ -154,6 +222,13 @@ int DRIVE_FindDriveRoot( const char **path )
p2 = DOSDrives[drive].root;
dprintf_dosfs( stddeb, "DRIVE_FindDriveRoot: checking %c: '%s'\n",
'A' + drive, p2 );
while (*p2 == '/') p2++;
if (!*p2)
{
rootdrive = drive;
continue; /* Look if there's a better match */
}
for (;;)
{
while ((*p1 == '\\') || (*p1 == '/')) p1++;
......@@ -175,7 +250,7 @@ int DRIVE_FindDriveRoot( const char **path )
break; /* No match, go to next drive */
}
}
return -1;
return rootdrive;
}
......@@ -263,6 +338,16 @@ int DRIVE_SetSerialNumber( int drive, DWORD serial )
/***********************************************************************
* DRIVE_GetType
*/
DRIVETYPE DRIVE_GetType( int drive )
{
if (!DRIVE_IsValid( drive )) return TYPE_INVALID;
return DOSDrives[drive].type;
}
/***********************************************************************
* DRIVE_Chdir
*/
int DRIVE_Chdir( int drive, const char *path )
......@@ -339,11 +424,52 @@ int DRIVE_Enable( int drive )
/***********************************************************************
* DRIVE_GetFreeSpace
*/
int DRIVE_GetFreeSpace( int drive, DWORD *size, DWORD *available )
{
struct statfs info;
if (!DRIVE_IsValid(drive))
{
DOS_ERROR( ER_InvalidDrive, EC_MediaError, SA_Abort, EL_Disk );
return 0;
}
#ifdef __svr4__
if (statfs( DOSDrives[drive].root, &info, 0, 0) < 0)
#else
if (statfs( DOSDrives[drive].root, &info) < 0)
#endif
{
FILE_SetDosError();
fprintf(stderr,"dosfs: cannot do statfs(%s)\n", DOSDrives[drive].root);
return 0;
}
*size = info.f_bsize * info.f_blocks;
#ifdef __svr4__
*available = info.f_bfree * info.f_bsize;
#else
*available = info.f_bavail * info.f_bsize;
#endif
return 1;
}
/***********************************************************************
* GetDriveType (KERNEL.136)
*/
WORD GetDriveType( INT drive )
{
dprintf_dosfs( stddeb, "GetDriveType(%c:)\n", 'A' + drive );
if (!DRIVE_IsValid(drive)) return 0;
return DOSDrives[drive].type;
switch(DRIVE_GetType(drive))
{
case TYPE_FLOPPY: return DRIVE_REMOVABLE;
case TYPE_HD: return DRIVE_FIXED;
case TYPE_CDROM: return DRIVE_REMOVABLE;
case TYPE_NETWORK: return DRIVE_REMOTE;
case TYPE_INVALID:
default: return DRIVE_CANNOTDETERMINE;
}
}
This diff is collapsed. Click to expand it.
......@@ -46,7 +46,7 @@ LONG CallWindowProc( WNDPROC func, HWND hwnd, WORD message,
/**********************************************************************
* Catch (KERNEL.55)
*/
int Catch( LPCATCHBUF lpbuf )
INT Catch( LPCATCHBUF lpbuf )
{
STACK16FRAME *pFrame = CURRENT_STACK16;
......
......@@ -71,7 +71,7 @@ base 1
0067 stdcall DeleteDC(long) DeleteDC
0068 stub DeleteEnhMetaFile
0069 stub DeleteMetaFile
0070 stub DeleteObject
0070 stdcall DeleteObject(long) DeleteObject
0071 stub DescribePixelFormat
0072 stub DeviceCapabilitiesExA
0073 stub DeviceCapabilitiesExW
......@@ -212,7 +212,7 @@ base 1
0208 stub GetOutlineTextMetricsW
0209 stub GetPaletteEntries
0210 stub GetPath
0211 stub GetPixel
0211 stdcall GetPixel(long long long) GetPixel
0212 stub GetPixelFormat
0213 stub GetPolyFillMode
0214 stub GetROP2
......@@ -255,7 +255,7 @@ base 1
0251 stub LoadImageColorMatcherW
0252 stub MaskBlt
0253 stub ModifyWorldTransform
0254 stdcall MoveToEx(long long long ptr) MoveToEx
0254 stdcall MoveToEx(long long long ptr) WIN32_MoveToEx
0255 stub OffsetClipRgn
0256 stub OffsetRgn
0257 stub OffsetViewportOrgEx
......@@ -328,7 +328,7 @@ base 1
0324 stub SetMetaRgn
0325 stub SetMiterLimit
0326 stub SetPaletteEntries
0327 stub SetPixel
0327 stdcall SetPixel(long long long long) SetPixel
0328 stub SetPixelFormat
0329 stub SetPixelV
0330 stub SetPolyFillMode
......
......@@ -53,7 +53,7 @@ id 1
54 pascal16 GetInstanceData(word word word) GetInstanceData
55 pascal16 Catch(ptr) Catch
56 pascal16 Throw(ptr word) Throw
57 pascal16 GetProfileInt(ptr ptr word) GetProfileInt
57 pascal16 GetProfileInt(ptr ptr s_word) GetProfileInt
58 pascal16 GetProfileString(ptr ptr ptr ptr word) GetProfileString
59 pascal16 WriteProfileString(ptr ptr ptr) WriteProfileString
60 pascal16 FindResource(word segptr segptr) FindResource
......@@ -124,7 +124,7 @@ id 1
125 return DisableKernel 0 0
126 stub MemoryFreed
127 pascal16 GetPrivateProfileInt(ptr ptr s_word ptr) GetPrivateProfileInt
128 pascal16 GetPrivateProfileString(ptr ptr ptr ptr s_word ptr)
128 pascal16 GetPrivateProfileString(ptr ptr ptr ptr word ptr)
GetPrivateProfileString
129 pascal16 WritePrivateProfileString(ptr ptr ptr ptr)
WritePrivateProfileString
......@@ -228,7 +228,7 @@ id 1
310 pascal16 LocalHandleDelta(word) LocalHandleDelta
311 stub GetSetKernelDosProc
314 stub DebugDefineSegment
315 pascal WriteOutProfiles() sync_profiles
315 pascal16 WriteOutProfiles() WriteOutProfiles
316 stub GetFreeMemInfo
318 stub FatalExitHook
319 stub FlushCachedFileHandle
......
......@@ -584,12 +584,12 @@ base 1
0579 stub WriteFileEx
0580 stub WritePrivateProfileSectionA
0581 stub WritePrivateProfileSectionW
0582 stub WritePrivateProfileStringA
0582 stdcall WritePrivateProfileStringA(ptr ptr ptr ptr) WritePrivateProfileString
0583 stub WritePrivateProfileStringW
0584 stub WriteProcessMemory
0585 stub WriteProfileSectionA
0586 stub WriteProfileSectionW
0587 stub WriteProfileStringA
0587 stdcall WriteProfileStringA(ptr ptr ptr) WriteProfileString
0588 stub WriteProfileStringW
0589 stub WriteTapemark
0590 stub _hread
......
......@@ -246,6 +246,6 @@ void RELAY_DebugCall16( int* stack, int nbargs )
printf( "CallTo16(func=%04x:%04x,ds=%04x",
HIWORD(stack[0]), LOWORD(stack[0]), LOWORD(stack[1]) );
stack += 2;
while (nbargs--) printf( ",0x%x", *stack++ );
while (nbargs--) printf( ",0x%04x", *stack++ );
printf( ")\n" );
}
......@@ -85,8 +85,10 @@ void *RELAY32_GetEntryPoint(char *dll_name, char *item, int hint)
dprintf_module(stddeb, "Looking for %s in %s, hint %x\n",
item ? item: "(no name)", dll_name, hint);
dll=RELAY32_GetBuiltinDLL(dll_name);
/* This should deal with built-in DLLs only. See pe_module on loading
PE DLLs */
/* FIXME: This should deal with built-in DLLs only. See pe_module on
loading PE DLLs */
if(!dll)
return 0;
#if 0
if(!dll) {
if(!wine_files || !wine_files->name ||
......
......@@ -24,8 +24,8 @@ id 12
70 pascal16 ClassNext(ptr) ClassNext
71 pascal16 SystemHeapInfo(ptr) SystemHeapInfo
72 pascal16 MemManInfo(ptr) MemManInfo
73 stub NOTIFYREGISTER
74 stub NOTIFYUNREGISTER
73 pascal16 NotifyRegister(word segptr word) NotifyRegister
74 pascal16 NotifyUnregister(word) NotifyUnregister
75 return INTERRUPTREGISTER 6 0
76 return INTERRUPTUNREGISTER 2 0
77 stub TERMINATEAPP
......
......@@ -98,7 +98,7 @@ id 2
97 pascal16 CheckDlgButton(word word word) CheckDlgButton
98 pascal16 IsDlgButtonChecked(word word) IsDlgButtonChecked
99 pascal16 DlgDirSelect(word ptr word) DlgDirSelect
100 pascal16 DlgDirList(word ptr word word word) DlgDirList
100 pascal16 DlgDirList(word segptr word word word) DlgDirList
101 pascal SendDlgItemMessage(word word word word long) SendDlgItemMessage
102 pascal16 AdjustWindowRect(ptr long word) AdjustWindowRect
103 pascal16 MapDialogRect(word ptr) MapDialogRect
......@@ -151,7 +151,7 @@ id 2
150 pascal16 LoadMenu(word segptr) LoadMenu
151 pascal16 CreateMenu() CreateMenu
152 pascal16 DestroyMenu(word) DestroyMenu
153 pascal16 ChangeMenu(word word ptr word word) ChangeMenu
153 pascal16 ChangeMenu(word word segptr word word) ChangeMenu
154 pascal16 CheckMenuItem(word word word) CheckMenuItem
155 pascal16 EnableMenuItem(word word word) EnableMenuItem
156 pascal16 GetSystemMenu(word word) GetSystemMenu
......@@ -219,7 +219,7 @@ id 2
217 pascal16 LookupMenuHandle(word s_word) LookupMenuHandle
218 pascal16 DialogBoxIndirect(word word word segptr) DialogBoxIndirect
219 pascal16 CreateDialogIndirect(word segptr word segptr) CreateDialogIndirect
220 pascal16 LoadMenuIndirect(ptr) LoadMenuIndirect
220 pascal16 LoadMenuIndirect(segptr) LoadMenuIndirect
221 pascal16 ScrollDC(word s_word s_word ptr ptr word ptr) ScrollDC
222 pascal16 GetKeyboardState(ptr) GetKeyboardState
223 pascal16 SetKeyboardState(ptr) SetKeyboardState
......@@ -362,11 +362,11 @@ id 2
408 pascal16 CreateCursorIconIndirect(word ptr ptr ptr)
CreateCursorIconIndirect
409 stub InitThreadInput
410 pascal16 InsertMenu(word word word word ptr) InsertMenu
411 pascal16 AppendMenu(word word word ptr) AppendMenu
410 pascal16 InsertMenu(word word word word segptr) InsertMenu
411 pascal16 AppendMenu(word word word segptr) AppendMenu
412 pascal16 RemoveMenu(word word word) RemoveMenu
413 pascal16 DeleteMenu(word word word) DeleteMenu
414 pascal16 ModifyMenu(word word word word ptr) ModifyMenu
414 pascal16 ModifyMenu(word word word word segptr) ModifyMenu
415 pascal16 CreatePopupMenu() CreatePopupMenu
416 pascal16 TrackPopupMenu(word word word word word word ptr) TrackPopupMenu
417 pascal GetMenuCheckMarkDimensions() GetMenuCheckMarkDimensions
......
......@@ -165,15 +165,15 @@ base 1
0160 stdcall DrawMenuBar(long) DrawMenuBar
0161 stub DrawStateA
0162 stub DrawStateW
0163 stdcall DrawTextA(long ptr long ptr long) DrawText
0163 stdcall DrawTextA(long ptr long ptr long) USER32_DrawTextA
0164 stub DrawTextExA
0165 stub DrawTextExW
0166 stub DrawTextW
0167 stub EditWndProc
0168 stub EmptyClipboard
0169 stub EnableMenuItem
0170 stub EnableScrollBar
0171 stub EnableWindow
0168 stdcall EmptyClipboard() EmptyClipboard
0169 stdcall EnableMenuItem(long long long) EnableMenuItem
0170 stdcall EnableScrollBar(long long long) EnableScrollBar
0171 stdcall EnableWindow(long long) EnableWindow
0172 stub EndDeferWindowPos
0173 stub EndDialog
0174 stub EndMenu
......@@ -221,7 +221,7 @@ base 1
0216 stub GetClassNameA
0217 stub GetClassNameW
0218 stub GetClassWord
0219 stdcall GetClientRect(long long) GetClientRect
0219 stdcall GetClientRect(long long) USER32_GetClientRect
0220 stub GetClipCursor
0221 stub GetClipboardData
0222 stub GetClipboardFormatNameA
......@@ -329,7 +329,7 @@ base 1
0324 stub InsertMenuW
0325 stub InternalGetWindowText
0326 stub IntersectRect
0327 stub InvalidateRect
0327 stdcall InvalidateRect(long ptr long) USER32_InvalidateRect
0328 stub InvalidateRgn
0329 stub InvertRect
0330 stub IsCharAlphaA
......@@ -356,10 +356,10 @@ base 1
0351 stub IsZoomed
0352 stub KillSystemTimer
0353 stub KillTimer
0354 stdcall LoadAcceleratorsA(long ptr) LoadAccelerators32
0355 stub LoadAcceleratorsW
0356 stdcall LoadBitmapA(long ptr) LoadBitmapA32
0357 stdcall LoadBitmapW(long ptr) LoadBitmapW32
0354 stdcall LoadAcceleratorsA(long ptr) WIN32_LoadAcceleratorsA
0355 stdcall LoadAcceleratorsW(long ptr) WIN32_LoadAcceleratorsW
0356 stdcall LoadBitmapA(long ptr) WIN32_LoadBitmapA
0357 stdcall LoadBitmapW(long ptr) WIN32_LoadBitmapW
0357 stub LoadBitmapW
0358 stdcall LoadCursorA(long ptr) LoadCursor
0359 stub LoadCursorFromFileA
......@@ -372,13 +372,13 @@ base 1
0366 stub LoadKeyboardLayoutA
0367 stub LoadKeyboardLayoutW
0368 stub LoadLocalFonts
0369 stub LoadMenuA
0370 stub LoadMenuIndirectA
0371 stub LoadMenuIndirectW
0372 stub LoadMenuW
0369 stdcall LoadMenuA(long ptr) WIN32_LoadMenuA
0370 stdcall LoadMenuIndirectA(long ptr) WIN32_LoadMenuIndirectA
0371 stdcall LoadMenuIndirectW(long ptr) WIN32_LoadMenuIndirectW
0372 stdcall LoadMenuW(long ptr) WIN32_LoadMenuW
0373 stub LoadRemoteFonts
0374 stdcall LoadStringA(long long ptr long) LoadStringA32
0375 stdcall LoadStringW(long long ptr long) LoadString32
0374 stdcall LoadStringA(long long ptr long) WIN32_LoadStringA
0375 stdcall LoadStringW(long long ptr long) WIN32_LoadStringW
0376 stub LockWindowStation
0377 stub LockWindowUpdate
0378 stub LookupIconIdFromDirectory
......@@ -524,7 +524,7 @@ base 1
0518 stub SetWindowPlacement
0519 stub SetWindowPos
0520 stub SetWindowStationUser
0521 stub SetWindowTextA
0521 stdcall SetWindowTextA(long ptr) SetWindowText
0522 stub SetWindowTextW
0523 stub SetWindowWord
0524 stub SetWindowsHookA
......@@ -581,7 +581,7 @@ base 1
0575 stub VkKeyScanW
0576 stub WaitForInputIdle
0577 stub WaitMessage
0578 stub WinHelpA
0578 stdcall WinHelpA(long ptr long long) WIN32_WinHelpA
0579 stub WinHelpW
0580 stub WindowFromDC
0581 stub WindowFromPoint
......
......@@ -11,6 +11,8 @@
#include "registers.h"
#include "wine.h"
#define STEP_FLAG 0x100 /* single step flag */
typedef struct
{
DWORD seg; /* 0xffffffff means current default segment (cs or ds) */
......
......@@ -11,6 +11,15 @@
#define MAX_DOS_DRIVES 26
typedef enum
{
TYPE_FLOPPY,
TYPE_HD,
TYPE_CDROM,
TYPE_NETWORK,
TYPE_INVALID
} DRIVETYPE;
extern int DRIVE_Init(void);
extern int DRIVE_IsValid( int drive );
extern int DRIVE_GetCurrentDrive(void);
......@@ -22,8 +31,10 @@ extern const char * DRIVE_GetUnixCwd( int drive );
extern const char * DRIVE_GetLabel( int drive );
extern DWORD DRIVE_GetSerialNumber( int drive );
extern int DRIVE_SetSerialNumber( int drive, DWORD serial );
extern DRIVETYPE DRIVE_GetType( int drive );
extern int DRIVE_Chdir( int drive, const char *path );
extern int DRIVE_Disable( int drive );
extern int DRIVE_Enable( int drive );
extern int DRIVE_GetFreeSpace( int drive, DWORD *size, DWORD *available );
#endif /* __WINE_DRIVE_H */
......@@ -11,11 +11,6 @@ int KERN32_Init(void);
void SetLastError(DWORD error);
DWORD ErrnoToLastError(int errno_num);
/* Linux's wchar_t is unsigned long but Win32 wants unsigned short
*/
typedef unsigned short WCHAR;
typedef WCHAR *LPTSTR;
/* Code page information.
*/
typedef struct {
......@@ -57,8 +52,6 @@ typedef struct {
HANDLE hStdError;
} STARTUPINFO, *LPSTARTUPINFO;
/* SYSTEMTIME, and LPSYSTEMTIME moved to include/windows.h (JBP) */
typedef struct {
LONG Bias;
WCHAR StandardName[32];
......
......@@ -47,8 +47,8 @@ extern void ListBoxSendNotification(LPHEADLIST lphl, WORD code);
extern LPLISTSTRUCT ListBoxGetItem(LPHEADLIST lphl, UINT uIndex);
extern int ListMaxFirstVisible(LPHEADLIST lphl);
extern int ListBoxScrollToFocus(LPHEADLIST lphl);
extern int ListBoxAddString(LPHEADLIST lphl, LPSTR newstr);
extern int ListBoxInsertString(LPHEADLIST lphl, UINT uIndex, LPSTR newstr);
extern int ListBoxAddString(LPHEADLIST lphl, LPCSTR newstr);
extern int ListBoxInsertString(LPHEADLIST lphl, UINT uIndex, LPCSTR newstr);
extern int ListBoxGetText(LPHEADLIST lphl, UINT uIndex, LPSTR OutStr);
extern DWORD ListBoxGetItemData(LPHEADLIST lphl, UINT uIndex);
extern int ListBoxSetItemData(LPHEADLIST lphl, UINT uIndex, DWORD ItemData);
......@@ -58,7 +58,7 @@ extern int ListBoxResetContent(LPHEADLIST lphl);
extern int ListBoxSetCurSel(LPHEADLIST lphl, WORD wIndex);
extern int ListBoxSetSel(LPHEADLIST lphl, WORD wIndex, WORD state);
extern int ListBoxGetSel(LPHEADLIST lphl, WORD wIndex);
extern int ListBoxDirectory(LPHEADLIST lphl, UINT attrib, LPSTR filespec);
extern LONG ListBoxDirectory(LPHEADLIST lphl, UINT attrib, LPCSTR filespec);
extern int ListBoxGetItemRect(LPHEADLIST lphl, WORD wIndex, LPRECT rect);
extern int ListBoxSetItemHeight(LPHEADLIST lphl, WORD wIndex, long height);
extern int ListBoxFindNextMatch(LPHEADLIST lphl, WORD wChar);
......
......@@ -12,6 +12,11 @@
#include "windows.h"
#define MDI_MAXLISTLENGTH 0x40
#define MDI_MAXTITLELENGTH 0xA1
#define MDI_NOFRAMEREPAINT 0
#define MDI_REPAINTFRAMENOW 1
#define MDI_REPAINTFRAME 2
#define WM_MDICALCCHILDSCROLL 0x10AC /* this is exactly what Windows uses */
......@@ -31,12 +36,13 @@ typedef struct
HWND hwndActiveChild;
HMENU hWindowMenu;
WORD idFirstChild; /* order is 3.1-like up to this point */
HANDLE hFrameTitle;
WORD sbStop;
WORD sbRecalc;
HBITMAP obmClose;
HBITMAP obmRestore;
HWND hwndHitTest;
RECT rectMaximize;
RECT rectRestore;
HWND self;
} MDICLIENTINFO;
#endif /* MDI_H */
......@@ -26,7 +26,6 @@ typedef struct tagMENUITEM
HBITMAP hCheckBit; /* Bitmap for checked item */
HBITMAP hUnCheckBit; /* Bitmap for unchecked item */
HANDLE hText; /* Handle to item string or bitmap */
char *item_text;
} MENUITEM, *LPMENUITEM;
......
......@@ -27,7 +27,7 @@ extern void INT_SetHandler( BYTE intnum, SEGPTR handler );
extern DWORD INT1A_GetTicksSinceMidnight(void);
/* miscemu/int21.c */
extern void INT21_Init(void);
extern BOOL INT21_Init(void);
/* miscemu/ioports.c */
extern DWORD inport( int port, int count );
......
......@@ -39,4 +39,10 @@ struct options
extern struct options Options;
/* Profile functions */
extern int PROFILE_LoadWineIni(void);
extern int PROFILE_GetWineIniString( const char *section, const char *key_name,
const char *def, char *buffer, int len );
#endif
......@@ -16,7 +16,8 @@ LPVOID LockResource32( HANDLE32 handle );
BOOL FreeResource32( HANDLE32 handle );
INT AccessResource32( HINSTANCE hModule, HRSRC hRsrc );
DWORD SizeofResource32( HINSTANCE hModule, HRSRC hRsrc );
int LoadString32(HINSTANCE instance, DWORD resource_id, LPTSTR buffer, int buflen);
int WIN32_LoadStringW(HINSTANCE instance, DWORD resource_id, LPWSTR buffer, int buflen);
int WIN32_LoadStringA(HINSTANCE instance, DWORD resource_id, LPSTR buffer, int buflen);
typedef struct _IMAGE_RESOURCE_DIRECTORY {
DWORD Characteristics;
......
/*
* Shell Library definitions
*/
#include "wintypes.h"
#ifndef __WINE_SHELL_H
#define __WINE_SHELL_H
#include "windows.h"
extern INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon);
extern void SHELL_LoadRegistry();
......@@ -21,13 +27,6 @@ extern BOOL SHELL_Init();
#define HKEY_CLASSES_ROOT 1
#ifdef WINELIB32
typedef void* HKEY;
#else
typedef DWORD HKEY;
#endif
typedef HKEY FAR* LPHKEY;
typedef struct tagKEYSTRUCT {
HKEY hKey;
LPSTR lpSubKey;
......@@ -54,3 +53,4 @@ typedef struct { /* structure for dropped files */
LRESULT AboutDlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam);
#endif /* __WINE_SHELL_H */
......@@ -114,13 +114,11 @@
#undef DEBUG_LDT
#undef DEBUG_LISTBOX
#undef DEBUG_LOCAL
#undef DEBUG_MALLOC
#undef DEBUG_MCI
#undef DEBUG_MCIANIM
#undef DEBUG_MCIWAVE
#undef DEBUG_MDI
#undef DEBUG_MENU
#undef DEBUG_MENUCALC
#undef DEBUG_MESSAGE
#undef DEBUG_METAFILE
#undef DEBUG_MIDI
......@@ -194,13 +192,11 @@
#define DEBUG_LDT
#define DEBUG_LISTBOX
#define DEBUG_LOCAL
#define DEBUG_MALLOC
#define DEBUG_MCI
#define DEBUG_MCIANIM
#define DEBUG_MCIWAVE
#define DEBUG_MDI
#define DEBUG_MENU
#define DEBUG_MENUCALC
#define DEBUG_MESSAGE
#define DEBUG_METAFILE
#define DEBUG_MIDI
......
/*
* Unicode string management
*
* Copyright 1995 Martin von Loewis
*
*/
#ifndef _STRING32_H
#define _STRING32_H
#include "wintypes.h"
int STRING32_UniLen(LPWSTR s);
void STRING32_UniToAnsi(LPSTR dest,LPCWSTR src);
void STRING32_AnsiToUni(LPWSTR dest,LPCSTR src);
LPSTR STRING32_DupUniToAnsi(LPWSTR src);
LPWSTR STRING32_DupAnsiToUni(LPSTR src);
LPWSTR STRING32_lstrcmpnW(LPCWSTR a,LPCWSTR b,DWORD len);
#endif
/* Structure definitions for Win32 -- used only internally */
#ifndef _STRUCT32_H
#define _STRUCT32_H
typedef struct tagRECT32
{
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT32;
void USER32_RECT32to16(const RECT32*,RECT*);
void USER32_RECT16to32(const RECT*,RECT32*);
typedef struct tagPOINT32
{
LONG x;
LONG y;
} POINT32;
void PARAM32_POINT32to16(const POINT32*,POINT*);
void PARAM32_POINT16to32(const POINT*,POINT32*);
#endif
......@@ -261,5 +261,87 @@ BOOL ClassNext( CLASSENTRY *pClassEntry );
DWORD MemoryRead( WORD sel, DWORD offset, void *buffer, DWORD count );
DWORD MemoryWrite( WORD sel, DWORD offset, void *buffer, DWORD count );
/* flags to NotifyRegister() */
#define NF_NORMAL 0 /* everything except taskswitches, debugerrors,
* debugstrings
*/
#define NF_TASKSWITCH 1 /* get taskswitch information */
#define NF_RIP 2 /* get debugerrors of system */
BOOL NotifyRegister(HTASK htask,FARPROC lpfnCallback,WORD wFlags);
#define NFY_UNKNOWN 0
#define NFY_LOADSEG 1
/* DATA is a pointer to following struct: */
struct {
DWORD dwSize;
WORD wSelector;
WORD wSegNum;
WORD wType; /* bit 0 set if this is a code segment */
WORD wcInstance; /* only valid for data segment */
} NFYLOADSEG;
/* called when freeing a segment. LOWORD(dwData) is the freed selector */
#define NFY_FREESEG 2
/* called when loading/starting a DLL */
#define NFY_STARTDLL 3
struct {
DWORD dwSize;
HMODULE hModule;
WORD wCS;
WORD wIP;
} NFYSTARTDLL;
/* called when starting a task. dwData is CS:IP */
#define NFY_STARTTASK 4
/* called when a task terminates. dwData is the return code */
#define NFY_EXITTASK 5
/* called when module is removed. LOWORD(dwData) is the handle */
#define NFY_DELMODULE 6
/* RIP? debugevent */
#define NFY_RIP 7
struct {
DWORD dwSize;
WORD wIP;
WORD wCS;
WORD wSS;
WORD wBP;
WORD wExitCode;
} NFYRIP;
/* called before (after?) switching to a task
* no data, callback should call GetCurrentTask
*/
#define NFY_TASKIN 8
/* called before(after?) switching from a task
* no data, callback should call GetCurrentTask
*/
#define NFY_TASKOUT 9
/* returns ASCII input value, dwData not set */
#define NFY_INCHAR 10
/* output debugstring (pointed to by dwData) */
#define NFY_OUTSTRING 11
/* log errors */
#define NFY_LOGERROR 12
struct {
DWORD dwSize;
UINT wErrCode;
VOID FAR* lpInfo; /* depends on wErrCode */
} NFYLOGERROR;
/* called for parameter errors? */
#define NFY_LOGPARAMERROR 13
struct {
DWORD dwSize;
UINT wErrCode;
FARPROC lpfnErrorAddr;
void FAR* FAR* lpBadParam;
} NFYLOGPARAMERROR;
#endif /* __TOOLHELP_H */
#ifndef __WINE_WINE_H
#define __WINE_WINE_H
extern char *WineIniFileName(void);
#define WINE_INI WineIniFileName()
#ifdef i386
extern int runtime_cpu (void);
#else
......
......@@ -24,6 +24,10 @@ typedef unsigned long DWORD;
typedef unsigned short BOOL;
typedef unsigned char BYTE;
typedef long LONG;
typedef unsigned char CHAR;
/* Some systems might have wchar_t, but we really need 16 bit characters */
typedef unsigned short WCHAR;
#ifdef WINELIB32
typedef int INT;
typedef unsigned int UINT;
......@@ -53,6 +57,8 @@ typedef DWORD HHOOK;
typedef char *LPSTR;
typedef const char *LPCSTR;
typedef LPCSTR LPCTSTR;
typedef WCHAR *LPWSTR;
typedef const WCHAR *LPCWSTR;
typedef char *NPSTR;
typedef INT *LPINT;
typedef UINT *LPUINT;
......@@ -90,7 +96,12 @@ DECLARE_HANDLE(HRSRC);
DECLARE_HANDLE(HTASK);
DECLARE_HANDLE(HWND);
DECLARE_HANDLE(LOCALHANDLE);
#ifdef WINELIB32
DECLARE_HANDLE(HKEY);
#else
typedef DWORD HKEY;
#endif
typedef HKEY* LPHKEY;
typedef HGLOBAL GLOBALHANDLE;
#ifdef WINELIB
......@@ -101,6 +112,7 @@ typedef SEGPTR FARPROC;
typedef SEGPTR WNDPROC;
#endif
typedef FARPROC DLGPROC;
typedef FARPROC FONTENUMPROC;
typedef FARPROC HOOKPROC;
#define TRUE 1
......@@ -108,6 +120,7 @@ typedef FARPROC HOOKPROC;
#define CW_USEDEFAULT ((INT)0x8000)
#define FAR
#define NEAR
#define _near
#define PASCAL
#define VOID void
#define WINAPI PASCAL
......
......@@ -81,7 +81,7 @@ int main()
fprintf(stddeb, "NULL\n");
else {
fprintf(stddeb, "0x%06x\n", (int)ret-(int)block);
bzero (ret,size); /* test boundaries */
memset( ret,0, size ); /* test boundaries */
}
} else { /* free */
/* free shm fragment */
......
......@@ -82,8 +82,7 @@ HANDLE LocalAlloc (WORD flags, WORD bytes)
if ((m = malloc (bytes)))
{
*slot = m;
if (flags & LMEM_ZEROINIT)
bzero (m, bytes);
if (flags & LMEM_ZEROINIT) memset( m, 0, bytes );
#ifdef DEBUG_HEAP
printf ("Handle %d [%d] = %p\n", hMem+1, bytes, m);
......@@ -220,8 +219,7 @@ HANDLE HEAP_Alloc (WORD flags, DWORD bytes)
bytes+=sizeof(HeapData);
if ((m = malloc (bytes)))
{
if (flags & LMEM_ZEROINIT)
bzero (m, bytes);
if (flags & LMEM_ZEROINIT) memset( m, 0, bytes );
}
m->Size=bytes-sizeof(HeapData);
return m+1;
......@@ -253,7 +251,7 @@ HANDLE HEAP_ReAlloc(HANDLE hMem,DWORD bytes,UINT flags)
}
m=realloc (m-1, bytes+sizeof(HeapData));
if(flags & LMEM_ZEROINIT && bytes > m->Size)
bzero ((char*)m+sizeof(HeapData)+m->Size, bytes-m->Size);
memset( (char*)m+sizeof(HeapData)+m->Size, 0, bytes-m->Size );
m->Size=bytes;
return m+1;
}
......
......@@ -68,7 +68,7 @@ HRSRC LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type )
for(Res=ResBlock->Resources; *Res; Res++)
if(name)
{
if((*Res)->type==typeid && !strcmp((*Res)->name,name))
if((*Res)->type==typeid && !lstrcmpi((*Res)->name,name))
return (HRSRC)*Res;
}
else
......
/* Sample winestub.c file for compiling programs with libwine.so. */
#include "windows.h"
#include "wine.h"
#ifdef WIN_DEBUG
#include <stdio.h>
#endif
extern int PASCAL WinMain(HINSTANCE,HINSTANCE,LPSTR,int);
/* This is the renamed main() subroutine in misc/main.c. */
/* Note that the libdll `init()' won't work: */
extern HINSTANCE _wine_main(int, char *[]);
int main (int argc, char *argv [])
{
HINSTANCE hInstance;
char szCmdParam[256] = {0};
int index, buffer_pos;
char *arg_holder;
/* "Wired-in" command-line options for Wine: */
/*char *wine_argv[] = {argv[0], "-managed", "-dll", "+commdlg",
"-dll", "+shell", ""};*/
char *wine_argv[] = {argv[0], ""};
/* Initialize the library dll: */
hInstance = (HINSTANCE)_wine_main((sizeof(wine_argv)/sizeof(char *))-1, wine_argv);
#ifdef WIN_DEBUG
fprintf(stderr,"In winestub, reporting hInstance = %d\n", hInstance);
#endif
/* Move things from argv to the szCmdParam that WinMain expects: */
for (index = 1, buffer_pos = 0;
(index < argc) && (buffer_pos < 255);
index++, buffer_pos++)
{
for (arg_holder = argv[index]; ; buffer_pos++, arg_holder++)
if ((szCmdParam[buffer_pos] = *arg_holder) == '\0') break;
szCmdParam[buffer_pos] = ' ';
};
szCmdParam[buffer_pos] = '\0';
#ifdef WIN_DEBUG
fprintf(stderr,"In winestub, Program Name: %s, Parameters: %s\n",
progname, szCmdParam);
#endif
return WinMain (hInstance, /* hInstance */
0, /* hPrevInstance */
(LPSTR)szCmdParam, /* lpszCmdParam */
SW_NORMAL); /* nCmdShow */
}
......@@ -11,13 +11,11 @@ extern int PASCAL WinMain(HINSTANCE,HINSTANCE,LPSTR,int);
extern void TASK_Reschedule(void);
extern int USER_InitApp(HINSTANCE);
char* progname=NULL;
int _WinMain (int argc, char *argv [])
{
HINSTANCE hInstance;
progname=*argv;
if(!MAIN_Init()) return 0; /* JBP: Needed for DosDrives[] structure, etc. */
hInstance = WinExec( *argv, SW_SHOWNORMAL );
TASK_Reschedule();
......@@ -26,8 +24,12 @@ int _WinMain (int argc, char *argv [])
if (!WIDGETS_Init()) return -1;
if (!WIN_CreateDesktopWindow()) return -1;
#ifdef WINELIBDLL
return (int)hInstance;
#else
return WinMain (hInstance, /* hInstance */
0, /* hPrevInstance */
"", /* lpszCmdParam */
SW_NORMAL); /* nCmdShow */
#endif
}
......@@ -51,6 +51,9 @@ int MAIN_Init(void)
int queueSize;
/* Load the configuration file */
if (!PROFILE_LoadWineIni()) return 0;
SpyInit();
#ifndef WINELIB
......@@ -89,7 +92,7 @@ int MAIN_Init(void)
#ifndef WINELIB
/* Initialize the DOS memory */
INT21_Init();
if (!INT21_Init()) return 0;
/* Create USER heap */
if (!USER_HeapInit()) return 0;
......
......@@ -954,14 +954,16 @@ HINSTANCE LoadModule( LPCSTR name, LPVOID paramBlock )
/* Create the module structure */
hModule = MODULE_LoadExeHeader( fd, &ofs );
if (hModule == 21) hModule = PE_LoadModule( fd, &ofs, paramBlock );
close( fd );
if (hModule < 32)
{
fprintf( stderr, "LoadModule: can't load '%s', error=%d\n",
name, hModule );
if (hModule == 21) hModule = PE_LoadModule( fd, &ofs, paramBlock );
close(fd);
if (hModule < 32)
fprintf( stderr, "LoadModule: can't load '%s', error=%d\n",
name, hModule );
return hModule;
}
close( fd );
pModule = (NE_MODULE *)GlobalLock( hModule );
/* Allocate the segments for this module */
......
......@@ -320,7 +320,8 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
if(additive && offset)
fprintf(stderr,"Additive selector to %4.4x.Please report\n",offset);
}
while (offset != 0xffff && !additive);
/* FIXME: Quicken 5 has a zero offset fixup. This seems to work */
while (offset && offset != 0xffff && !additive);
break;
default:
......
......@@ -38,7 +38,9 @@ struct w_files *wine_files = NULL;
void my_wcstombs(char * result, u_short * source, int len)
{
while(len--) {
if(isascii(*source)) *result++ = *source++;
/* this used to be isascii, but see isascii implementation in Linux'
ctype.h */
if(*source<255) *result++ = *source++;
else {
printf("Unable to handle unicode right now\n");
exit(0);
......@@ -206,7 +208,7 @@ void fixup_imports(struct w_files* wpnt)
}
dprintf_win32(stddeb, "--- %s %s.%d\n", pe_name->Name, Module, pe_name->Hint);
#ifndef WINELIB /* FIXME: JBP: Should this happen in libwine.a? */
/* Both calls should be unified into GetProcAddress */
/* FIXME: Both calls should be unified into GetProcAddress */
*thunk_list=(unsigned int)RELAY32_GetEntryPoint(Module,pe_name->Name,pe_name->Hint);
if(*thunk_list == 0)
*thunk_list = WIN32_GetProcAddress(MODULE_FindModule(Module),
......@@ -236,7 +238,11 @@ void fixup_imports(struct w_files* wpnt)
}
dprintf_win32(stddeb, "--- %s %s.%d\n", pe_name->Name, Module, pe_name->Hint);
#ifndef WINELIB /* FIXME: JBP: Should this happen in libwine.a? */
/* FIXME: Both calls should be unified into GetProcAddress */
*thunk_list=(unsigned int)RELAY32_GetEntryPoint(Module,pe_name->Name,pe_name->Hint);
if(*thunk_list == 0)
*thunk_list = WIN32_GetProcAddress(MODULE_FindModule(Module),
pe_name->Name);
#else
fprintf(stderr,"JBP: Call to RELAY32_GetEntryPoint being ignored.\n");
#endif
......@@ -346,6 +352,7 @@ static HINSTANCE PE_LoadImage( int fd, struct w_files *wpnt )
{
int i, result;
unsigned int load_addr;
struct Directory dir;
wpnt->pe = xmalloc(sizeof(struct pe_data));
memset(wpnt->pe,0,sizeof(struct pe_data));
......@@ -426,17 +433,89 @@ static HINSTANCE PE_LoadImage( int fd, struct w_files *wpnt )
if(strcmp(wpnt->pe->pe_seg[i].Name, ".rsrc") == 0) {
wpnt->pe->pe_resource = (struct PE_Resource_Directory *) result;
#if 0
/* FIXME pe->resource_offset should be deleted from structure if this
ifdef doesn't break anything */
/* save offset for PE_FindResource */
wpnt->pe->resource_offset = wpnt->pe->pe_seg[i].Virtual_Address -
wpnt->pe->pe_seg[i].PointerToRawData;
#endif
}
if(strcmp(wpnt->pe->pe_seg[i].Name, ".reloc") == 0)
wpnt->pe->pe_reloc = (struct PE_Reloc_Block *) result;
}
/* There is word that the actual loader does not care about the
section names, and only goes for the DataDirectory */
dir=wpnt->pe->pe_header->opt_coff.DataDirectory[IMAGE_FILE_EXPORT_DIRECTORY];
if(dir.Size)
{
if(wpnt->pe->pe_export &&
wpnt->pe->pe_export!=load_addr+dir.Virtual_address)
fprintf(stderr,"wrong export directory??\n");
else
wpnt->pe->pe_export = load_addr+dir.Virtual_address;
}
dir=wpnt->pe->pe_header->opt_coff.DataDirectory[IMAGE_FILE_IMPORT_DIRECTORY];
if(dir.Size)
{
if(wpnt->pe->pe_import &&
wpnt->pe->pe_import!=load_addr+dir.Virtual_address)
fprintf(stderr,"wrong export directory??\n");
else
wpnt->pe->pe_import = load_addr+dir.Virtual_address;
}
dir=wpnt->pe->pe_header->opt_coff.DataDirectory[IMAGE_FILE_RESOURCE_DIRECTORY];
if(dir.Size)
{
if(wpnt->pe->pe_resource &&
wpnt->pe->pe_resource!=load_addr+dir.Virtual_address)
fprintf(stderr,"wrong resource directory??\n");
else
wpnt->pe->pe_resource = load_addr+dir.Virtual_address;
}
dir=wpnt->pe->pe_header->opt_coff.DataDirectory[IMAGE_FILE_BASE_RELOCATION_TABLE];
if(dir.Size)
{
if(wpnt->pe->pe_reloc &&
wpnt->pe->pe_reloc!=load_addr+dir.Virtual_address)
fprintf(stderr,"wrong export directory??\n");
else
wpnt->pe->pe_reloc = load_addr+dir.Virtual_address;
}
if(wpnt->pe->pe_header->opt_coff.DataDirectory
[IMAGE_FILE_EXCEPTION_DIRECTORY].Size)
dprintf_win32(stdnimp,"Exception directory ignored\n");
if(wpnt->pe->pe_header->opt_coff.DataDirectory
[IMAGE_FILE_SECURITY_DIRECTORY].Size)
dprintf_win32(stdnimp,"Security directory ignored\n");
if(wpnt->pe->pe_header->opt_coff.DataDirectory
[IMAGE_FILE_DEBUG_DIRECTORY].Size)
dprintf_win32(stdnimp,"Debug directory ignored\n");
if(wpnt->pe->pe_header->opt_coff.DataDirectory
[IMAGE_FILE_DESCRIPTION_STRING].Size)
dprintf_win32(stdnimp,"Description string ignored\n");
if(wpnt->pe->pe_header->opt_coff.DataDirectory
[IMAGE_FILE_MACHINE_VALUE].Size)
dprintf_win32(stdnimp,"Machine Value ignored\n");
if(wpnt->pe->pe_header->opt_coff.DataDirectory
[IMAGE_FILE_THREAD_LOCAL_STORAGE].Size)
dprintf_win32(stdnimp,"Thread local storage ignored\n");
if(wpnt->pe->pe_header->opt_coff.DataDirectory
[IMAGE_FILE_CALLBACK_DIRECTORY].Size)
dprintf_win32(stdnimp,"Callback directory ignored\n");
if(wpnt->pe->pe_import) fixup_imports(wpnt);
if(wpnt->pe->pe_export) dump_exports(wpnt->pe->pe_export,load_addr);
......
......@@ -68,6 +68,17 @@ static void win_fault(int signal, int code, struct sigcontext *context)
fprintf( stderr,"In win_fault %x:%lx\n",
CS_reg(context), EIP_reg(context) );
}
/* If SIGTRAP not caused by breakpoint or single step
don't jump into the debugger */
if ((signal == SIGTRAP) && !(EFL_reg(context) & STEP_FLAG))
{
DBG_ADDR addr;
addr.seg = CS_reg(context);
addr.off = EIP_reg(context) - 1;
if (DEBUG_FindBreakpoint(&addr) == -1) return;
}
XUngrabPointer(display, CurrentTime);
XUngrabServer(display);
XFlush(display);
......
......@@ -77,7 +77,7 @@ static HANDLE TASK_CreateDOSEnvironment(void)
{
static const char program_name[] = "KRNL386.EXE";
char **e, *p;
int initial_size, size, i, winpathlen, windirlen, sysdirlen;
int initial_size, size, i, winpathlen, sysdirlen;
HANDLE handle;
extern char **environ;
......@@ -88,7 +88,6 @@ static HANDLE TASK_CreateDOSEnvironment(void)
* ...
* ASCIIZ string n
* ASCIIZ PATH=xxx
* ASCIIZ windir=xxx
* BYTE 0
* WORD 1
* ASCIIZ program name (e.g. C:\WINDOWS\SYSTEM\KRNL386.EXE)
......@@ -103,10 +102,8 @@ static HANDLE TASK_CreateDOSEnvironment(void)
winpathlen += len + 1;
}
if (!winpathlen) winpathlen = 1;
windirlen = GetWindowsDirectory( NULL, 0 ) + 1;
sysdirlen = GetSystemDirectory( NULL, 0 ) + 1;
initial_size = 5 + winpathlen + /* PATH=xxxx */
7 + windirlen + /* windir=xxxx */
1 + /* BYTE 0 at end */
sizeof(WORD) + /* WORD 1 */
sysdirlen + /* program directory */
......@@ -148,7 +145,7 @@ static HANDLE TASK_CreateDOSEnvironment(void)
}
}
/* Now add the path and Windows directory */
/* Now add the path */
strcpy( p, "PATH=" );
for (i = 0, p += 5; ; i++)
......@@ -160,10 +157,6 @@ static HANDLE TASK_CreateDOSEnvironment(void)
if (p[-1] == ';') p[-1] = '\0';
else p++;
strcpy( p, "windir=" );
GetWindowsDirectory( p + 7, windirlen );
p += 7 + windirlen;
/* Now add the program name */
*p++ = '\0';
......@@ -575,34 +568,36 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
static void TASK_DeleteTask( HTASK hTask )
{
TDB *pTask;
HANDLE hPDB;
if (!(pTask = (TDB *)GlobalLock( hTask ))) return;
hPDB = pTask->hPDB;
/* Close all open files of this task */
FILE_CloseAllFiles( pTask->hPDB );
/* Free the task module */
/* Free the task module */
FreeModule( pTask->hModule );
/* Free all memory used by this task (including the 32-bit stack, */
/* the environment block and the thunk segments). */
/* Close all open files of this task */
GlobalFreeAll( pTask->hPDB );
FILE_CloseAllFiles( pTask->hPDB );
/* Free message queue */
/* Free the message queue */
MSG_DeleteMsgQueue( pTask->hQueue );
/* Free the selector aliases */
/* Free the selector aliases */
GLOBAL_FreeBlock( pTask->hCSAlias );
GLOBAL_FreeBlock( pTask->hPDB );
/* Free the task structure itself */
/* Free the task structure itself */
GlobalFree( hTask );
/* Free all memory used by this task (including the 32-bit stack, */
/* the environment block and the thunk segments). */
GlobalFreeAll( hPDB );
}
......@@ -626,7 +621,7 @@ void TASK_KillCurrentTask( int exitCode )
if (nTaskCount <= 1)
{
dprintf_task( stddeb, "Killing the last task, exiting\n" );
exit(0);
ExitWindows( 0, 0 );
}
/* Remove the task from the list to be sure we never switch back to it */
......@@ -792,13 +787,13 @@ void InitTask( struct sigcontext_struct context )
ESI_reg(&context) = (DWORD)pTask->hPrevInstance;
EDI_reg(&context) = (DWORD)pTask->hInstance;
ES_reg (&context) = (WORD)pTask->hPDB;
#endif
/* Initialize the local heap */
if ( pModule->heap_size )
{
LocalInit( pTask->hInstance, 0, pModule->heap_size );
}
#endif
/* Initialize the INSTANCEDATA structure */
......
......@@ -22,7 +22,7 @@
/* Global arena block */
typedef struct
{
DWORD base; /* Base address */
DWORD base; /* Base address (0 if discarded) */
DWORD size; /* Size in bytes (0 indicates a free block) */
HGLOBAL handle; /* Handle for this block */
HGLOBAL hOwner; /* Owner of this block */
......@@ -30,7 +30,9 @@ typedef struct
BYTE pageLockCount; /* Count of GlobalPageLock() calls */
BYTE flags; /* Allocation flags */
BYTE selCount; /* Number of selectors allocated for this block */
#ifdef CONFIG_IPC
int shmid;
#endif
} GLOBALARENA;
/* Flags definitions */
......@@ -116,6 +118,8 @@ HGLOBAL GLOBAL_CreateBlock( WORD flags, const void *ptr, DWORD size,
pArena->base = (DWORD)ptr;
pArena->size = GET_SEL_LIMIT(sel) + 1;
#ifdef CONFIG_IPC
if ((flags & GMEM_DDESHARE) && Options.ipc)
{
pArena->handle = shmdata->handle;
......@@ -127,6 +131,9 @@ HGLOBAL GLOBAL_CreateBlock( WORD flags, const void *ptr, DWORD size,
pArena->handle = (flags & GMEM_MOVEABLE) ? sel - 1 : sel;
pArena->shmid = 0;
}
#else
pArena->handle = (flags & GMEM_MOVEABLE) ? sel - 1 : sel;
#endif
pArena->hOwner = hOwner;
pArena->lockCount = 0;
pArena->pageLockCount = 0;
......@@ -174,11 +181,15 @@ HGLOBAL GLOBAL_Alloc( WORD flags, DWORD size, HGLOBAL hOwner,
dprintf_global( stddeb, "GlobalAlloc: %ld flags=%04x\n", size, flags );
/* Fixup the size */
/* If size is 0, create a discarded block */
if (size == 0) return GLOBAL_CreateBlock( flags, NULL, 1, hOwner, isCode,
is32Bit, isReadOnly, NULL );
/* Fixup the size */
if (size >= GLOBAL_MAX_ALLOC_SIZE - 0x1f) return 0;
if (size == 0) size = 0x20;
else size = (size + 0x1f) & ~0x1f;
size = (size + 0x1f) & ~0x1f;
/* Allocate the linear memory */
......@@ -770,7 +781,7 @@ BOOL MemManInfo( MEMMANINFO *pInfo )
if ((meminfo = fopen("/proc/meminfo", "r")) < 0) {
perror("wine: open");
exit(1);
return FALSE;
}
fgets(buf, 80, meminfo); /* read first line */
......@@ -782,18 +793,20 @@ BOOL MemManInfo( MEMMANINFO *pInfo )
}
fprintf(stderr,"MemManInfo called with dwSize = %ld\n",pInfo->dwSize);
pInfo->wPageSize = getpagesize();
pInfo->dwLargestFreeBlock = availmem;
pInfo->dwTotalLinearSpace = totalmem / pInfo->wPageSize;
pInfo->dwMaxPagesAvailable = pInfo->dwLargestFreeBlock / pInfo->wPageSize;
pInfo->dwMaxPagesLockable = pInfo->dwMaxPagesLockable;
/* FIXME: the next three are not quite correct */
pInfo->dwTotalUnlockedPages = pInfo->dwMaxPagesAvailable;
pInfo->dwFreePages = pInfo->dwMaxPagesAvailable;
pInfo->dwTotalPages = pInfo->dwMaxPagesAvailable;
/* FIXME: the three above are not quite correct */
pInfo->dwFreeLinearSpace = pInfo->dwMaxPagesAvailable;
pInfo->dwSwapFilePages = 0L;
if (pInfo->dwSize) {
pInfo->wPageSize = getpagesize();
pInfo->dwLargestFreeBlock = availmem;
pInfo->dwTotalLinearSpace = totalmem / pInfo->wPageSize;
pInfo->dwMaxPagesAvailable = pInfo->dwLargestFreeBlock / pInfo->wPageSize;
pInfo->dwMaxPagesLockable = pInfo->dwMaxPagesLockable;
/* FIXME: the next three are not quite correct */
pInfo->dwTotalUnlockedPages = pInfo->dwMaxPagesAvailable;
pInfo->dwFreePages = pInfo->dwMaxPagesAvailable;
pInfo->dwTotalPages = pInfo->dwMaxPagesAvailable;
/* FIXME: the three above are not quite correct */
pInfo->dwFreeLinearSpace = pInfo->dwMaxPagesAvailable;
pInfo->dwSwapFilePages = 0L;
}
return TRUE;
#else
return TRUE;
......
......@@ -107,7 +107,9 @@ static LOCALHEAPINFO *LOCAL_GetHeap( WORD ds )
LOCALHEAPINFO *pInfo;
INSTANCEDATA *ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( ds, 0 );
dprintf_local( stddeb, "Heap at %p, %04x\n", ptr, ptr->heap );
if (!ptr->heap) return 0;
if (!ptr->heap) return NULL;
if (IsBadReadPtr((SEGPTR)MAKELONG( ptr->heap, ds ), sizeof(LOCALHEAPINFO)))
return NULL;
pInfo = (LOCALHEAPINFO*)((char*)ptr + ptr->heap);
if (pInfo->magic != LOCAL_HEAP_MAGIC) return NULL;
return pInfo;
......
......@@ -6,7 +6,6 @@ C_SRCS = \
comm.c \
commdlg.c \
compobj.c \
dos_fs.c \
driver.c \
exec.c \
escape.c \
......@@ -20,14 +19,13 @@ C_SRCS = \
olecli.c \
olesvr.c \
port.c \
profile.c \
rect.c \
shell.c \
sound.c \
spy.c \
stress.c \
toolhelp.c \
user.c \
user32.c \
winsocket.c \
xmalloc.c
......
......@@ -165,7 +165,7 @@ HANDLE GetClipboardData(WORD wFormat)
/**************************************************************************
* CountClipboardFormats [USER.143]
*/
int CountClipboardFormats()
INT CountClipboardFormats()
{
int FormatCount = 0;
LPCLIPFORMAT lpFormat = ClipFormats;
......
......@@ -16,9 +16,9 @@
#endif
#include <unistd.h>
#include "wine.h"
#include "windows.h"
#include "comm.h"
#include "options.h"
#include "stddebug.h"
/* #define DEBUG_COMM */
/* #undef DEBUG_COMM */
......@@ -40,11 +40,12 @@ void COMM_Init(void)
option[3] = '1' + x;
option[4] = '\0';
GetPrivateProfileString("serialports", option, "*", temp, sizeof(temp), WINE_INI);
PROFILE_GetWineIniString( "serialports", option, "*",
temp, sizeof(temp) );
if (!strcmp(temp, "*") || *temp == '\0')
COM[x].devicename = NULL;
else {
btemp = index(temp,',');
btemp = strchr(temp,',');
if (btemp != NULL) {
*btemp++ = '\0';
COM[x].baudrate = atoi(btemp);
......@@ -69,7 +70,8 @@ void COMM_Init(void)
option[3] = '1' + x;
option[4] = '\0';
GetPrivateProfileString("parallelports", option, "*", temp, sizeof(temp), WINE_INI);
PROFILE_GetWineIniString( "parallelports", option, "*",
temp, sizeof(temp) );
if (!strcmp(temp, "*") || *temp == '\0')
LPT[x].devicename = NULL;
else {
......@@ -124,7 +126,7 @@ int WinError(void)
}
}
int BuildCommDCB(LPSTR device, DCB FAR *lpdcb)
BOOL BuildCommDCB(LPCSTR device, LPDCB lpdcb)
{
/* "COM1:9600,n,8,1" */
/* 012345 */
......@@ -219,7 +221,7 @@ int BuildCommDCB(LPSTR device, DCB FAR *lpdcb)
return 0;
}
int OpenComm(LPSTR device, UINT cbInQueue, UINT cbOutQueue)
int OpenComm(LPCSTR device, UINT cbInQueue, UINT cbOutQueue)
{
int port, fd;
......
/*
* DOS-FS
* NOV 1993 Erik Bos <erik@xs4all.nl>
*
* FindFile by Bob, hacked for dos & unixpaths by Erik.
*
* Bugfix by dash@ifi.uio.no: ToUnix() was called to often
*/
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <pwd.h>
#include <dirent.h>
#include <unistd.h>
#include <fcntl.h>
#if defined(__linux__) || defined(sun)
#include <sys/vfs.h>
#endif
#if defined(__NetBSD__) || defined(__FreeBSD__)
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/errno.h>
#endif
#ifdef __svr4__
#include <sys/statfs.h>
#endif
#include "wine.h"
#include "windows.h"
#include "msdos.h"
#include "dos_fs.h"
#include "comm.h"
#include "task.h"
#include "stddebug.h"
#include "debug.h"
#include "xmalloc.h"
#define WINE_INI_USER "~/.winerc"
static void ExpandTildeString(char *s)
{
struct passwd *entry;
char temp[1024], *ptr = temp;
strcpy(temp, s);
while (*ptr)
{
if (*ptr != '~')
{
*s++ = *ptr++;
continue;
}
ptr++;
if ( (entry = getpwuid(getuid())) == NULL)
{
continue;
}
strcpy(s, entry->pw_dir);
s += strlen(entry->pw_dir);
}
*s = 0;
}
int DOS_GetFreeSpace(int drive, long *size, long *available)
{
struct statfs info;
const char *root;
if (!DRIVE_IsValid(drive)) return 0;
root = DRIVE_GetRoot(drive);
#ifdef __svr4__
if (statfs( root, &info, 0, 0) < 0) {
#else
if (statfs( root, &info) < 0) {
#endif
fprintf(stderr,"dosfs: cannot do statfs(%s)\n", root );
return 0;
}
*size = info.f_bsize * info.f_blocks;
#ifdef __svr4__
*available = info.f_bfree * info.f_bsize;
#else
*available = info.f_bavail * info.f_bsize;
#endif
return 1;
}
/**********************************************************************
* WineIniFileName
*/
char *WineIniFileName(void)
{
int fd;
static char *filename = NULL;
static char name[256];
if (filename)
return filename;
strcpy(name, WINE_INI_USER);
ExpandTildeString(name);
if ((fd = open(name, O_RDONLY)) != -1) {
close(fd);
filename = name;
return filename;
}
if ((fd = open(WINE_INI_GLOBAL, O_RDONLY)) != -1) {
close(fd);
filename = WINE_INI_GLOBAL;
return filename;
}
fprintf(stderr,"wine: can't open configuration file %s or %s !\n",
WINE_INI_GLOBAL, WINE_INI_USER);
exit(1);
}
......@@ -9,6 +9,7 @@
#include <unistd.h>
#include "neexe.h"
#include "dlls.h"
#include "shell.h"
#include "windows.h"
#include "callback.h"
#include "stddebug.h"
......@@ -41,6 +42,11 @@ BOOL ExitWindows(DWORD dwReturnCode, WORD wReserved)
dprintf_exec( stdnimp,"PARTIAL STUB ExitWindows(%08lX, %04X)\n",
dwReturnCode, wReserved);
/* Do the clean-up stuff */
WriteOutProfiles();
SHELL_SaveRegistry();
exit( LOWORD(dwReturnCode) );
}
......
......@@ -106,7 +106,7 @@ SEGPTR lstrcpy( SEGPTR target, SEGPTR source )
}
/* KERNEL.353 32-bit version*/
char *lstrcpyn( char *dst, const char *src, int n )
LPSTR lstrcpyn( LPSTR dst, LPCSTR src, int n )
{
char *tmp = dst;
while(n-- > 1 && *src)
......@@ -293,7 +293,7 @@ BOOL OemToAnsi(LPSTR lpOemStr, LPSTR lpAnsiStr)
}
/* AnsiToOemBuff Keyboard.134 */
void AnsiToOemBuff(LPSTR lpAnsiStr, LPSTR lpOemStr, INT nLength)
void AnsiToOemBuff(LPCSTR lpAnsiStr, LPSTR lpOemStr, UINT nLength)
{
int i;
for(i=0;i<nLength;i++)
......
......@@ -524,29 +524,20 @@ static void MAIN_RestoreSetup(void)
}
#ifdef MALLOC_DEBUGGING
static void malloc_error()
{
fprintf(stderr,"malloc is not feeling well. Good bye\n");
exit(1);
}
#endif /* MALLOC_DEBUGGING */
static void called_at_exit(void)
{
extern void sync_profiles(void);
sync_profiles();
MAIN_RestoreSetup();
WSACleanup();
SHELL_SaveRegistry();
}
/***********************************************************************
* main
*/
#if defined(WINELIB) && defined(WINELIBDLL)
int _wine_main (int argc, char *argv[])
#else
int main( int argc, char *argv[] )
#endif
{
int ret_val;
int depth_count, i;
......@@ -555,6 +546,21 @@ int main( int argc, char *argv[] )
extern int _WinMain(int argc, char **argv);
#ifdef MALLOC_DEBUGGING
char *trace;
mcheck(NULL);
if (!(trace = getenv("MALLOC_TRACE")))
{
fprintf( stderr, "MALLOC_TRACE not set. No trace generated\n" );
}
else
{
fprintf( stderr, "malloc trace goes to %s\n", trace );
mtrace();
}
#endif
setbuf(stdout,NULL);
setbuf(stderr,NULL);
......@@ -566,22 +572,6 @@ int main( int argc, char *argv[] )
MAIN_ParseOptions( &argc, argv );
#ifdef MALLOC_DEBUGGING
if(debugging_malloc)
{
char *trace=getenv("MALLOC_TRACE");
if(!trace)
{
dprintf_malloc(stddeb,"MALLOC_TRACE not set. No trace generated\n");
}else
{
dprintf_malloc(stddeb,"malloc trace goes to %s\n",trace);
mtrace();
}
mcheck(malloc_error);
}
#endif
SHELL_Init();
SHELL_LoadRegistry();
......@@ -816,7 +806,7 @@ LONG GetTimerResolution(void)
/***********************************************************************
* SystemParametersInfo (USER.483)
*/
BOOL SystemParametersInfo (UINT uAction, UINT uParam, void FAR *lpvParam, UINT fuWinIni)
BOOL SystemParametersInfo (UINT uAction, UINT uParam, LPVOID lpvParam, UINT fuWinIni)
{
int timeout, temp;
char buffer[256];
......@@ -957,7 +947,7 @@ BOOL SystemParametersInfo (UINT uAction, UINT uParam, void FAR *lpvParam, UINT f
/***********************************************************************
* HMEMCPY (KERNEL.348)
*/
void hmemcpy(void FAR *hpvDest, const void FAR *hpvSource, long cbCopy)
void hmemcpy(LPVOID hpvDest, LPCVOID hpvSource, LONG cbCopy)
{
memcpy(hpvDest, hpvSource, cbCopy);
}
......
#include <unistd.h>
#include <sys/types.h>
#include <sys/time.h>
#ifndef HAVE_USLEEP
......
......@@ -33,9 +33,10 @@ void SetRectEmpty( LPRECT rect )
/***********************************************************************
* CopyRect (USER.74)
*/
void CopyRect( LPRECT dest, LPRECT src )
BOOL CopyRect( LPRECT dest, LPRECT src )
{
*dest = *src;
return TRUE;
}
......
......@@ -215,7 +215,7 @@ SHELL_LoadRegistry(void)
/*************************************************************************
* RegOpenKey [SHELL.1]
*/
LONG RegOpenKey(HKEY hKey, LPCSTR lpSubKey, HKEY FAR *lphKey)
LONG RegOpenKey(HKEY hKey, LPCSTR lpSubKey, LPHKEY lphKey)
{
LPKEYSTRUCT lpKey,lpNextKey;
LPCSTR ptr;
......@@ -264,7 +264,7 @@ LONG RegOpenKey(HKEY hKey, LPCSTR lpSubKey, HKEY FAR *lphKey)
/*************************************************************************
* RegCreateKey [SHELL.2]
*/
LONG RegCreateKey(HKEY hKey, LPCSTR lpSubKey, HKEY FAR *lphKey)
LONG RegCreateKey(HKEY hKey, LPCSTR lpSubKey, LPHKEY lphKey)
{
HKEY hNewKey;
LPKEYSTRUCT lpNewKey;
......@@ -391,7 +391,7 @@ LONG RegSetValue(HKEY hKey, LPCSTR lpSubKey, DWORD dwType,
/*************************************************************************
* RegQueryValue [SHELL.6]
*/
LONG RegQueryValue(HKEY hKey, LPCSTR lpSubKey, LPSTR lpVal, LONG FAR *lpcb)
LONG RegQueryValue(HKEY hKey, LPCSTR lpSubKey, LPSTR lpVal, LPLONG lpcb)
{
HKEY hRetKey;
LPKEYSTRUCT lpKey;
......@@ -552,7 +552,7 @@ BOOL DragQueryPoint(HDROP hDrop, POINT FAR *p)
/*************************************************************************
* ShellExecute [SHELL.20]
*/
HINSTANCE ShellExecute(HWND hWnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, int iShowCmd)
HINSTANCE ShellExecute(HWND hWnd, LPCSTR lpOperation, LPCSTR lpFile, LPSTR lpParameters, LPCSTR lpDirectory, INT iShowCmd)
{
char cmd[400];
char *p,*x;
......
......@@ -77,7 +77,7 @@ int SyncAllVoices(void)
return 0;
}
int CountVoiceNotes(int x)
INT CountVoiceNotes(INT x)
{
fprintf(stderr, "CountVoiceNotes(%d)\n", x);
return 0;
......
......@@ -10,7 +10,6 @@
#include <X11/Xresource.h>
#include <string.h>
#include "windows.h"
#include "wine.h"
#include "options.h"
#include "stddebug.h"
#include "debug.h"
......@@ -529,7 +528,8 @@ void SpyInit(void)
for(i=0; i <= SPY_MAX_MSGNUM; i++) SpyFilters[i] = SpyIncludes[i] = FALSE;
GetPrivateProfileString("spy", "Exclude", "",lpstrBuffer ,511 , WINE_INI);
PROFILE_GetWineIniString( "spy", "Exclude", "",
lpstrBuffer, sizeof(lpstrBuffer) );
dprintf_message(stddeb,"SpyInit: Exclude=%s\n",lpstrBuffer);
if( *lpstrBuffer != 0 )
if(strstr(lpstrBuffer,"EXCLUDEALL"))
......@@ -539,7 +539,8 @@ void SpyInit(void)
if(MessageTypeNames[i])
if(strstr(lpstrBuffer,MessageTypeNames[i])) SpyFilters[i] = TRUE;
GetPrivateProfileString("spy", "Include", "INCLUDEALL",lpstrBuffer ,511 , WINE_INI);
PROFILE_GetWineIniString( "spy", "Include", "INCLUDEALL",
lpstrBuffer, sizeof(lpstrBuffer) );
dprintf_message(stddeb,"SpyInit: Include=%s\n",lpstrBuffer);
if( *lpstrBuffer != 0 )
if(strstr(lpstrBuffer,"INCLUDEALL"))
......
/*
* Misc Toolhelp functions
*
* Copyright 1996 Marcus Meissner
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include "windows.h"
#include "win.h"
#include "toolhelp.h"
#include "stddebug.h"
#include "debug.h"
#include "xmalloc.h"
/* FIXME: to make this working, we have to callback all these registered
* functions from all over the WINE code. Someone with more knowledge than
* me please do that. -Marcus
*/
static struct notify
{
HTASK htask;
FARPROC lpfnCallback;
WORD wFlags;
} *notifys = NULL;
static int nrofnotifys = 0;
BOOL
NotifyRegister(HTASK htask,FARPROC lpfnCallback,WORD wFlags)
{
int i;
dprintf_toolhelp( stddeb, "NotifyRegister(%x,%lx,%x) called.\n",
htask, (DWORD)lpfnCallback, wFlags );
for (i=0;i<nrofnotifys;i++)
if (notifys[i].htask==htask)
break;
if (i==nrofnotifys) {
if (notifys==NULL)
notifys=(struct notify*)xmalloc(sizeof(struct notify));
else
notifys=(struct notify*)xrealloc(notifys,sizeof(struct notify)*(nrofnotifys+1));
nrofnotifys++;
}
notifys[i].htask=htask;
notifys[i].lpfnCallback=lpfnCallback;
notifys[i].wFlags=wFlags;
return TRUE;
}
BOOL
NotifyUnregister(HTASK htask)
{
int i;
dprintf_toolhelp( stddeb, "NotifyUnregister(%x) called.\n", htask );
for (i=nrofnotifys;i--;)
if (notifys[i].htask==htask)
break;
if (i==-1)
return FALSE;
memcpy(notifys+i,notifys+(i+1),sizeof(struct notify)*(nrofnotifys-i-1));
notifys=(struct notify*)realloc(notifys,(nrofnotifys-1)*sizeof(struct notify));
nrofnotifys--;
return TRUE;
}
......@@ -4,20 +4,10 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
*/
#include <stdio.h>
#include <stdlib.h>
#include "atom.h"
#include "comm.h"
#include "gdi.h"
#include "desktop.h"
#include "dlls.h"
#include "dos_fs.h"
#include "sysmetrics.h"
#include "menu.h"
#include "dce.h"
#include "dialog.h"
#include "syscolor.h"
#include "win.h"
#include "windows.h"
#include "gdi.h"
#include "user.h"
#include "win.h"
#include "message.h"
#include "toolhelp.h"
......
......@@ -652,7 +652,16 @@ SOCKET WINSOCK_socket(INT af, INT type, INT protocol)
dprintf_winsock(stddeb, "WSA_socket: af=%d type=%d protocol=%d\n", af, type, protocol);
if ((sock = socket(af, type, protocol)) < 0) {
if (errno != EPERM) {
errno_to_wsaerrno();
} else {
/* NOTE: EPERM does not always map to WSAESOCKTNOSUPPORT
* so this is done as a special case
*/
/* non super-user wants a raw socket */
dprintf_winsock(stderr, "WSA_socket: not enough privileges\n");
WSASetLastError(WSAESOCKTNOSUPPORT);
}
dprintf_winsock(stddeb, "WSA_socket: failed !\n");
return INVALID_SOCKET;
}
......@@ -1177,7 +1186,7 @@ INT WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData)
return WSASYSNOTREADY;
Heap = (struct WinSockHeap *) GlobalLock(HeapHandle);
bcopy(&WINSOCK_data, lpWSAData, sizeof(WINSOCK_data));
memcpy(lpWSAData, &WINSOCK_data, sizeof(WINSOCK_data));
/* ipc stuff */
......
......@@ -7,6 +7,7 @@
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "windows.h"
int runtime_cpu (void)
{
......
......@@ -10,6 +10,7 @@
#include <string.h>
#include "windows.h"
#include "ldt.h"
#include "module.h"
#include "registers.h"
#include "wine.h"
#include "miscemu.h"
......@@ -40,6 +41,8 @@ typedef struct
WORD ss;
} REALMODECALL;
extern void do_mscdex(struct sigcontext_struct *context);
/**********************************************************************
* INT_Int31Handler
*
......@@ -69,6 +72,34 @@ void INT_Int31Handler( struct sigcontext_struct context )
}
break;
case 0x0002: /* Real mode segment to descriptor */
{
WORD entryPoint = 0; /* KERNEL entry point for descriptor */
switch(BX_reg(&context))
{
case 0x0000: entryPoint = 183; break; /* __0000H */
case 0x0040: entryPoint = 193; break; /* __0040H */
case 0xa000: entryPoint = 174; break; /* __A000H */
case 0xb000: entryPoint = 181; break; /* __B000H */
case 0xb800: entryPoint = 182; break; /* __B800H */
case 0xc000: entryPoint = 195; break; /* __C000H */
case 0xd000: entryPoint = 179; break; /* __D000H */
case 0xe000: entryPoint = 190; break; /* __E000H */
case 0xf000: entryPoint = 194; break; /* __F000H */
default:
fprintf( stderr, "DPMI: real-mode seg to descriptor %04x not possible\n",
BX_reg(&context) );
AX_reg(&context) = 0x8011;
SET_CFLAG(&context);
break;
}
if (entryPoint)
AX_reg(&context) = LOWORD(MODULE_GetEntryPoint(
GetModuleHandle( "KERNEL" ),
entryPoint ));
}
break;
case 0x0003: /* Get next selector increment */
AX_reg(&context) = __AHINCR;
break;
......@@ -162,7 +193,25 @@ void INT_Int31Handler( struct sigcontext_struct context )
" ESI=%08lx EDI=%08lx ES=%04x DS=%04x\n",
BL_reg(&context), p->eax, p->ebx, p->ecx, p->edx,
p->esi, p->edi, p->es, p->ds );
SET_CFLAG(&context);
/* Compton's 1995 encyclopedia does its MSCDEX calls through
* this interrupt. Why? Who knows...
*/
if ((BL_reg(&context) == 0x2f) && ((p->eax & 0xFF00) == 0x1500))
{
struct sigcontext_struct context2;
EAX_reg(&context2) = p->eax;
EBX_reg(&context2) = p->ebx;
ECX_reg(&context2) = p->ecx;
EDX_reg(&context2) = p->edx;
ES_reg(&context2) = p->es;
do_mscdex(&context2);
p->eax = EAX_reg(&context2);
p->ebx = EBX_reg(&context2);
p->ecx = ECX_reg(&context2);
p->edx = EDX_reg(&context2);
}
else SET_CFLAG(&context);
}
break;
......
......@@ -83,12 +83,6 @@ WORD sharing_pause = 1; /* pause between retries */
extern char TempDirectory[];
static int Error(int e, int class, int el)
{
return DOS_ERROR( e, class, SA_Abort, el );
}
BYTE *GetCurrentDTA(void)
{
TDB *pTask = (TDB *)GlobalLock( GetCurrentTask() );
......@@ -140,61 +134,30 @@ static void CreateBPB(int drive, BYTE *data)
}
}
static void GetFreeDiskSpace(struct sigcontext_struct *context)
static int INT21_GetFreeDiskSpace(struct sigcontext_struct *context)
{
long size,available;
DWORD size, available;
int drive = DOS_GET_DRIVE( DL_reg(context) );
if (!DRIVE_IsValid(drive))
{
DOS_ERROR( ER_InvalidDrive, EC_MediaError, SA_Abort, EL_Disk );
AX_reg(context) = 0xffff;
return;
}
if (!DOS_GetFreeSpace(drive, &size, &available)) {
DOS_ERROR( ER_GeneralFailure, EC_MediaError, SA_Abort, EL_Disk );
AX_reg(context) = 0xffff;
return;
}
if (!DRIVE_GetFreeSpace(drive, &size, &available)) return 0;
AX_reg(context) = (drive < 2) ? 1 : 64; /* 64 for hard-disks, 1 for diskettes */
CX_reg(context) = 512;
BX_reg(context) = (available / (CX_reg(context) * AX_reg(context)));
DX_reg(context) = (size / (CX_reg(context) * AX_reg(context)));
Error (0,0,0);
CX_reg(context) = 512; /* bytes per sector */
size /= 512;
available /= 512;
AX_reg(context) = 1; /* sectors per cluster */
while (AX_reg(context) * 65530 < size) AX_reg(context) *= 2;
BX_reg(context) = available / AX_reg(context); /* free clusters */
DX_reg(context) = size / AX_reg(context); /* total clusters */
return 1;
}
static void GetDriveAllocInfo(struct sigcontext_struct *context)
static int INT21_GetDriveAllocInfo(struct sigcontext_struct *context)
{
long size, available;
int drive = DOS_GET_DRIVE( DL_reg(context) );
if (!DRIVE_IsValid(drive))
{
AX_reg(context) = 4;
CX_reg(context) = 512;
DX_reg(context) = 0;
DOS_ERROR( ER_InvalidDrive, EC_MediaError, SA_Abort, EL_Disk );
return;
}
if (!DOS_GetFreeSpace(drive, &size, &available))
{
DOS_ERROR( ER_GeneralFailure, EC_MediaError, SA_Abort, EL_Disk );
AX_reg(context) = 0xffff;
return;
}
AX_reg(context) = (drive < 2) ? 1 : 64; /* 64 for hard-disks, 1 for diskettes */
CX_reg(context) = 512;
DX_reg(context) = (size / (CX_reg(context) * AX_reg(context)));
heap->mediaID = 0xf0;
DS_reg(context) = DosHeapHandle;
BX_reg(context) = (int)&heap->mediaID - (int)heap;
Error (0,0,0);
if (!INT21_GetFreeDiskSpace( context )) return 0;
heap->mediaID = 0xf0;
DS_reg(context) = DosHeapHandle;
BX_reg(context) = (int)&heap->mediaID - (int)heap;
return 1;
}
static void GetDrivePB(struct sigcontext_struct *context, int drive)
......@@ -242,40 +205,15 @@ static void GetDrivePB(struct sigcontext_struct *context, int drive)
static void ioctlGetDeviceInfo(struct sigcontext_struct *context)
{
dprintf_int (stddeb, "int21: ioctl (%d, GetDeviceInfo)\n", BX_reg(context));
switch (BX_reg(context))
{
case 0:
case 1:
DX_reg(context) = 2; /* FIXME */
break;
case 2:
DX_reg(context) = 0x80d0 | (1 << (BX_reg(context) != 0));
RESET_CFLAG(context);
break;
default:
{
struct stat sbuf;
if (fstat(BX_reg(context), &sbuf) < 0)
{
INT_BARF( context, 0x21 );
SET_CFLAG(context);
return;
}
DX_reg(context) = 0x0943;
/* bits 0-5 are current drive
* bit 6 - file has NOT been written..FIXME: correct?
* bit 8 - generate int24 if no diskspace on write/ read past end of file
* bit 11 - media not removable
*/
}
}
RESET_CFLAG(context);
dprintf_int (stddeb, "int21: ioctl (%d, GetDeviceInfo)\n", BX_reg(context));
DX_reg(context) = 0x0942;
/* bits 0-5 are current drive
* bit 6 - file has NOT been written..FIXME: correct?
* bit 8 - generate int24 if no diskspace on write/ read past end of file
* bit 11 - media not removable
*/
RESET_CFLAG(context);
}
static void ioctlGenericBlkDevReq(struct sigcontext_struct *context)
......@@ -454,6 +392,7 @@ static void CloseFile(struct sigcontext_struct *context)
void ExtendedOpenCreateFile(struct sigcontext_struct *context)
{
BYTE action=DL_reg(context);
dprintf_int(stddeb, "int21: extended open/create: file= %s \n",
DOSFS_GetUnixFileName(PTR_SEG_OFF_TO_LIN(DS_reg(context),SI_reg(context)),FALSE));
/* Shuffle arguments to call OpenExistingFile */
......@@ -466,7 +405,7 @@ void ExtendedOpenCreateFile(struct sigcontext_struct *context)
dprintf_int(stddeb, "int21: extended open/create %s exists \n",
DOSFS_GetUnixFileName(PTR_SEG_OFF_TO_LIN(DS_reg(context),SI_reg(context)),TRUE));
/* Now decide what do do */
if ((DL_reg(context) & 0x0007)== 0)
if ((action & 0x07)== 0)
{
BX_reg(context) = AX_reg(context);
CloseFile(context);
......@@ -476,7 +415,7 @@ void ExtendedOpenCreateFile(struct sigcontext_struct *context)
dprintf_int(stddeb, "int21: extended open/create: failed because file exixts \n");
return;
}
if ((DL_reg(context) & 0x0007)== 2) {
if ((action & 0x07)== 2) {
/* Truncate it, but first check if opend for write */
if ((BL_reg(context) & 0x0007)== 0) {
BX_reg(context) = AX_reg(context);
......@@ -516,9 +455,10 @@ void ExtendedOpenCreateFile(struct sigcontext_struct *context)
}
else /* file does not exist */
{
RESET_CFLAG(context); /* was set by OpenExistingFile(context) */
dprintf_int(stddeb, "int21: extended open/create %s dosen't exists \n",
DOSFS_GetUnixFileName(PTR_SEG_OFF_TO_LIN(DS_reg(context),SI_reg(context)),FALSE));
if ((DL_reg(context) & 0x00F0)== 0) {
if ((action & 0xF0)== 0) {
CX_reg(context) = 0;
SET_CFLAG(context);
dprintf_int(stddeb, "int21: extended open/create: failed, file dosen't exist\n");
......@@ -1102,11 +1042,11 @@ void DOS3Call( struct sigcontext_struct context )
case 0x1b: /* GET ALLOCATION INFORMATION FOR DEFAULT DRIVE */
DL_reg(&context) = 0;
GetDriveAllocInfo(&context);
if (!INT21_GetDriveAllocInfo(&context)) AX_reg(&context) = 0xffff;
break;
case 0x1c: /* GET ALLOCATION INFORMATION FOR SPECIFIC DRIVE */
GetDriveAllocInfo(&context);
if (!INT21_GetDriveAllocInfo(&context)) AX_reg(&context) = 0xffff;
break;
case 0x1f: /* GET DRIVE PARAMETER BLOCK FOR DEFAULT DRIVE */
......@@ -1205,7 +1145,7 @@ void DOS3Call( struct sigcontext_struct context )
break;
case 0x36: /* GET FREE DISK SPACE */
GetFreeDiskSpace(&context);
if (!INT21_GetFreeDiskSpace(&context)) AX_reg(&context) = 0xffff;
break;
case 0x38: /* GET COUNTRY-SPECIFIC INFORMATION */
......@@ -1258,22 +1198,32 @@ void DOS3Call( struct sigcontext_struct context )
break;
case 0x3f: /* "READ" - READ FROM FILE OR DEVICE */
if ((AX_reg(&context) = _lread( BX_reg(&context),
PTR_SEG_OFF_TO_LIN( DS_reg(&context),DX_reg(&context) ),
CX_reg(&context))) == (WORD)HFILE_ERROR)
{
AX_reg(&context) = DOS_ExtendedError;
SET_CFLAG(&context);
LONG result = _hread( BX_reg(&context),
PTR_SEG_OFF_TO_LIN( DS_reg(&context),
DX_reg(&context) ),
CX_reg(&context) );
if (result == -1)
{
AX_reg(&context) = DOS_ExtendedError;
SET_CFLAG(&context);
}
else AX_reg(&context) = (WORD)result;
}
break;
case 0x40: /* "WRITE" - WRITE TO FILE OR DEVICE */
if ((AX_reg(&context) = _lwrite( BX_reg(&context),
PTR_SEG_OFF_TO_LIN( DS_reg(&context),DX_reg(&context) ),
CX_reg(&context))) == (WORD)HFILE_ERROR)
{
AX_reg(&context) = DOS_ExtendedError;
SET_CFLAG(&context);
LONG result = _hwrite( BX_reg(&context),
PTR_SEG_OFF_TO_LIN( DS_reg(&context),
DX_reg(&context) ),
CX_reg(&context) );
if (result == -1)
{
AX_reg(&context) = DOS_ExtendedError;
SET_CFLAG(&context);
}
else AX_reg(&context) = (WORD)result;
}
break;
......@@ -1680,12 +1630,12 @@ void DOS3Call( struct sigcontext_struct context )
}
void INT21_Init(void)
BOOL INT21_Init(void)
{
if ((DosHeapHandle = GlobalAlloc(GMEM_FIXED,sizeof(struct DosHeap))) == 0)
{
fprintf( stderr, "INT21_Init: Out of memory\n");
exit(1);
return FALSE;
}
heap = (struct DosHeap *) GlobalLock(DosHeapHandle);
......@@ -1693,4 +1643,5 @@ void INT21_Init(void)
dpbsegptr = MAKELONG( (int)&heap->dpb - (int)heap, DosHeapHandle );
heap->InDosFlag = 0;
strcpy(heap->biosdate, "01/01/80");
return TRUE;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "registers.h"
#include "ldt.h"
#include "wine.h"
#include "drive.h"
#include "msdos.h"
#include "miscemu.h"
#include "module.h"
......@@ -15,6 +18,7 @@
#define VXD_BASE 400
static void do_int2f_16(struct sigcontext_struct *context);
void do_mscdex(struct sigcontext_struct *context);
/**********************************************************************
* INT_Int2fHandler
......@@ -30,7 +34,7 @@ void INT_Int2fHandler( struct sigcontext_struct context )
break;
case 0x15: /* mscdex */
/* ignore requests */
do_mscdex(&context);
break;
case 0x16:
......@@ -128,3 +132,50 @@ static void do_int2f_16(struct sigcontext_struct *context)
INT_BARF( context, 0x2f );
}
}
void do_mscdex(struct sigcontext_struct *context)
{
int drive, count;
char *p;
switch(AL_reg(context))
{
case 0x00: /* Installation check */
/* Count the number of contiguous CDROM drives
*/
for (drive = count = 0; drive < MAX_DOS_DRIVES; drive++)
{
if (DRIVE_GetType(drive) == TYPE_CDROM)
{
while (DRIVE_GetType(drive + count) == TYPE_CDROM) count++;
break;
}
}
BX_reg(context) = count;
CX_reg(context) = (drive < MAX_DOS_DRIVES) ? drive : 0;
break;
case 0x0B: /* drive check */
AX_reg(context) = (DRIVE_GetType(CX_reg(context)) == TYPE_CDROM);
BX_reg(context) = 0xADAD;
break;
case 0x0C: /* get version */
BX_reg(context) = 0x020a;
break;
case 0x0D: /* get drive letters */
p = PTR_SEG_OFF_TO_LIN(ES_reg(context), BX_reg(context));
memset( p, 0, MAX_DOS_DRIVES );
for (drive = 0; drive < MAX_DOS_DRIVES; drive++)
{
if (DRIVE_GetType(drive) == TYPE_CDROM) *p++ = drive;
}
break;
default:
fprintf(stderr, "Unimplemented MSCDEX function 0x%02.2X.\n", AL_reg(context));
break;
}
}
......@@ -321,7 +321,6 @@ static DWORD WAVE_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
dprintf_mciwave(stddeb,"WAVE_mciPlay // MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
mciDriverNotify((HWND)LOWORD(lpParms->dwCallback),
MCIWavDev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
exit(0);
}
return 0;
}
......
......@@ -485,7 +485,9 @@ static DWORD MIDI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
dprintf_midi(stddeb, "MIDI_mciPlay // MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
mciDriverNotify((HWND)LOWORD(lpParms->dwCallback),
MCIMidiDev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
#if 0
exit(1);
#endif
}
return 0;
#else
......
......@@ -75,8 +75,7 @@ static XImage *BITMAP_BmpToImage( BITMAP * bmp, void * bmpData )
/***********************************************************************
* CreateBitmap (GDI.48)
*/
HBITMAP CreateBitmap( short width, short height,
BYTE planes, BYTE bpp, LPSTR bits )
HBITMAP CreateBitmap( INT width, INT height, UINT planes, UINT bpp, LPVOID bits )
{
BITMAPOBJ * bmpObjPtr;
HBITMAP hbitmap;
......@@ -121,7 +120,7 @@ HBITMAP CreateBitmap( short width, short height,
/***********************************************************************
* CreateCompatibleBitmap (GDI.51)
*/
HBITMAP CreateCompatibleBitmap( HDC hdc, short width, short height )
HBITMAP CreateCompatibleBitmap( HDC hdc, INT width, INT height )
{
DC * dc;
dprintf_gdi(stddeb, "CreateCompatibleBitmap: "NPFMT" %dx%d\n",
......@@ -134,7 +133,7 @@ HBITMAP CreateCompatibleBitmap( HDC hdc, short width, short height )
/***********************************************************************
* CreateBitmapIndirect (GDI.49)
*/
HBITMAP CreateBitmapIndirect( BITMAP * bmp )
HBITMAP CreateBitmapIndirect( const BITMAP * bmp )
{
return CreateBitmap( bmp->bmWidth, bmp->bmHeight, bmp->bmPlanes,
bmp->bmBitsPixel, PTR_SEG_TO_LIN( bmp->bmBits ) );
......@@ -310,7 +309,7 @@ HBITMAP BITMAP_SelectObject( HDC hdc, DC * dc, HBITMAP hbitmap,
/***********************************************************************
* CreateDiscardableBitmap (GDI.156)
*/
HBITMAP CreateDiscardableBitmap(HDC hdc, short width, short height)
HBITMAP CreateDiscardableBitmap(HDC hdc, INT width, INT height)
{
dprintf_bitmap(stddeb,"CreateDiscardableBitmap("NPFMT", %d, %d); "
"// call CreateCompatibleBitmap() for now!\n",
......
......@@ -141,7 +141,7 @@ Pixmap BRUSH_DitherColor( DC *dc, COLORREF color )
/***********************************************************************
* CreateBrushIndirect (GDI.50)
*/
HBRUSH CreateBrushIndirect( LOGBRUSH * brush )
HBRUSH CreateBrushIndirect( const LOGBRUSH * brush )
{
BRUSHOBJ * brushPtr;
HBRUSH hbrush = GDI_AllocObject( sizeof(BRUSHOBJ), BRUSH_MAGIC );
......@@ -155,7 +155,7 @@ HBRUSH CreateBrushIndirect( LOGBRUSH * brush )
/***********************************************************************
* CreateHatchBrush (GDI.58)
*/
HBRUSH CreateHatchBrush( short style, COLORREF color )
HBRUSH CreateHatchBrush( INT style, COLORREF color )
{
LOGBRUSH logbrush = { BS_HATCHED, color, style };
dprintf_gdi(stddeb, "CreateHatchBrush: %d %06lx\n", style, color );
......@@ -194,7 +194,7 @@ HBRUSH CreatePatternBrush( HBITMAP hbitmap )
/***********************************************************************
* CreateDIBPatternBrush (GDI.445)
*/
HBRUSH CreateDIBPatternBrush( HANDLE hbitmap, WORD coloruse )
HBRUSH CreateDIBPatternBrush( HGLOBAL hbitmap, UINT coloruse )
{
LOGBRUSH logbrush = { BS_DIBPATTERN, coloruse, 0 };
BITMAPINFO *info, *newInfo;
......
......@@ -227,47 +227,22 @@ static BOOL CURSORICON_LoadDirEntry(HANDLE hInstance, SEGPTR name,
/**********************************************************************
* CURSORICON_Load
* CURSORICON_LoadHandler
*
* Load a cursor or icon.
* Create a cursor or icon from a resource.
*/
static HANDLE CURSORICON_Load( HANDLE hInstance, SEGPTR name, int width,
int height, int colors, BOOL fCursor )
static HANDLE CURSORICON_LoadHandler( HANDLE handle, HINSTANCE hInstance,
BOOL fCursor )
{
HANDLE handle, hAndBits, hXorBits;
HRSRC hRsrc;
HANDLE hAndBits, hXorBits;
HDC hdc;
int size, sizeAnd, sizeXor;
POINT hotspot = { 0 ,0 };
BITMAPOBJ *bmpXor, *bmpAnd;
BITMAPINFO *bmi, *pInfo;
CURSORICONINFO *info;
CURSORICONDIRENTRY dirEntry;
char *bits;
if (!hInstance) /* OEM cursor/icon */
{
if (HIWORD(name)) /* Check for '#xxx' name */
{
char *ptr = PTR_SEG_TO_LIN( name );
if (ptr[0] != '#') return 0;
if (!(name = (SEGPTR)atoi( ptr + 1 ))) return 0;
}
return OBM_LoadCursorIcon( LOWORD(name), fCursor );
}
/* Find the best entry in the directory */
if (!CURSORICON_LoadDirEntry( hInstance, name, width, height,
colors, fCursor, &dirEntry )) return 0;
/* Load the resource */
if (!(hRsrc = FindResource( hInstance,
MAKEINTRESOURCE( dirEntry.icon.wResId ),
fCursor ? RT_CURSOR : RT_ICON ))) return 0;
if (!(handle = LoadResource( hInstance, hRsrc ))) return 0;
if (fCursor) /* If cursor, get the hotspot */
{
POINT *pt = (POINT *)LockResource( handle );
......@@ -289,7 +264,6 @@ static HANDLE CURSORICON_Load( HANDLE hInstance, SEGPTR name, int width,
if (pInfo->bmiHeader.biCompression != BI_RGB)
{
fprintf(stderr,"Unknown size for compressed icon bitmap.\n");
FreeResource( handle );
free( pInfo );
return 0;
}
......@@ -304,7 +278,6 @@ static HANDLE CURSORICON_Load( HANDLE hInstance, SEGPTR name, int width,
{
fprintf( stderr, "CURSORICON_Load: Unknown bitmap length %ld!\n",
pInfo->bmiHeader.biSize );
FreeResource( handle );
free( pInfo );
return 0;
}
......@@ -313,7 +286,6 @@ static HANDLE CURSORICON_Load( HANDLE hInstance, SEGPTR name, int width,
if (!(hdc = GetDC( 0 )))
{
FreeResource( handle );
free( pInfo );
return 0;
}
......@@ -351,7 +323,6 @@ static HANDLE CURSORICON_Load( HANDLE hInstance, SEGPTR name, int width,
hAndBits = CreateDIBitmap( hdc, &pInfo->bmiHeader, CBM_INIT,
bits, pInfo, DIB_RGB_COLORS );
ReleaseDC( 0, hdc );
FreeResource( handle );
/* Now create the CURSORICONINFO structure */
......@@ -367,8 +338,10 @@ static HANDLE CURSORICON_Load( HANDLE hInstance, SEGPTR name, int width,
DeleteObject( hAndBits );
return 0;
}
/* Make it owned by the module */
FarSetOwner( handle, (WORD)(DWORD)GetExePtr( hInstance ) );
if (hInstance) FarSetOwner( handle, (WORD)(DWORD)GetExePtr(hInstance) );
info = (CURSORICONINFO *)GlobalLock( handle );
info->ptHotSpot.x = hotspot.x;
info->ptHotSpot.y = hotspot.y;
......@@ -388,6 +361,46 @@ static HANDLE CURSORICON_Load( HANDLE hInstance, SEGPTR name, int width,
return handle;
}
/**********************************************************************
* CURSORICON_Load
*
* Load a cursor or icon.
*/
static HANDLE CURSORICON_Load( HANDLE hInstance, SEGPTR name, int width,
int height, int colors, BOOL fCursor )
{
HANDLE handle,hRet;
HRSRC hRsrc;
CURSORICONDIRENTRY dirEntry;
if (!hInstance) /* OEM cursor/icon */
{
if (HIWORD(name)) /* Check for '#xxx' name */
{
char *ptr = PTR_SEG_TO_LIN( name );
if (ptr[0] != '#') return 0;
if (!(name = (SEGPTR)atoi( ptr + 1 ))) return 0;
}
return OBM_LoadCursorIcon( LOWORD(name), fCursor );
}
/* Find the best entry in the directory */
if (!CURSORICON_LoadDirEntry( hInstance, name, width, height,
colors, fCursor, &dirEntry )) return 0;
/* Load the resource */
if (!(hRsrc = FindResource( hInstance,
MAKEINTRESOURCE( dirEntry.icon.wResId ),
fCursor ? RT_CURSOR : RT_ICON ))) return 0;
if (!(handle = LoadResource( hInstance, hRsrc ))) return 0;
hRet = CURSORICON_LoadHandler( handle, hInstance, fCursor );
FreeResource(handle);
return hRet;
}
/***********************************************************************
* CURSORICON_Copy
......@@ -485,8 +498,8 @@ HICON LoadIcon( HANDLE hInstance, SEGPTR name )
/***********************************************************************
* CreateCursor (USER.406)
*/
HICON CreateCursor( HANDLE hInstance, INT xHotSpot, INT yHotSpot,
INT nWidth, INT nHeight, LPSTR lpANDbits, LPSTR lpXORbits)
HCURSOR CreateCursor( HINSTANCE hInstance, INT xHotSpot, INT yHotSpot,
INT nWidth, INT nHeight, LPVOID lpANDbits, LPVOID lpXORbits)
{
CURSORICONINFO info = { { xHotSpot, yHotSpot }, nWidth, nHeight, 0, 1, 1 };
......@@ -540,21 +553,37 @@ HANDLE CreateCursorIconIndirect( HANDLE hInstance, CURSORICONINFO *info,
/***********************************************************************
* CopyIcon (USER.368)
*/
#ifdef WINELIB32
HICON CopyIcon( HICON hIcon )
{
dprintf_icon( stddeb, "CopyIcon: "NPFMT"\n", hIcon );
return CURSORICON_Copy( 0, hIcon );
}
#else
HICON CopyIcon( HANDLE hInstance, HICON hIcon )
{
dprintf_icon( stddeb, "CopyIcon: "NPFMT" "NPFMT"\n", hInstance, hIcon );
return CURSORICON_Copy( hInstance, hIcon );
}
#endif
/***********************************************************************
* CopyCursor (USER.369)
*/
#ifdef WINELIB32
HCURSOR CopyCursor( HCURSOR hCursor )
{
dprintf_cursor( stddeb, "CopyCursor: "NPFMT"\n", hCursor );
return CURSORICON_Copy( 0, hCursor );
}
#else
HCURSOR CopyCursor( HANDLE hInstance, HCURSOR hCursor )
{
dprintf_cursor( stddeb, "CopyCursor: "NPFMT" "NPFMT"\n", hInstance, hCursor );
return CURSORICON_Copy( hInstance, hCursor );
}
#endif
/***********************************************************************
......@@ -836,10 +865,11 @@ HCURSOR GetCursor(void)
/***********************************************************************
* ClipCursor (USER.16)
*/
void ClipCursor( RECT *rect )
BOOL ClipCursor( RECT *rect )
{
if (!rect) SetRectEmpty( &CURSOR_ClipRect );
else CopyRect( &CURSOR_ClipRect, rect );
return TRUE;
}
......@@ -880,8 +910,35 @@ void GetClipCursor( RECT *rect )
*/
WORD GetIconID( HANDLE hResource, DWORD resType )
{
fprintf( stderr, "GetIconId("NPFMT",%ld): empty stub!\n",
hResource, resType );
CURSORICONDIR *lpDir = LockResource(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="NPFMT", entries=%i\n",
hResource, lpDir->idCount );
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, 1 << screenDepth ) );
return entry ? entry->wResId : 0;
}
}
fprintf( stderr, "GetIconID: invalid res type %ld\n", resType );
return 0;
}
......@@ -891,7 +948,12 @@ WORD GetIconID( HANDLE hResource, DWORD resType )
*/
HICON LoadIconHandler( HANDLE hResource, BOOL bNew )
{
fprintf( stderr, "LoadIconHandle("NPFMT",%d): empty stub!\n",
hResource, bNew );
return 0;
dprintf_cursor(stddeb,"LoadIconHandler: hRes="NPFMT"\n",hResource);
if( !bNew )
{
fprintf(stdnimp,"LoadIconHandler: 2.xx resources are not supported\n");
return 0;
}
return CURSORICON_LoadHandler( hResource, 0, FALSE);
}
......@@ -450,7 +450,7 @@ BOOL RestoreDC( HDC hdc, short level )
/***********************************************************************
* CreateDC (GDI.53)
*/
HDC CreateDC( LPSTR driver, LPSTR device, LPSTR output, LPSTR initData )
HDC CreateDC( LPCSTR driver, LPCSTR device, LPCSTR output, LPCSTR initData )
{
DC * dc;
HANDLE handle;
......
......@@ -774,7 +774,7 @@ int GetDIBits( HDC hdc, HBITMAP hbitmap, WORD startscan, WORD lines,
* CreateDIBitmap (GDI.442)
*/
HBITMAP CreateDIBitmap( HDC hdc, BITMAPINFOHEADER * header, DWORD init,
LPSTR bits, BITMAPINFO * data, WORD coloruse )
LPVOID bits, BITMAPINFO * data, UINT coloruse )
{
HBITMAP handle;
BOOL fColor;
......
......@@ -3,8 +3,7 @@
*
* Copyright 1993 Alexandre Julliard
*
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
*/
*/
#include <stdio.h>
#include <stdlib.h>
......@@ -12,8 +11,8 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <X11/Xatom.h>
#include "font.h"
#include "metafile.h"
#include "wine.h"
#include "callback.h"
#include "options.h"
#include "xmalloc.h"
#include "stddebug.h"
#include "debug.h"
......@@ -65,17 +64,20 @@ BOOL FONT_Init( void )
LPSTR ptr;
int i;
if( GetPrivateProfileString("fonts", NULL, "*", temp, sizeof(temp), WINE_INI) > 2 ) {
if (PROFILE_GetWineIniString( "fonts", NULL, "*", temp, sizeof(temp) ) > 2 )
{
for( ptr = temp, i = 1; strlen(ptr) != 0; ptr += strlen(ptr) + 1 )
if( strcmp( ptr, "default" ) )
FontNames[i++].window = xstrdup( ptr );
FontSize = i;
for( i = 1; i < FontSize; i++ ) {
GetPrivateProfileString("fonts", FontNames[i].window, "*", temp, sizeof(temp), WINE_INI);
FontNames[i].x11 = xstrdup( temp );
for( i = 1; i < FontSize; i++ )
{
PROFILE_GetWineIniString( "fonts", FontNames[i].window, "*",
temp, sizeof(temp) );
FontNames[i].x11 = xstrdup( temp );
}
GetPrivateProfileString("fonts", "default", "*", temp, sizeof(temp), WINE_INI);
PROFILE_GetWineIniString( "fonts", "default", "*", temp, sizeof(temp) );
FontNames[0].x11 = xstrdup( temp );
} else {
......@@ -291,7 +293,7 @@ BOOL CreateScalableFontResource( UINT fHidden,LPSTR lpszResourceFile,
/***********************************************************************
* CreateFontIndirect (GDI.57)
*/
HFONT CreateFontIndirect( LOGFONT * font )
HFONT CreateFontIndirect( const LOGFONT * font )
{
FONTOBJ * fontPtr;
HFONT hfont = GDI_AllocObject( sizeof(FONTOBJ), FONT_MAGIC );
......@@ -307,10 +309,10 @@ HFONT CreateFontIndirect( LOGFONT * font )
/***********************************************************************
* CreateFont (GDI.56)
*/
HFONT CreateFont( int height, int width, int esc, int orient, int weight,
HFONT CreateFont( INT height, INT width, INT esc, INT orient, INT weight,
BYTE italic, BYTE underline, BYTE strikeout, BYTE charset,
BYTE outpres, BYTE clippres, BYTE quality, BYTE pitch,
LPSTR name )
LPCSTR name )
{
LOGFONT logfont = { height, width, esc, orient, weight, italic, underline,
strikeout, charset, outpres, clippres, quality, pitch, };
......@@ -493,7 +495,7 @@ INT GetTextFace( HDC hdc, INT count, LPSTR name )
/***********************************************************************
* GetTextExtent (GDI.91)
*/
DWORD GetTextExtent( HDC hdc, LPSTR str, short count )
DWORD GetTextExtent( HDC hdc, LPCSTR str, short count )
{
SIZE size;
if (!GetTextExtentPoint( hdc, str, count, &size )) return 0;
......@@ -504,7 +506,7 @@ DWORD GetTextExtent( HDC hdc, LPSTR str, short count )
/***********************************************************************
* GetTextExtentPoint (GDI.471)
*/
BOOL GetTextExtentPoint( HDC hdc, LPSTR str, short count, LPSIZE size )
BOOL GetTextExtentPoint( HDC hdc, LPCSTR str, short count, LPSIZE size )
{
int dir, ascent, descent;
XCharStruct info;
......@@ -802,7 +804,7 @@ int EnumFonts(HDC hDC, LPSTR lpFaceName, FARPROC lpEnumFunc, LPSTR lpData)
/*************************************************************************
* EnumFontFamilies [GDI.330]
*/
int EnumFontFamilies(HDC hDC, LPSTR lpszFamily, FARPROC lpEnumFunc, LPSTR lpData)
int EnumFontFamilies(HDC hDC, LPSTR lpszFamily, FONTENUMPROC lpEnumFunc, LPARAM lpData)
{
HANDLE hLog;
HANDLE hMet;
......@@ -815,7 +817,7 @@ int EnumFontFamilies(HDC hDC, LPSTR lpszFamily, FARPROC lpEnumFunc, LPSTR lpData
int nRet = 0;
int i;
dprintf_font(stddeb,"EnumFontFamilies("NPFMT", %p, %08lx, %p)\n",
dprintf_font(stddeb,"EnumFontFamilies("NPFMT", %p, %08lx, %08lx)\n",
hDC, lpszFamily, (DWORD)lpEnumFunc, lpData);
if (lpEnumFunc == 0) return 0;
hLog = GDI_HEAP_ALLOC( sizeof(ENUMLOGFONT) );
......@@ -859,7 +861,7 @@ int EnumFontFamilies(HDC hDC, LPSTR lpszFamily, FARPROC lpEnumFunc, LPSTR lpData
nRet = CallEnumFontFamProc( lpEnumFunc,
GDI_HEAP_SEG_ADDR(hLog),
GDI_HEAP_SEG_ADDR(hMet),
0, (LONG)lpData );
0, lpData );
if (nRet == 0) {
dprintf_font(stddeb,"EnumFontFamilies // EnumEnd requested by application !\n");
break;
......@@ -874,7 +876,7 @@ int EnumFontFamilies(HDC hDC, LPSTR lpszFamily, FARPROC lpEnumFunc, LPSTR lpData
* GetRasterizerCaps [GDI.313]
*/
BOOL GetRasterizerCaps(LPRASTERIZER_STATUS lprs, WORD cbNumBytes)
BOOL GetRasterizerCaps(LPRASTERIZER_STATUS lprs, UINT cbNumBytes)
{
/* This is not much more than a dummy */
RASTERIZER_STATUS rs;
......@@ -887,9 +889,8 @@ BOOL GetRasterizerCaps(LPRASTERIZER_STATUS lprs, WORD cbNumBytes)
/*************************************************************************
* GetKerningPairs [GDI.332]
* FIXME: The last parameter is actually LPKERNINGPAIR
*/
int GetKerningPairs(WORD hDC,int cBufLen,LPVOID lpKerningPairs)
int GetKerningPairs(HDC hDC,int cBufLen,LPKERNINGPAIR lpKerningPairs)
{
/* Wine fonts are ugly and don't support kerning :) */
return 0;
......
......@@ -142,10 +142,11 @@ BOOL ResizePalette(HPALETTE hPal, UINT cEntries)
/***********************************************************************
* AnimatePalette (GDI.367)
*/
void AnimatePalette(HPALETTE hPal, UINT StartIndex, UINT NumEntries,
BOOL AnimatePalette(HPALETTE hPal, UINT StartIndex, UINT NumEntries,
LPPALETTEENTRY PaletteColors)
{
fprintf(stdnimp,"AnimatePalette: empty stub! \n");
return TRUE;
}
/***********************************************************************
......
......@@ -13,7 +13,7 @@
/***********************************************************************
* CreatePen (GDI.61)
*/
HPEN CreatePen( short style, short width, COLORREF color )
HPEN CreatePen( INT style, INT width, COLORREF color )
{
LOGPEN logpen = { style, { width, 0 }, color };
dprintf_gdi(stddeb, "CreatePen: %d %d %06lx\n", style, width, color );
......
......@@ -220,7 +220,7 @@ HRGN CreateRoundRectRgn( short left, short top, short right, short bottom,
/***********************************************************************
* CreateEllipticRgn (GDI.54)
*/
HRGN CreateEllipticRgn( short left, short top, short right, short bottom )
HRGN CreateEllipticRgn( INT left, INT top, INT right, INT bottom )
{
return CreateRoundRectRgn( left, top, right, bottom,
right-left, bottom-top );
......@@ -402,7 +402,7 @@ BOOL REGION_FrameRgn( HRGN hDest, HRGN hSrc, int x, int y )
/***********************************************************************
* CombineRgn (GDI.451)
*/
int CombineRgn( HRGN hDest, HRGN hSrc1, HRGN hSrc2, short mode )
INT CombineRgn( HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode )
{
RGNOBJ *destObj, *src1Obj, *src2Obj;
......
......@@ -3,8 +3,8 @@
*
* Copyright 1993, 1994 Alexandre Julliard
*
static char Copyright[] = "Copyright Alexandre Julliard, 1993, 1994";
*/
*/
#include <stdlib.h>
#include <X11/Xatom.h>
#include "windows.h"
......@@ -31,8 +31,8 @@ static int spacewidth;
static int prefix_offset;
static char *TEXT_NextLine(HDC hdc, char *str, int *count, char *dest,
int *len, int width, WORD format)
static const char *TEXT_NextLine( HDC hdc, const char *str, int *count,
char *dest, int *len, int width, WORD format)
{
/* Return next line of text from a string.
*
......@@ -184,10 +184,10 @@ static char *TEXT_NextLine(HDC hdc, char *str, int *count, char *dest,
/***********************************************************************
* DrawText (USER.85)
*/
int DrawText( HDC hdc, LPSTR str, int count, LPRECT rect, WORD flags )
int DrawText( HDC hdc, LPCSTR str, int count, LPRECT rect, WORD flags )
{
SIZE size;
char *strPtr;
const char *strPtr;
static char line[1024];
int len, lh;
int prefix_x = 0;
......
......@@ -4,6 +4,7 @@
*
*/
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
......@@ -53,6 +54,7 @@ int main(int argc,char *argv[])
{
extern int yydebug;
extern char* optarg;
char* tmpc;
int optc,lose,ret,binary;
lose=binary=0;
while((optc=getopt(argc,argv,"bcdp:vo:"))!=EOF)
......@@ -65,7 +67,12 @@ int main(int argc,char *argv[])
setbuf(stdout,0);
setbuf(stderr,0);
break;
case 'p':prefix=optarg;break;
case 'p':prefix=strdup(optarg);
if(!isalpha(*prefix))*prefix='_';
for(tmpc=prefix;*tmpc;tmpc++)
if( !isalnum(*tmpc) && *tmpc!='_')
*tmpc='_';
break;
case 'c':constant=1;break;
case 'v':verbose=1;
setbuf(stderr,0);
......@@ -105,7 +112,7 @@ int transform_binary_file()
if(i%16==0)fputc('\n',code);
fprintf(code,"%3d,",c);
}
fprintf(code,"\n0}\nint _Aplication_resources_size=%d;\n",i);
fprintf(code,"\n 0};\nint _Application_resources_size=%d;\n",i);
return 0;
}
......
#!/usr/bin/perl
open(APIW,"./apiw.index");
while(<APIW>)
{
($func,$link)=split /:/;
chop $link;
$link=~m/(\d*)/;
$apiw{$func}="http://www.willows.com/apiw/chapter$1/p$link.html";
}
close(APIW);
open(WINDOWS,"../include/windows.h");
while(<WINDOWS>) { add_func($_) if /AccessResource/../wvsprintf/; }
close(WINDOWS);
open(TOOLHELP,"../include/toolhelp.h");
while(<TOOLHELP>) { add_func($_) if /GlobalInfo/../MemoryWrite/; }
close(TOOLHELP);
open(COMMDLG,"../include/commdlg.h");
while(<COMMDLG>) { add_func($_) if /ChooseColor/../ReplaceText/; }
close(COMMDLG);
print "<html><body>\n";
print "<h2>Windows API Functions</h2>\n";
print "The following API functions were found by searching windows.h,\n";
print "toolhelp.h, and commdlg.h. Where possible, help links pointing\n";
print "to www.willows.com are included.<p>\n";
print "<table>\n";
print "<th>Help-link</th><th></th><th></th><th align=left>Function</th>\n";
foreach $func (sort(keys %funcs))
{
$funcs{$func}=~m/(.*) +(\w*)(\(.*)/;
print "<tr>\n<td>";
if($apiw{$2})
{
print "<center><a href=\"$apiw{$2}\">APIW</a></center>";
$impl{$2}=1;
$impl++;
}
$numfuncs++;
print "</td>\n";
print "<td></td>\n";
print "<td>$1</td>\n";
print "<td>$2$3</td>\n";
print "</tr>\n";
}
print "</table><p>\n";
print "(Approximately ",sprintf("%3.1f",$impl/(1.0*$numfuncs)*100.0),
"% of the functions above are in the APIW standard.)<p>\n";
print "<hr>\n";
print "<h2>Unimplemented APIW functions</h2><p>\n";
print "Here's a list of the API functions in the APIW standard which were <b>not</b> found\n";
print "in windows.h, commdlg.h, or toolhelp.h:<p>\n";
foreach $func (sort (keys %apiw))
{
if(!$impl{$func})
{
print "<a href=\"$apiw{$func}\">$func</a>\n";
$unimpl++;
}
$numapiw++;
}
print "<p>(This comprises approximately ",sprintf("%3.1f",$unimpl/(1.0*$numapiw)*100.0),
"% of the APIW.)\n";
print "</body></html>\n";
sub add_func
{
$line=shift;
chop $line;
$line=~s/\s+/ /g;
($func)=$line=~m/ (\w*)\(/;
if($func)
{
while($funcs{$func}) { $func.=" "; }
$funcs{$func}=$line;
}
}
......@@ -13,10 +13,13 @@ C_SRCS = \
memory.c \
newfns.c \
object_mgt.c \
param32.c \
process.c \
resource.c \
string32.c \
thread.c \
time.c \
user32.c \
winprocs.c
all: $(MODULE).o
......
......@@ -8,6 +8,7 @@
at a later date. */
#include <stdio.h>
#include "module.h"
#include "windows.h"
#include "winerror.h"
#include "kernel32.h"
......@@ -31,6 +32,7 @@ WINAPI VOID RaiseException(DWORD dwExceptionCode,
* GetProcAddress (KERNEL32.257)
*
*/
/* FIXME: This is currently not used, see WIN32_GetProcAddress */
WINAPI FARPROC W32_GetProcAddress(HMODULE hModule,
LPCSTR lpszProc)
{
......@@ -45,3 +47,12 @@ WINAPI FARPROC W32_GetProcAddress(HMODULE hModule,
return RELAY32_GetEntryPoint(modulename, (char *) NULL, (int) lpszProc);
}
/***********************************************************************
* WinHelpA (USER32.578)
*/
BOOL WIN32_WinHelpA(HWND hWnd,LPCSTR lpszHelp,UINT uCommand, DWORD dwData)
{
/* Should do parameter conversion here, but WinHelp is not working,
anyways */
return WinHelp(hWnd,lpszHelp,uCommand,dwData);
}
/*
* Win32 relay functions
* The implementations here perform only parameter conversions, and
* call the Win16 counterparts
*
* Copyright 1996 Martin von Loewis
*/
#include <stdio.h>
#include "windows.h"
#include "winerror.h"
#include "struct32.h"
#include "stddebug.h"
#include "debug.h"
void PARAM32_POINT32to16(const POINT32* p32,POINT* p16)
{
p16->x = p32->x;
p16->y = p32->y;
}
/****************************************************************
* MoveToEx (GDI32.254)
*/
BOOL WIN32_MoveToEx(HDC hdc,int x,int y,POINT32* p32)
{
POINT p;
PARAM32_POINT32to16(p32,&p);
return MoveToEx(hdc,x,y,&p);
}
......@@ -5,6 +5,7 @@
*/
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "windows.h"
#include "winerror.h"
......
......@@ -2,6 +2,7 @@
* Win32 Resources
*
* Copyright 1995 Thomas Sandford
* Copyright 1996 Martin von Loewis
*
* Based on the Win16 resource handling code in loader/resource.c
* Copyright 1993 Robert J. Amstadt
......@@ -16,10 +17,13 @@
#include "kernel32.h"
#include "pe_image.h"
#include "handle32.h"
#include "libres.h"
#include "resource32.h"
#include "stackframe.h"
#include "neexe.h"
#include "accel.h"
#include "xmalloc.h"
#include "string32.h"
#include "stddebug.h"
#include "debug.h"
......@@ -38,19 +42,31 @@ int language = 0x0409;
*
*/
PIMAGE_RESOURCE_DIRECTORY GetResDirEntry(PIMAGE_RESOURCE_DIRECTORY resdirptr,
LPCSTR name,
LPCWSTR name,
DWORD root)
{
int entrynum;
PIMAGE_RESOURCE_DIRECTORY_ENTRY entryTable;
int namelen;
if (HIWORD(name)) {
/* FIXME: what about #xxx names? */
entryTable = (PIMAGE_RESOURCE_DIRECTORY_ENTRY) (
(BYTE *) resdirptr +
sizeof(IMAGE_RESOURCE_DIRECTORY));
namelen = STRING32_lstrlenW(name);
for (entrynum = 0; entrynum < resdirptr->NumberOfNamedEntries; entrynum++)
/* do what??? */ ;
{
PIMAGE_RESOURCE_DIR_STRING_U str =
(PIMAGE_RESOURCE_DIR_STRING_U) (root +
(entryTable[entrynum].Name & 0x7fffffff));
if(namelen != str->Length)
continue;
if(STRING32_lstrcmpniW(name,str->NameString,str->Length)==0)
return (PIMAGE_RESOURCE_DIRECTORY) (
root +
(entryTable[entrynum].OffsetToData & 0x7fffffff));
}
return NULL;
} else {
entryTable = (PIMAGE_RESOURCE_DIRECTORY_ENTRY) (
......@@ -200,11 +216,11 @@ DWORD SizeofResource32( HINSTANCE hModule, HRSRC hRsrc )
/**********************************************************************
* LoadAccelerators [USER.177]
*/
HANDLE LoadAccelerators32(HINSTANCE instance, LPCTSTR lpTableName)
HANDLE32 WIN32_LoadAcceleratorsW(HINSTANCE instance, LPCWSTR lpTableName)
{
HANDLE hAccel;
HANDLE rsc_mem;
HRSRC hRsrc;
HANDLE32 hAccel;
HANDLE32 rsc_mem;
HANDLE32 hRsrc;
BYTE *lp;
ACCELHEADER *lpAccelTbl;
int i, n;
......@@ -216,11 +232,11 @@ HANDLE LoadAccelerators32(HINSTANCE instance, LPCTSTR lpTableName)
dprintf_accel( stddeb, "LoadAccelerators: "NPFMT" %04x\n",
instance, LOWORD(lpTableName) );
if (!(hRsrc = FindResource( instance, lpTableName, RT_ACCELERATOR )))
if (!(hRsrc = FindResource32( instance, lpTableName, RT_ACCELERATOR )))
return 0;
if (!(rsc_mem = LoadResource( instance, hRsrc ))) return 0;
if (!(rsc_mem = LoadResource32( instance, hRsrc ))) return 0;
lp = (BYTE *)LockResource(rsc_mem);
lp = (BYTE *)LockResource32(rsc_mem);
n = SizeofResource( instance, hRsrc ) / sizeof(ACCELENTRY);
hAccel = GlobalAlloc(GMEM_MOVEABLE,
sizeof(ACCELHEADER) + (n + 1)*sizeof(ACCELENTRY));
......@@ -243,12 +259,20 @@ HANDLE LoadAccelerators32(HINSTANCE instance, LPCTSTR lpTableName)
FreeResource( rsc_mem );
return hAccel;
}
HANDLE32 WIN32_LoadAcceleratorsA(HINSTANCE instance, LPCSTR lpTableName)
{
LPWSTR uni=STRING32_DupAnsiToUni(lpTableName);
HANDLE32 result=WIN32_LoadAcceleratorsW(instance,uni);
free(uni);
return result;
}
/**********************************************************************
* LoadString
*/
int
LoadString32(HINSTANCE instance, DWORD resource_id, LPTSTR buffer, int buflen)
WIN32_LoadStringW(HINSTANCE instance, DWORD resource_id, LPWSTR buffer, int buflen)
{
HANDLE32 hmem, hrsrc;
WCHAR *p;
......@@ -292,10 +316,10 @@ LoadString32(HINSTANCE instance, DWORD resource_id, LPTSTR buffer, int buflen)
* LoadStringA
*/
int
LoadStringA32(HINSTANCE instance, DWORD resource_id, LPSTR buffer, int buflen)
WIN32_LoadStringA(HINSTANCE instance, DWORD resource_id, LPSTR buffer, int buflen)
{
WCHAR *buffer2 = xmalloc(buflen*2);
int retval = LoadString32(instance, resource_id, buffer2, buflen);
int retval = WIN32_LoadStringW(instance, resource_id, buffer2, buflen);
while (*buffer2)
*buffer++ = (char) *buffer2++;
......@@ -317,7 +341,7 @@ HICON LoadIconA32(HINSTANCE hinst, LPCTSTR lpszIcon)
/**********************************************************************
* LoadBitmapW
*/
HBITMAP LoadBitmapW32( HANDLE instance, LPCTSTR name )
HBITMAP WIN32_LoadBitmapW( HANDLE instance, LPCTSTR name )
{
HBITMAP hbitmap = 0;
HDC hdc;
......@@ -347,7 +371,105 @@ HBITMAP LoadBitmapW32( HANDLE instance, LPCTSTR name )
/**********************************************************************
* LoadBitmapA
*/
HBITMAP LoadBitmapA32( HANDLE instance, LPCTSTR name )
HBITMAP WIN32_LoadBitmapA( HANDLE instance, LPCTSTR name )
{
HBITMAP res;
if(!HIWORD(name))
res = WIN32_LoadBitmapW(instance,name);
else{
LPWSTR uni=STRING32_DupAnsiToUni(name);
res=WIN32_LoadBitmapW(instance,uni);
free(uni);
}
return res;
}
/**********************************************************************
* WIN32_ParseMenu
* LoadMenu helper function
*/
BYTE* WIN32_ParseMenu(HMENU hMenu,BYTE *it)
{
char entry[200]; /* buffer for ANSI names */
int bufsize=100;
int len;
WORD flags;
WORD wMenuID;
WCHAR *utext;
do{
flags=*(WORD*)it;
it+=sizeof(WORD);
/* POPUP entries have no ID, but a sub menu */
if(flags & MF_POPUP)
{
wMenuID = CreatePopupMenu();
len = STRING32_lstrlenW(it);
utext = it;
it += sizeof(WCHAR)*(len+1);
it = WIN32_ParseMenu(wMenuID,it);
} else {
wMenuID=*(WORD*)it;
it+=sizeof(WORD);
utext = it;
len = STRING32_lstrlenW(it);
it += sizeof(WCHAR)*(len+1);
if(!wMenuID && !*utext)
flags |= MF_SEPARATOR;
}
if(len>=bufsize) continue; /* hack hack */
STRING32_UniToAnsi(entry,utext);
AppendMenu(hMenu,flags,wMenuID,MAKE_SEGPTR(entry));
}while(!(flags & MF_END));
return it;
}
/*****************************************************************
* LoadMenuIndirectW (USER32.371)
*/
HMENU WIN32_LoadMenuIndirectW(void *menu)
{
return LoadBitmapW32(instance, name);
BYTE *it=menu;
HMENU hMenu = CreateMenu();
/*skip menu header*/
if(*(DWORD*)it)
fprintf(stderr,"Unknown menu header\n");
it+=2*sizeof(WORD);
WIN32_ParseMenu(hMenu,it);
return hMenu;
}
/*****************************************************************
* LoadMenuW (USER32.372)
*/
HMENU WIN32_LoadMenuW(HANDLE instance, LPCWSTR name)
{
HANDLE32 hrsrc;
hrsrc=FindResource32(instance,name,RT_MENU);
if(!hrsrc)return 0;
return WIN32_LoadMenuIndirectW(LoadResource32(instance, hrsrc));
}
/*****************************************************************
* LoadMenuIndirectA (USER32.370)
*/
HMENU WIN32_LoadMenuIndirectA(void *menu)
{
fprintf(stderr,"WIN32_LoadMenuIndirectA not implemented\n");
return 0;
}
/*****************************************************************
* LoadMenuA (USER32.370)
*/
HMENU WIN32_LoadMenuA(HANDLE instance,LPCSTR name)
{
HMENU res;
if(!HIWORD(name))
res = WIN32_LoadMenuW(instance,name);
else{
LPWSTR uni=STRING32_DupAnsiToUni(name);
res=WIN32_LoadMenuW(instance,uni);
free(uni);
}
return res;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment