Commit 8cc3a5e4 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 960811

Sun Aug 11 13:00:20 1996 Alexandre Julliard <julliard@lrc.epfl.ch> * [configure.in] [include/acconfig.h] [tools/build.c] Added check for underscore on external symbols. * [memory/selector.c] [memory/global.c] Fixed FreeSelector() to free only one selector. Added SELECTOR_FreeBlock() to free an array of selectors. * [objects/color.c] Fixed a bug in COLOR_ToLogical() that caused GetPixel() to fail on hi-color displays. * [tools/build.c] [if1632/crtdll.spec] Added 'extern' type, used for external variables or functions. * [windows/winpos.c] Allow de-activating a window in WINPOS_ChangeActiveWindow(). * [windows/winproc.c] Added 32-to-16 translation for button messages. Fixed WINPROC_GetPtr() to avoid crashes on 32-bit procedures that happen to be valid SEGPTRs. Sat Aug 10 18:22:25 1996 Albrecht Kleine <kleine@ak.sax.de> * [windows/message.c] Removed a FIXME in MSG_PeekHardwareMsg(): produces correct data for the JOURNALRECORD-hook (using EVENTMSG16 structure). * [if1632/gdi.spec] [include/windows.h] [objects/metafile.c] Introduced undocumented API function IsValidMetaFile(), plus a minor fix in last patch of CopyMetaFile(). * [objects/gdiobj.c] Removed a FIXME in IsGDIObject(): added magic word check. Sun Aug 10 18:10:10 1996 Bruce Milner <Bruce.Milner@genetics.utah.edu> * [controls/statuswin.c] First pass at implementing the StatusWindow class. * [include/commctrl.h] Header file for common controls. * [controls/widgets.c] Added InitCommonControls(). * [if1632/comctl32.spec] Add DrawStatusTextA, CreateStatusWindowA, InitCommonControls. * [win32/findfile.c] [if1632/kernel32.spec] Add FindNextFile32A, FindClose. Modified FindFirstFile32A so it works with FindNextFile32A. * [include/winbase.h] Fixed WIN32_FIND_DATA structure member names. Sat Aug 10 09:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu> * [windows/scroll.c] Changed scrolling routines to benefit from DCE code update. Thu Aug 8 18:05:09 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/file.c] SearchPath* could get NULL for lastpart argument. * [if1632/build-spec.txt] [documentation/debugging] Varargs documentation added, debugging hints updated. * [if1632/crtdll.spec][misc/crtdll.c][misc/Makefile.in] Started to implement CRTDLL. * [if1632/wsock32.spec] Some thunks to standard libc functions (structures have the same elements, but perhaps wrong offset due to packing). * [include/kernel32.h][include/windows.h][win32/*.c][loader/main.c] Merged kernel32.h into windows.h. * [misc/lstr.c] Enhanced FormatMessage(). * [misc/main.c] [if1632/kernel.spec] [include/windows.h] GetVersion() updated to new naming standard. Changed language handling to support language ids. * [misc/shell.c] Enhanced FindExecutable, so it finds files in the search path too. * [win32/environment.c] GetCommandLine* updated. * [loader/resource.c] [loader/pe_resource.c] FindResourceEx32* added. Loading of messagetables added. Language handling now uses Wine default language id.
parent f1aa3030
This is release 960805 of Wine, the MS Windows emulator. This is still a
This is release 960811 of Wine, the MS Windows emulator. This is still a
developer's only release. There are many bugs and many unimplemented API
features. Most applications still do not work correctly.
Patches should be submitted to "julliard@lrc.epfl.ch". Please don't
forget to include a ChangeLog entry.
WHAT'S NEW with Wine-960805: (see ChangeLog for details)
- More metafile features.
- Some more Win32 code.
WHAT'S NEW with Wine-960811: (see ChangeLog for details)
- Status window class.
- Some CRTDLL support.
- Fixes to scrolling code.
- Lots of bug fixes.
See the README file in the distribution for installation instructions.
......@@ -16,10 +17,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/development/Wine-960805.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-960805.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-960805.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-960805.tar.gz
sunsite.unc.edu:/pub/Linux/ALPHA/wine/development/Wine-960811.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-960811.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-960811.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-960811.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite.
......
----------------------------------------------------------------------
Sun Aug 11 13:00:20 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [configure.in] [include/acconfig.h] [tools/build.c]
Added check for underscore on external symbols.
* [memory/selector.c] [memory/global.c]
Fixed FreeSelector() to free only one selector.
Added SELECTOR_FreeBlock() to free an array of selectors.
* [objects/color.c]
Fixed a bug in COLOR_ToLogical() that caused GetPixel() to fail on
hi-color displays.
* [tools/build.c] [if1632/crtdll.spec]
Added 'extern' type, used for external variables or functions.
* [windows/winpos.c]
Allow de-activating a window in WINPOS_ChangeActiveWindow().
* [windows/winproc.c]
Added 32-to-16 translation for button messages.
Fixed WINPROC_GetPtr() to avoid crashes on 32-bit procedures that
happen to be valid SEGPTRs.
Sat Aug 10 18:22:25 1996 Albrecht Kleine <kleine@ak.sax.de>
* [windows/message.c]
Removed a FIXME in MSG_PeekHardwareMsg(): produces correct
data for the JOURNALRECORD-hook (using EVENTMSG16 structure).
* [if1632/gdi.spec] [include/windows.h] [objects/metafile.c]
Introduced undocumented API function IsValidMetaFile(), plus a
minor fix in last patch of CopyMetaFile().
* [objects/gdiobj.c]
Removed a FIXME in IsGDIObject(): added magic word check.
Sun Aug 10 18:10:10 1996 Bruce Milner <Bruce.Milner@genetics.utah.edu>
* [controls/statuswin.c]
First pass at implementing the StatusWindow class.
* [include/commctrl.h]
Header file for common controls.
* [controls/widgets.c]
Added InitCommonControls().
* [if1632/comctl32.spec]
Add DrawStatusTextA, CreateStatusWindowA, InitCommonControls.
* [win32/findfile.c] [if1632/kernel32.spec]
Add FindNextFile32A, FindClose.
Modified FindFirstFile32A so it works with FindNextFile32A.
* [include/winbase.h]
Fixed WIN32_FIND_DATA structure member names.
Sat Aug 10 09:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu>
* [windows/scroll.c]
Changed scrolling routines to benefit from DCE code update.
Thu Aug 8 18:05:09 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [files/file.c]
SearchPath* could get NULL for lastpart argument.
* [if1632/build-spec.txt] [documentation/debugging]
Varargs documentation added, debugging hints updated.
* [if1632/crtdll.spec][misc/crtdll.c][misc/Makefile.in]
Started to implement CRTDLL.
* [if1632/wsock32.spec]
Some thunks to standard libc functions (structures have the same
elements, but perhaps wrong offset due to packing).
* [include/kernel32.h][include/windows.h][win32/*.c][loader/main.c]
Merged kernel32.h into windows.h.
* [misc/lstr.c]
Enhanced FormatMessage().
* [misc/main.c] [if1632/kernel.spec] [include/windows.h]
GetVersion() updated to new naming standard.
Changed language handling to support language ids.
* [misc/shell.c]
Enhanced FindExecutable, so it finds files in the search path too.
* [win32/environment.c]
GetCommandLine* updated.
* [loader/resource.c] [loader/pe_resource.c]
FindResourceEx32* added.
Loading of messagetables added.
Language handling now uses Wine default language id.
----------------------------------------------------------------------
Sun Aug 4 18:18:48 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [controls/scroll.c]
......
......@@ -137,4 +137,10 @@ distclean: clean
$(RM) config.* Make.rules include/config.h
$(RM) `find . \( -name Makefile -o -size 0 \) -print`
configure: configure.in
autoconf
include/config.h.in: configure.in include/acconfig.h
autoheader -l include
dummy:
......@@ -1615,6 +1615,48 @@ echo "$ac_t""$ac_cv_c_gcc_strength_bug" 1>&6
fi
echo $ac_n "checking "whether external symbols need an underscore prefix"""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_c_extern_prefix'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
saved_libs=$LIBS
LIBS="conftest_asm.s $LIBS"
cat > conftest_asm.s <<EOF
.globl _ac_test
_ac_test:
.long 0
EOF
cat > conftest.$ac_ext <<EOF
#line 1631 "configure"
#include "confdefs.h"
extern int ac_test;
int main() { return 0; }
int t() {
if (ac_test) return 1
; return 0; }
EOF
if { (eval echo configure:1639: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
ac_cv_c_extern_prefix="yes"
else
rm -rf conftest*
ac_cv_c_extern_prefix="no"
fi
rm -f conftest*
LIBS=$saved_libs
fi
echo "$ac_t""$ac_cv_c_extern_prefix" 1>&6
if test "$ac_cv_c_extern_prefix" = "yes"
then
cat >> confdefs.h <<\EOF
#define NEED_UNDERSCORE_PREFIX 1
EOF
fi
for ac_func in memmove tcgetattr usleep
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
......@@ -1622,7 +1664,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 1626 "configure"
#line 1668 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
......@@ -1646,7 +1688,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
......@@ -1673,7 +1715,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 1677 "configure"
#line 1719 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
......@@ -1728,7 +1770,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 1732 "configure"
#line 1774 "configure"
#include "confdefs.h"
int main() { return 0; }
......@@ -1778,7 +1820,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
if { (eval echo configure:1782: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1824: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
......@@ -1802,7 +1844,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 1806 "configure"
#line 1848 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
......@@ -1810,7 +1852,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1814: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1856: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -1825,7 +1867,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 1829 "configure"
#line 1871 "configure"
#include "confdefs.h"
#include <string.h>
EOF
......@@ -1843,7 +1885,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 1847 "configure"
#line 1889 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
......@@ -1864,7 +1906,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
#line 1868 "configure"
#line 1910 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
......@@ -1875,7 +1917,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
{ (eval echo configure:1879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
{ (eval echo configure:1921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
:
else
......@@ -1899,7 +1941,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 1903 "configure"
#line 1945 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
......
......@@ -66,6 +66,25 @@ int main(void) {
fi
fi
dnl **** Check for underscore on external symbols ****
AC_CACHE_CHECK("whether external symbols need an underscore prefix",
ac_cv_c_extern_prefix,
[saved_libs=$LIBS
LIBS="conftest_asm.s $LIBS"
cat > conftest_asm.s <<EOF
.globl _ac_test
_ac_test:
.long 0
EOF
AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
LIBS=$saved_libs])
if test "$ac_cv_c_extern_prefix" = "yes"
then
AC_DEFINE(NEED_UNDERSCORE_PREFIX)
fi
dnl **** Check for functions and header files ****
AC_CHECK_FUNCS(memmove tcgetattr usleep)
......
......@@ -11,6 +11,7 @@ C_SRCS = \
menu.c \
scroll.c \
static.c \
status.c \
widgets.c
all: $(MODULE).o
......
......@@ -163,7 +163,7 @@ static LRESULT CBCreate(HWND hwnd, WPARAM wParam, LPARAM lParam)
lphc->RectButton.bottom = lphc->RectButton.top + lphl->StdItemHeight;
SetWindowPos(hwnd, 0, 0, 0, rect.right -rect.left + 2*SYSMETRICS_CXBORDER,
lphl->StdItemHeight + 2*SYSMETRICS_CYBORDER,
SWP_NOMOVE | SWP_NOZORDER | SWP_NOSENDCHANGING);
SWP_NOMOVE | SWP_NOZORDER | SWP_NOSENDCHANGING | SWP_NOACTIVATE);
dprintf_combo(stddeb,(cstyle & 3)==CBS_DROPDOWN ? "CBS_DROPDOWN\n": "CBS_DROPDOWNLIST\n");
break;
......@@ -615,7 +615,8 @@ static LRESULT CBShowDropDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
lphc->DropDownVisible = wParam;
GetWindowRect32(hwnd,&rect);
SetWindowPos(lphc->hWndLBox, 0, rect.left, rect.top+lphc->LBoxTop, 0, 0,
SWP_NOSIZE | (wParam ? SWP_SHOWWINDOW : SWP_HIDEWINDOW));
SWP_NOSIZE | SWP_NOACTIVATE |
(wParam ? SWP_SHOWWINDOW : SWP_HIDEWINDOW));
if (!wParam) SetFocus(hwnd);
}
return 0;
......@@ -1005,7 +1006,7 @@ static LRESULT CBLLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam )
int y;
RECT16 rectsel;
SetFocus(hwnd);
/* SetFocus(hwnd); */
SetCapture(hwnd);
lphl->PrevFocused = lphl->ItemFocused;
......@@ -1213,6 +1214,8 @@ LRESULT ComboLBoxWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_MOUSEMOVE: return CBLMouseMove(hwnd, wParam, lParam);
case WM_VSCROLL: return CBLVScroll(hwnd, wParam, lParam);
case WM_SIZE: return CBLCheckSize(hwnd);
case WM_MOUSEACTIVATE: /* We don't want to be activated */
return MA_NOACTIVATE;
}
return DefWindowProc16(hwnd, message, wParam, lParam);
}
......
......@@ -2177,7 +2177,7 @@ static LRESULT EDIT_WM_Copy(WND *wndPtr, WPARAM wParam, LPARAM lParam)
{
UINT s = LOWORD(EDIT_EM_GetSel(wndPtr, 0, 0L));
UINT e = HIWORD(EDIT_EM_GetSel(wndPtr, 0, 0L));
HGLOBAL hdst;
HGLOBAL16 hdst;
char *text;
char *dst;
char *src;
......@@ -2717,7 +2717,7 @@ static LRESULT EDIT_WM_Paint(WND *wndPtr, WPARAM wParam, LPARAM lParam)
*/
static LRESULT EDIT_WM_Paste(WND *wndPtr, WPARAM wParam, LPARAM lParam)
{
HGLOBAL hsrc;
HGLOBAL16 hsrc;
char *src;
OpenClipboard(wndPtr->hwndSelf);
......
......@@ -107,7 +107,7 @@ static UINT uSubPWndLevel = 0;
static HMENU MENU_CopySysMenu(void)
{
HMENU hMenu;
HGLOBAL handle;
HGLOBAL16 handle;
POPUPMENU *menu;
if (!(handle = SYSRES_LoadResource( SYSRES_MENU_SYSMENU ))) return 0;
......
......@@ -46,9 +46,9 @@ static pfPaint staticPaintFunc[LAST_STATIC_TYPE+1] =
*
* Set the icon for an SS_ICON control.
*/
static HICON STATIC_SetIcon( WND *wndPtr, HICON hicon )
static HICON16 STATIC_SetIcon( WND *wndPtr, HICON16 hicon )
{
HICON prevIcon;
HICON16 prevIcon;
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
if ((wndPtr->dwStyle & 0x0f) != SS_ICON) return 0;
......@@ -167,7 +167,7 @@ LRESULT StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return infoPtr->hIcon;
case STM_SETICON:
lResult = STATIC_SetIcon( wndPtr, (HICON)wParam );
lResult = STATIC_SetIcon( wndPtr, (HICON16)wParam );
InvalidateRect32( hWnd, NULL, FALSE );
UpdateWindow( hWnd );
break;
......
......@@ -5,8 +5,10 @@
*/
#include "win.h"
#include "commctrl.h"
#include "button.h"
#include "static.h"
#include "status.h"
#include "scroll.h"
#include "desktop.h"
#include "mdi.h"
......@@ -49,6 +51,7 @@ static const BUILTIN_CLASS_INFO16 WIDGETS_BuiltinClasses16[] =
#define NB_BUILTIN_CLASSES16 \
(sizeof(WIDGETS_BuiltinClasses16)/sizeof(WIDGETS_BuiltinClasses16[0]))
static WNDCLASS32A WIDGETS_BuiltinClasses32[] =
{
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
......@@ -61,6 +64,16 @@ static WNDCLASS32A WIDGETS_BuiltinClasses32[] =
(sizeof(WIDGETS_BuiltinClasses32)/sizeof(WIDGETS_BuiltinClasses32[0]))
static WNDCLASS32A WIDGETS_CommonControls32[] =
{
{ CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW, StatusWindowProc, 0,
sizeof(STATUSWINDOWINFO), 0, 0, 0, 0, 0, STATUSCLASSNAME32A },
};
#define NB_COMMON_CONTROLS32 \
(sizeof(WIDGETS_CommonControls32)/sizeof(WIDGETS_CommonControls32[0]))
/***********************************************************************
* WIDGETS_Init
*
......@@ -108,3 +121,23 @@ BOOL WIDGETS_Init(void)
SEGPTR_FREE(name);
return TRUE;
}
/***********************************************************************
* InitCommonControls (COMCTL32.15)
*/
void InitCommonControls(void)
{
int i;
char name[30];
WNDCLASS32A *class32 = WIDGETS_CommonControls32;
for (i = 0; i < NB_COMMON_CONTROLS32; i++, class32++)
{
/* Just to make sure the string is > 0x10000 */
strcpy( name, (char *)class32->lpszClassName );
class32->lpszClassName = name;
class32->hCursor = LoadCursor16( 0, IDC_ARROW );
RegisterClass32A( class32 );
}
}
......@@ -63,6 +63,7 @@ relevant developer as feasonable.
^^^^^^
|Returnvalue is 16 bit and has the value 7.
3. If you have found a misbehaving function, try to find out why it
misbehaves. Find the function in the source code. Try to make sense of
the arguments passed. Usually there is a
......@@ -70,15 +71,30 @@ relevant developer as feasonable.
function. Rerun wine with "-debugmsg +xyz,+relay" added to the
commandline.
4. If those information isn't clear enough or if you want to know more about
4. If the crash happened in a function in WINE, find out the exact line using
gdb (the sample crash has another reason):
|... somewhere in the backtrace ...
|5 0x080e5ad8 (CreateWindowEx32A+0xd8)
|...
|$ gdb wine
|...
|(gdb) l *0x080e5ad8
|0x80e5ad8 is in CreateWindowEx32A (win.c:837).
|...
|837 return WIN_CreateWindowEx( &cs, classAtom, FALSE );
|...
5. If those information isn't clear enough or if you want to know more about
what's happening in the function itself, try running wine with "-debugmsg
+all", which dumps ALL included debug information in wine.
5. If that isn't enough add more debug output for yourself into the
6. If that isn't enough add more debug output for yourself into the
functions you find relevant.
You might also try to run the program in gdb instead of using the
WINE-debugger.
6. You can also set a breakpoint for that function. Start wine with the
7. You can also set a breakpoint for that function. Start wine with the
"-debug" option added to the commandline. After loading the executable
wine will enter the internal debugger. Use "break KERNEL.LSTRLEN"
(replace by function you want to debug, CASE IS RELEVANT.) to set a
......@@ -95,7 +111,7 @@ Program hangs, nothing happens
Switch to UNIX shell, get the process-ID using "ps -a|grep wine", and do a
"kill -HUP <pid>" (without " and <>). Wine will then enter its internal
debugger and you can procede as explained above.
debugger and you can proceed as explained above.
Program reports an error with a Messagebox
==========================================
......@@ -113,6 +129,44 @@ Program reports an error with a Messagebox
above.
Disassembling programs:
=======================
You may also try to disassemble the offending program to check for
undocumented features and/or use of them.
The best, freely available, disassembler for win16 programs is
Windows Codeback, archivename wcbxxx.zip, which usually can be found
in the Cica-Mirror subdirectory on the WINE ftpsites. (See ANNOUNCE).
Disassembling win32 programs is currenty only possible using
Windows Disassembler 32, archivename something like wdasm32x.zip on
ftp.winsite.com and mirrors.
Understanding disassembled code is just a question of exercise.
Most code out there uses standard C function entries (for it is usually
written in C). Win16 function entries usually look like that:
| push bp
| mov bp, sp
| ... function code ..
| retf XXXX <--------- XXXX is number of bytes of arguments
This is a FAR function with no local storage. The arguments usually start
at [bp+6] with increasing offsets. Note, that [bp+6] belongs to the RIGHTMOST
argument, for exported win16 functions use the PASCAL calling convention.
So, if we use strcmp(a,b) with a and b both 32 bit variables b would be at
[bp+6] and a at [bp+10].
Most functions make also use of local storage in the stackframe:
| enter 0086, 00
| ... function code ...
| leave
| retf XXXX
This does mostly the same as above, but also adds 0x86 bytes of
stackstorage, which is accessed using [bp-xx].
Before calling a function, arguments are pushed on the stack using something
like this:
| push word ptr [bp-02] <- will be at [bp+8]
| push di <- will be at [bp+6]
| call KERNEL.LSTRLEN
Here first the selector and then the offset to the passed string are pushed.
Sample debugging session:
=========================
......
......@@ -205,13 +205,13 @@ located in windows/, controls/, and misc/ directories.
b) Intertask/interthread SendMessage. The system has to inform the
target queue about the forthcoming message, then it has to
carry out the context switch and wait until the result is
available. In Win16 it is done by putting necessary parameters
into the queue structure and do a DirectedYield() call.
However, in Win32 there could be several messages pending sent
by preemptively executing threads, and in this case SendMessage
has to build some sort of message queue for sent
messages. Another issue is what to do with messages sent to the
sender when it is blocked inside its own SendMessage. At this
point Wine does not address any of these problems.
target queue about the forthcoming message, then it has to carry
out the context switch and wait until the result is available.
Win16 stores necessary parameters in the queue structure and then
calls DirectedYield() function. However, in Win32 there could be
several messages pending sent by preemptively executing threads,
and in this case SendMessage has to build some sort of message
queue for sent messages. Another issue is what to do with messages
sent to the sender when it is blocked inside its own SendMessage.
At this point Wine addresses very few of these problems.
......@@ -906,10 +906,12 @@ found:
p=p+1;
else
p=testpath;
if (p-testpath<buflen)
*lastpart=(p-testpath)+buf;
else
*lastpart=NULL;
if (lastpart) {
if (p-testpath<buflen)
*lastpart=(p-testpath)+buf;
else
*lastpart=NULL;
}
dprintf_file(stddeb," -> found %s,last part is %s\n",testpath,p);
return strlen(testpath);
}
......@@ -930,10 +932,12 @@ DWORD SearchPath32W(
ret=SearchPath32A(pathA,fnA,extA,buflen,bufA,&lastpartA);
lstrcpynAtoW(buf,bufA,buflen);
if (lastpartA)
*lastpart = buf+(lastpartA-bufA);
else
*lastpart = NULL;
if (lastpart) {
if (lastpartA)
*lastpart = buf+(lastpartA-bufA);
else
*lastpart = NULL;
}
free(bufA);
free(fnA);
if (pathA) free(pathA);
......
......@@ -5,8 +5,8 @@ base 2
00 stub MenuHelp
01 stub ShowHideMenuCtl
02 stub GetEffectiveClientRect
03 stub DrawStatusTextA
04 stub CreateStatusWindowA
03 stdcall DrawStatusTextA(long ptr ptr long) DrawStatusText32A
04 stdcall CreateStatusWindowA(long ptr long long) CreateStatusWindow32A
05 stub CreateToolbar
06 stub CreateMappedBitmap
07 stub CreatePropertySheetPage
......@@ -17,7 +17,7 @@ base 2
12 stub LBItemFromPt
13 stub DrawInsert
14 stub CreateUpDownControl
15 return InitCommonControls 4 0
15 stdcall InitCommonControls() InitCommonControls
16 stub CreateStatusWindowW
17 stub CreateToolbarEx
18 stub DestroyPropertySheetPage
......
# C RunTime DLL. All functions use cdecl!
name crtdll
type win32
base 1
......@@ -23,9 +24,9 @@ base 1
019 stub _CItanh
020 stub _HUGE_dll
021 stub _XcptFilter
022 stub __GetMainArgs
023 stub __argc_dll
024 stub __argv_dll
022 cdecl __GetMainArgs(ptr ptr ptr long) CRTDLL__GetMainArgs
023 extern __argc_dll CRTDLL_argc_dll
024 extern __argv_dll CRTDLL_argv_dll
025 stub __dllonexit
026 stub __doserrno
027 stub __fpecode
......@@ -39,13 +40,13 @@ base 1
035 stub __toascii
036 stub _abnormal_termination
037 stub _access
038 stub _acmdln_dll
038 extern _acmdln_dll CRTDLL_acmdln_dll
039 stub _aexit_rtn_dll
040 stub _amsg_exit
041 stub _assert
042 stub _basemajor_dll
043 stub _baseminor_dll
044 stub _baseversion_dll
042 extern _basemajor_dll CRTDLL_basemajor_dll
043 extern _baseminor_dll CRTDLL_baseminor_dll
044 extern _baseversion_dll CRTDLL_baseversion_dll
045 stub _beep
046 stub _beginthread
047 stub _c_exit
......@@ -76,7 +77,7 @@ base 1
072 stub _dup2
073 stub _ecvt
074 stub _endthread
075 stub _environ_dll
075 extern _environ_dll CRTDLL_environ_dll
076 stub _eof
077 stub _errno
078 stub _except_handler2
......@@ -136,9 +137,9 @@ base 1
132 stub _heapset
133 stub _heapwalk
134 stub _hypot
135 stub _initterm
135 cdecl _initterm(ptr ptr) CRTDLL__initterm
136 stub _iob
137 stub _isatty
137 cdecl _isatty(long) CRTDLL__isatty
138 stub _isctype
139 stub _ismbbalnum
140 stub _ismbbalpha
......@@ -242,11 +243,11 @@ base 1
238 stub _onexit
239 stub _open
240 stub _open_osfhandle
241 stub _osmajor_dll
242 stub _osminor_dll
243 stub _osmode_dll
244 stub _osver_dll
245 stub _osversion_dll
241 extern _osmajor_dll CRTDLL_osmajor_dll
242 extern _osminor_dll CRTDLL_osminor_dll
243 long _osmode_dll(0)
244 extern _osver_dll CRTDLL_osver_dll
245 extern _osversion_dll CRTDLL_osversion_dll
246 stub _pclose
247 stub _pctype_dll
248 stub _pgmptr_dll
......@@ -330,10 +331,10 @@ base 1
326 stub _wcsrev
327 stub _wcsset
328 stub _wcsupr
329 stub _winmajor_dll
330 stub _winminor_dll
331 stub _winver_dll
332 stub _write
329 extern _winmajor_dll CRTDLL_winmajor_dll
330 extern _winminor_dll CRTDLL_winminor_dll
331 extern _winver_dll CRTDLL_winver_dll
332 cdecl _write(long ptr long) CRTDLL__write
333 stub _wtoi
334 stub _wtol
335 stub _y0
......@@ -360,13 +361,13 @@ base 1
356 stub ctime
357 stub difftime
358 stub div
359 stub exit
359 cdecl exit(long) CRTDLL_exit
360 stub exp
361 stub fabs
362 stub fclose
363 stub feof
364 stub ferror
365 stub fflush
365 cdecl fflush(ptr) CRTDLL_fflush
366 stub fgetc
367 stub fgetpos
368 stub fgets
......@@ -374,7 +375,7 @@ base 1
370 stub floor
371 stub fmod
372 stub fopen
373 stub fprintf
373 cdecl fprintf() CRTDLL_fprintf
374 stub fputc
375 stub fputs
376 stub fputwc
......@@ -392,7 +393,7 @@ base 1
388 stub getc
389 stub getchar
390 stub getenv
391 stub gets
391 cdecl gets(ptr) CRTDLL_gets
392 stub gmtime
393 stub is_wctype
394 stub isalnum
......@@ -441,9 +442,9 @@ base 1
437 stub modf
438 stub perror
439 stub pow
440 stub printf
440 cdecl printf() CRTDLL_printf
441 stub putc
442 stub putchar
442 cdecl putchar(long) CRTDLL_putchar
443 stub puts
444 stub qsort
445 stub raise
......@@ -461,7 +462,7 @@ base 1
457 stub sinh
458 stub sprintf
459 stub sqrt
460 stub srand
460 cdecl srand(long) CRTDLL_srand
461 stub sscanf
462 stub strcat
463 stub strchr
......@@ -489,11 +490,11 @@ base 1
485 stub system
486 stub tan
487 stub tanh
488 stub time
488 cdecl time(ptr) CRTDLL_time
489 stub tmpfile
490 stub tmpnam
491 stub tolower
492 stub toupper
492 cdecl toupper(long) CRTDLL_toupper
493 stub towlower
494 stub towupper
495 stub ungetc
......
......@@ -4,28 +4,26 @@
* Copyright (c) 1996 Onno Hovers, (onno@stack.urc.tue.nl)
*
*/
#if defined(__svr4__) || defined(_SCO_DS)
#define __ELF__ 1
#endif
#include "../include/config.h"
#ifndef __ELF__
#ifdef NEED_UNDERSCORE_PREFIX
.globl _EXC_CallUnhandledExceptionFilter
_EXC_CallUnhandledExceptionFilter:
#else /* __ELF__ */
#else
.globl EXC_CallUnhandledExceptionFilter
EXC_CallUnhandledExceptionFilter:
#endif /* __ELF__ */
#endif /* NEED_UNDERSCORE_PREFIX */
leal 4(%esp),%eax
pushl %eax
#ifndef __ELF__
#ifdef NEED_UNDERSCORE_PREFIX
call *_pTopExcHandler
#else /* __ELF__ */
#else
call *pTopExcHandler
#endif /* __ELF__ */
#endif /* NEED_UNDERSCORE_PREFIX */
movl %ebp,%esp
ret
......@@ -95,7 +93,7 @@
#define PARM_EBP 4
#define PARM_EFLAGS 0
#ifndef __ELF__
#ifdef NEED_UNDERSCORE_PREFIX
.globl _RaiseException
_RaiseException:
......@@ -107,7 +105,7 @@
_RtlUnwind:
push $_EXC_RtlUnwind
#else /* __ELF__ */
#else /* NEED_UNDERSCORE_PREFIX */
.globl RaiseException
RaiseException:
......@@ -118,7 +116,7 @@
RtlUnwind:
push $EXC_RtlUnwind
#endif /* __ELF__ */
#endif /* NEED_UNDERSCORE_PREFIX */
ContextCall:
pushl %ebp
......
......@@ -269,7 +269,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects)
405 stub FINALGDIINIT
407 stub CREATEUSERBITMAP
409 stub CREATEUSERDISCARDABLEBITMAP
410 stub ISVALIDMETAFILE
410 pascal16 IsValidMetaFile (word) IsValidMetaFile
411 pascal16 GetCurLogFont(word) GetCurLogFont
412 pascal16 IsDCCurrentPalette(word) IsDCCurrentPalette
439 pascal16 StretchDIBits (word s_word s_word word word word word
......
......@@ -3,7 +3,7 @@ type win16
1 stub FatalExit
2 stub ExitKernel
3 pascal GetVersion() GetVersion
3 pascal GetVersion() GetVersion16
4 pascal16 LocalInit(word word word) LocalInit
5 pascal16 LocalAlloc(word word) LocalAlloc16
6 pascal16 LocalReAlloc(word word word) LocalReAlloc16
......
......@@ -121,18 +121,18 @@ base 1
0116 stub FillConsoleOutputCharacterW
0117 stub FindAtomA
0118 stub FindAtomW
0119 stub FindClose
0119 stdcall FindClose(long) FindClose
0120 stub FindCloseChangeNotification
0121 stub FindFirstChangeNotificationA
0122 stub FindFirstChangeNotificationW
0123 stdcall FindFirstFileA(ptr ptr) FindFirstFile32A
0124 stub FindFirstFileW
0125 stub FindNextChangeNotification
0126 stub FindNextFileA
0126 stdcall FindNextFileA(long ptr) FindNextFile32A
0127 stub FindNextFileW
0128 stdcall FindResourceA(long ptr ptr) FindResource32A
0129 stub FindResourceExA
0130 stub FindResourceExW
0129 stdcall FindResourceExA(long ptr ptr long) FindResourceEx32A
0130 stdcall FindResourceExW(long ptr ptr long) FindResourceEx32W
0131 stdcall FindResourceW(long ptr ptr) FindResource32W
0132 stub FlushConsoleInputBuffer
0133 stdcall FlushFileBuffers(long) FlushFileBuffers
......@@ -140,7 +140,7 @@ base 1
0135 stub FlushViewOfFile
0136 stub FoldStringA
0137 stub FoldStringW
0138 stdcall FormatMessageA(long ptr long long ptr long ptr) FormatMessage32A
0138 stdcall FormatMessageA() WIN32_FormatMessage32A
0139 stub FormatMessageW
0140 stub FreeConsole
0141 stdcall FreeEnvironmentStringsA(ptr) FreeEnvironmentStringsA
......@@ -163,8 +163,8 @@ base 1
0158 stub GetCommProperties
0159 stdcall GetCommState(long ptr) GetCommState32
0160 stdcall GetCommTimeouts(long ptr) GetCommTimeouts
0161 stdcall GetCommandLineA() GetCommandLineA
0162 stub GetCommandLineW
0161 stdcall GetCommandLineA() GetCommandLine32A
0162 stdcall GetCommandLineW() GetCommandLine32W
0163 stub GetCompressedFileSizeA
0164 stub GetCompressedFileSizeW
0165 stub GetComputerNameA
......
......@@ -33,7 +33,7 @@ base 1
0028 stub FindExeDlgProc
0029 stub FindExecutableA
0030 stub FindExecutableW
0031 stub FreeIconList
0031 return FreeIconList 4 0
0032 stub InternalExtractIconListA
0033 stub InternalExtractIconListW
0034 stub OpenAs_RunDLL
......
......@@ -11,8 +11,8 @@ base 0
007 stub getsockopt
008 stub htonl
009 stub htons
010 stub inet_addr
011 stub inet_ntoa
010 stdcall inet_addr(ptr) inet_addr
011 stdcall inet_ntoa(ptr) inet_ntoa
012 stub ioctlsocket
013 stub listen
014 stub ntohl
......@@ -25,11 +25,11 @@ base 0
021 stub setsockopt
022 stub shutdown
023 stub socket
051 stub gethostbyaddr
051 stdcall gethostbyaddr(ptr long long) gethostbyaddr
052 stub gethostbyname
053 stub getprotobyname
054 stub getprotobynumber
055 stub getservbyname
055 stdcall getservbyname(ptr ptr) getservbyname
056 stub getservbyport
057 stub gethostname
101 stub WSAAsyncSelect
......@@ -46,21 +46,21 @@ base 0
112 stub WSASetLastError
113 stub WSACancelBlockingCall
114 stub WSAIsBlocking
115 stub WSAStartup
116 stub WSACleanup
115 stdcall WSAStartup(long ptr) WSAStartup
116 stdcall WSACleanup() WSACleanup
151 stub __WSAFDIsSet
#500 stub WEP
# applications *should* 'degrade gracefully if these are not present
# ... as it is, they don't
#1000 stub WSApSetPostRoutine
#1100 stub inet_network
#1101 stub getnetbyname
1100 stub inet_network
1101 stub getnetbyname
#1102 stub rcmd
#1103 stub rexec
#1104 stub rresvport
#1105 stub sethostname
#1106 stub dn_expand
#1107 stub WSARecvEx
1107 stub WSARecvEx
1108 stub s_perror
1109 stub GetAddressByNameA
1110 stub GetAddressByNameW
......
/*
* This file is used by 'autoheader' to generate the list of symbols
* defined in the 'configure' script.
*/
/* Define if symbols declared in assembly code need an underscore prefix */
#undef NEED_UNDERSCORE_PREFIX
#ifndef __WINE_ADVAPI32_H
#define __WINE_ADVAPI32_H
#include "shell.h"
#include "kernel32.h"
BOOL GetUserNameA (char * lpBuffer, DWORD *nSize);
......
......@@ -48,7 +48,7 @@ extern int DIB_GetImageWidthBytes( int width, int depth );
extern int DIB_BitmapInfoSize( BITMAPINFO * info, WORD coloruse );
/* objects/oembitmap.c */
extern HBITMAP OBM_LoadBitmap( WORD id );
extern HANDLE OBM_LoadCursorIcon( WORD id, BOOL fCursor );
extern HBITMAP16 OBM_LoadBitmap( WORD id );
extern HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor );
#endif /* __WINE_BITMAP_H */
......@@ -64,6 +64,8 @@ extern WORD CallTo16_regs_( FARPROC16 func, WORD ds, WORD es, WORD bp, WORD ax,
style, MAKELONG(y,x), MAKELONG(cy,cx), \
MAKELONG(hmenu,hparent), instance, params, \
hwnd, msg, wParam, lParam )
#define _InitTermProc( func ) CallTo32_0( (FARPROC32)func )
/* List of the 32-bit callback functions. This list is used */
/* by the build program to generate the file if1632/callto32.S */
......@@ -99,6 +101,8 @@ extern LONG CallTo32_4( FARPROC32, DWORD, DWORD, DWORD, DWORD );
(*func)( hwnd, msg, wParam, lParam )
#define CallWordBreakProc( func, lpch, ichCurrent, cch, code ) \
(*func)( lpch, ichCurrent, cch, code )
#define _InitTermProc( func ) (*func)()
#endif /* WINELIB */
......
/*
* Common controls definitions
*/
#ifndef __WINE_COMMCTRL_H
#define __WINE_COMMCTRL_H
#include "windows.h"
void InitCommonControls(void);
/* StatusWindow */
#define STATUSCLASSNAME16 "msctls_statusbar"
#define STATUSCLASSNAME32A "msctls_statusbar32"
#define STATUSCLASSNAME32W "msctls_statusbar32"
#define STATUSCLASSNAME WINELIB_NAME_AW(STATUSCLASSNAME)
#define SB_SETTEXT32A (WM_USER+1)
#define SB_SETTEXT32W (WM_USER+11)
#define SB_SETTEXT WINELIB_NAME_AW(SB_SETTEXT)
#define SB_GETTEXT32A (WM_USER+2)
#define SB_GETTEXT32W (WM_USER+13)
#define SB_GETTEXT WINELIB_NAME_AW(SB_GETTEXT)
#define SB_GETTEXTLENGTH32A (WM_USER+3)
#define SB_GETTEXTLENGTH32W (WM_USER+12)
#define SB_GETTEXTLENGTH WINELIB_NAME_AW(SB_GETTEXTLENGTH)
#define SB_SETPARTS (WM_USER+4)
#define SB_GETPARTS (WM_USER+6)
#define SB_GETBORDERS (WM_USER+7)
#define SB_SETMINHEIGHT (WM_USER+8)
#define SB_SIMPLE (WM_USER+9)
#define SB_GETRECT (WM_USER+10)
#define SBT_NOBORDERS 0x0100
#define SBT_POPOUT 0x0200
#define SBT_RTLREADING 0x0400
#define SBT_OWNERDRAW 0x1000
#define CCS_BOTTOM 0x0003
#define SBARS_SIZEGRIP 0x0100
HWND32 CreateStatusWindow32A(INT32,LPCSTR,HWND32,UINT32);
HWND32 CreateStatusWindow32W(INT32,LPCWSTR,HWND32,UINT32);
#define CreateStatusWindow WINELIB_NAME_AW(CreateStatusWindow)
VOID DrawStatusText32A(HDC32,LPRECT32,LPCSTR,UINT32);
VOID DrawStatusText32W(HDC32,LPRECT32,LPCWSTR,UINT32);
#define DrawStatusText WINELIB_NAME_AW(DrawStatusText)
#endif /* __WINE_COMMCTRL_H */
......@@ -206,8 +206,8 @@ typedef CHOOSEFONT *LPCHOOSEFONT;
typedef struct {
DWORD lStructSize;
HWND hwndOwner;
HGLOBAL hDevMode;
HGLOBAL hDevNames;
HGLOBAL16 hDevMode;
HGLOBAL16 hDevNames;
HDC hDC;
DWORD Flags;
UINT nFromPage;
......@@ -221,8 +221,8 @@ typedef struct {
WNDPROC16 lpfnSetupHook;
SEGPTR lpPrintTemplateName;
SEGPTR lpSetupTemplateName;
HGLOBAL hPrintTemplate;
HGLOBAL hSetupTemplate;
HGLOBAL16 hPrintTemplate;
HGLOBAL16 hSetupTemplate;
} PRINTDLG;
typedef PRINTDLG * LPPRINTDLG;
......
......@@ -15,6 +15,9 @@
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if symbols declared in assembly code need an underscore prefix */
#undef NEED_UNDERSCORE_PREFIX
/* Define if you have the memmove function. */
#undef HAVE_MEMMOVE
......
......@@ -23,12 +23,12 @@ typedef struct {
REL_PTR rel;
}DDE_HWND;
WORD DDE_SyncHandle(HGLOBAL handle, WORD sel);
WORD DDE_SyncHandle(HGLOBAL16 handle, WORD sel);
void *DDE_malloc(unsigned int flags,unsigned long size, SHMDATA *shmdata);
HANDLE DDE_GlobalReAlloc(WORD,long,WORD);
HGLOBAL DDE_GlobalFree(HGLOBAL block);
void *DDE_AttachHandle(HGLOBAL handle, SEGPTR *segptr);
WORD DDE_GlobalHandleToSel( HGLOBAL handle );
HGLOBAL16 DDE_GlobalFree(HGLOBAL16 block);
void *DDE_AttachHandle(HGLOBAL16 handle, SEGPTR *segptr);
WORD DDE_GlobalHandleToSel( HGLOBAL16 handle );
int DDE_GlobalUnlock(int);
HANDLE DDE_GlobalSize(WORD);
HANDLE DDE_GlobalHandle(WORD);
......
......@@ -54,7 +54,7 @@ typedef struct tagDRIVERITEM
DRIVERPROC lpDrvProc;
} DRIVERITEM, *LPDRIVERITEM;
LRESULT DefDriverProc(DWORD dwDevID, HDRVR hDriv, UINT16 wMsg,
LRESULT DefDriverProc(DWORD dwDevID, HDRVR16 hDriv, UINT16 wMsg,
LPARAM dwParam1, LPARAM dwParam2);
HDRVR16 OpenDriver(LPSTR szDriverName, LPSTR szSectionName, LPARAM lParam2);
LRESULT CloseDriver(HDRVR16 hDriver, LPARAM lParam1, LPARAM lParam2);
......
/* kernel32.h - 95-09-14 Cameron Heide
*
* Win32 functions, structures, and types related to kernel functions
*/
#ifndef __WINE_KERNEL32_H
#define __WINE_KERNEL32_H
#include <stddef.h>
int KERN32_Init(void);
void SetLastError(DWORD error);
DWORD ErrnoToLastError(int errno_num);
void ExitProcess(DWORD exitcode);
/* Code page information.
*/
typedef struct {
DWORD MaxCharSize;
BYTE DefaultChar[2];
BYTE LeadBytes[5];
} CPINFO, *LPCPINFO;
/* The 'overlapped' data structure used by async I/O functions.
*/
typedef struct {
DWORD Internal;
DWORD InternalHigh;
DWORD Offset;
DWORD OffsetHigh;
HANDLE32 hEvent;
} OVERLAPPED, *LPOVERLAPPED;
/* Process startup information.
*/
typedef struct {
DWORD cb;
LPSTR lpReserved;
LPSTR lpDesktop;
LPSTR lpTitle;
DWORD dwX;
DWORD dwY;
DWORD dwXSize;
DWORD dwYSize;
DWORD dwXCountChars;
DWORD dwYCountChars;
DWORD dwFillAttribute;
DWORD dwFlags;
WORD wShowWindow;
WORD cbReserved2;
BYTE *lpReserved2;
HANDLE32 hStdInput;
HANDLE32 hStdOutput;
HANDLE32 hStdError;
} STARTUPINFO, *LPSTARTUPINFO;
typedef struct {
LONG Bias;
WCHAR StandardName[32];
SYSTEMTIME StandardDate;
LONG StandardBias;
WCHAR DaylightName[32];
SYSTEMTIME DaylightDate;
LONG DaylightBias;
} TIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION;
#define TIME_ZONE_ID_UNKNOWN 0
#define TIME_ZONE_ID_STANDARD 1
#define TIME_ZONE_ID_DAYLIGHT 2
/* File object type definitions
*/
#define FILE_TYPE_UNKNOWN 0
#define FILE_TYPE_DISK 1
#define FILE_TYPE_CHAR 2
#define FILE_TYPE_PIPE 3
#define FILE_TYPE_REMOTE 32768
/* File creation flags
*/
#define GENERIC_READ 0x80000000L
#define GENERIC_WRITE 0x40000000L
#define CREATE_NEW 1
#define CREATE_ALWAYS 2
#define OPEN_EXISTING 3
#define OPEN_ALWAYS 4
#define TRUNCATE_EXISTING 5
/* Standard handle identifiers
*/
#define STD_INPUT_HANDLE ((DWORD) -10)
#define STD_OUTPUT_HANDLE ((DWORD) -11)
#define STD_ERROR_HANDLE ((DWORD) -12)
typedef struct
{
int dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
int dwVolumeSerialNumber;
int nFileSizeHigh;
int nFileSizeLow;
int nNumberOfLinks;
int nFileIndexHigh;
int nFileIndexLow;
} BY_HANDLE_FILE_INFORMATION ;
/* File attribute flags
*/
#define FILE_ATTRIBUTE_ARCHIVE 0x0020
#define FILE_ATTRIBUTE_COMPRESSED 0x0800
#define FILE_ATTRIBUTE_DIRECTORY 0x0010
#define FILE_ATTRIBUTE_HIDDEN 0x0002
#define FILE_ATTRIBUTE_NORMAL 0x0080
#define FILE_ATTRIBUTE_READONLY 0x0001
#define FILE_ATTRIBUTE_SYSTEM 0x0004
#define FILE_ATTRIBUTE_TEMPORARY 0x0100
#define FILE_ATTRIBUTE_ATOMIC_WRITE 0x0200
#define FILE_ATTRIBUTE_XACTION_WRITE 0x0400
BOOL32 SetTimeZoneInformation(const TIME_ZONE_INFORMATION*);
#endif /* __WINE_KERNEL32_H */
......@@ -9,10 +9,10 @@
#include "wintypes.h"
#include "resource.h"
extern INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC hRsrc );
extern HGLOBAL LIBRES_AllocResource( HINSTANCE hModule, HRSRC hRsrc, DWORD size );
extern INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC32 hRsrc );
extern HGLOBAL32 LIBRES_AllocResource( HINSTANCE hModule, HRSRC32 hRsrc, DWORD size );
extern HRSRC32 LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type );
extern BOOL LIBRES_FreeResource( HGLOBAL handle );
extern BOOL LIBRES_FreeResource( HGLOBAL32 handle );
extern HGLOBAL32 LIBRES_LoadResource( HINSTANCE hModule, HRSRC32 hRsrc );
extern LPVOID LIBRES_LockResource( HGLOBAL32 handle );
extern DWORD LIBRES_SizeofResource( HINSTANCE hModule, HRSRC32 hRsrc );
......
......@@ -13,7 +13,7 @@
#define MFVERSION 0x300
#define META_EOF 0x0000
HMETAFILE MF_WriteRecord(HMETAFILE hmf, METARECORD *mr, WORD rlen);
HMETAFILE16 MF_WriteRecord(HMETAFILE16 hmf, METARECORD *mr, WORD rlen);
int MF_AddHandle(HANDLETABLE16 *ht, WORD htlen, HANDLE hobj);
int MF_AddHandleInternal(HANDLE hobj);
BOOL MF_MetaParam0(DC *dc, short func);
......
......@@ -170,7 +170,7 @@ typedef struct _OLESERVERDOCVTBL {
OLESTATUS (*GetObject)(LPOLESERVERDOC,OLE_LPCSTR,LPOLEOBJECT*,LPOLECLIENT);
OLESTATUS (*Release)(LPOLESERVERDOC);
OLESTATUS (*SetColorScheme)(LPOLESERVERDOC,LPLOGPALETTE);
OLESTATUS (*Execute)(LPOLESERVERDOC,HGLOBAL);
OLESTATUS (*Execute)(LPOLESERVERDOC,HGLOBAL16);
} OLESERVERDOCVTBL;
typedef OLESERVERDOCVTBL* LPOLESERVERDOCVTBL;
typedef struct _OLESERVERDOC {
......@@ -210,7 +210,7 @@ typedef struct _OLEOBJECTVTBL {
OLESTATUS (*DoVerb)(LPOLEOBJECT,UINT,BOOL,BOOL);
OLESTATUS (*GetData)(LPOLEOBJECT,OLECLIPFORMAT,HANDLE *);
OLESTATUS (*SetData)(LPOLEOBJECT,OLECLIPFORMAT,HANDLE);
OLESTATUS (*SetTargetDevice)(LPOLEOBJECT,HGLOBAL);
OLESTATUS (*SetTargetDevice)(LPOLEOBJECT,HGLOBAL16);
OLESTATUS (*SetBounds)(LPOLEOBJECT,LPRECT16);
OLESTATUS (*EnumFormats)(LPOLEOBJECT,OLECLIPFORMAT);
OLESTATUS (*SetColorScheme)(LPOLEOBJECT,LPLOGPALETTE);
......@@ -223,7 +223,7 @@ typedef struct _OLEOBJECTVTBL {
OLESTATUS (*CopyToClipBoard)(LPOLEOBJECT);
OLESTATUS (*Draw)(LPOLEOBJECT,HDC,LPRECT16,LPRECT16,HDC);
OLESTATUS (*Activate)(LPOLEOBJECT,UINT,BOOL,BOOL,HWND,LPRECT16);
OLESTATUS (*Execute)(LPOLEOBJECT,HGLOBAL,UINT);
OLESTATUS (*Execute)(LPOLEOBJECT,HGLOBAL16,UINT);
OLESTATUS (*Close)(LPOLEOBJECT);
OLESTATUS (*Update)(LPOLEOBJECT);
OLESTATUS (*Reconnect)(LPOLEOBJECT);
......
......@@ -68,6 +68,8 @@ typedef struct tagMESSAGEQUEUE
extern void QUEUE_DumpQueue( HQUEUE16 hQueue );
extern void QUEUE_WalkQueues(void);
extern HQUEUE16 QUEUE_GetDoomedQueue();
extern void QUEUE_SetDoomedQueue( HQUEUE16 hQueue );
extern MESSAGEQUEUE *QUEUE_GetSysQueue(void);
extern void QUEUE_SetWakeBit( MESSAGEQUEUE *queue, WORD bit );
extern void QUEUE_ClearWakeBit( MESSAGEQUEUE *queue, WORD bit );
......
......@@ -18,6 +18,7 @@ typedef struct
extern BOOL16 REGION_DeleteObject( HRGN32 hrgn, RGNOBJ * obj );
extern BOOL16 REGION_UnionRectWithRgn( HRGN32 hrgn, LPRECT16 lpRect );
extern BOOL16 REGION_FrameRgn( HRGN32 dest, HRGN32 src, INT32 x, INT32 y );
#endif /* __WINE_REGION_H */
......@@ -43,15 +43,16 @@ extern void LIBRES_RegisterResources(const struct resource* const * Res);
#define WINE_CONSTRUCTOR
#endif
extern int NE_AccessResource( HMODULE16 hModule, HRSRC hRsrc );
extern BOOL NE_FreeResource( HMODULE16 hModule, HGLOBAL handle );
extern HRSRC NE_FindResource( HMODULE16 hModule, SEGPTR typeId, SEGPTR resId );
extern DWORD NE_SizeofResource( HMODULE16 hModule, HRSRC hRsrc );
extern SEGPTR NE_LockResource( HMODULE16 hModule, HGLOBAL handle );
extern HGLOBAL NE_AllocResource( HMODULE16 hModule, HRSRC hRsrc, DWORD size );
extern HGLOBAL NE_LoadResource( HMODULE16 hModule, HRSRC hRsrc );
extern HANDLE SYSRES_LoadResource( SYSTEM_RESOURCE id );
extern void SYSRES_FreeResource( HANDLE handle );
extern int NE_AccessResource( HMODULE16 hModule, HRSRC16 hRsrc );
extern BOOL NE_FreeResource( HMODULE16 hModule, HGLOBAL16 handle );
extern HRSRC16 NE_FindResource(HMODULE16 hModule, SEGPTR typeId, SEGPTR resId);
extern DWORD NE_SizeofResource( HMODULE16 hModule, HRSRC16 hRsrc );
extern SEGPTR NE_LockResource( HMODULE16 hModule, HGLOBAL16 handle );
extern HGLOBAL16 NE_AllocResource( HMODULE16 hModule, HRSRC16 hRsrc,
DWORD size );
extern HGLOBAL16 NE_LoadResource( HMODULE16 hModule, HRSRC16 hRsrc );
extern HGLOBAL16 SYSRES_LoadResource( SYSTEM_RESOURCE id );
extern void SYSRES_FreeResource( HGLOBAL16 handle );
#endif /* __WINE_RESOURCE_H */
......@@ -16,5 +16,6 @@ extern WORD SELECTOR_AllocBlock( const void *base, DWORD size,
extern WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size,
enum seg_type type, BOOL32 is32bit,
BOOL32 readonly );
extern void SELECTOR_FreeBlock( WORD sel, WORD count );
#endif /* __WINE_SELECTORS_H */
......@@ -9,7 +9,8 @@
#include "windows.h"
#include "winreg.h"
extern INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon);
extern INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
HICON16 hIcon);
extern void SHELL_LoadRegistry();
extern void SHELL_SaveRegistry();
extern void SHELL_Init();
......
......@@ -12,9 +12,9 @@
/* Extra info for STATIC windows */
typedef struct
{
HFONT hFont; /* Control font (or 0 for system font) */
WORD dummy; /* Don't know what MS-Windows puts in there */
HICON hIcon; /* Icon handle for SS_ICON controls */
HFONT16 hFont; /* Control font (or 0 for system font) */
WORD dummy; /* Don't know what MS-Windows puts in there */
HICON16 hIcon; /* Icon handle for SS_ICON controls */
} STATICINFO;
extern LRESULT StaticWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam );
......
/*
* Status window definitions
*
* Copyright 1996 Bruce Milner
*/
#ifndef __WINE_STATUS_H
#define __WINE_STATUS_H
LRESULT StatusWindowProc( HWND32 hwnd, UINT32 msg,
WPARAM32 wParam, LPARAM lParam );
typedef struct
{
INT32 x;
INT32 style;
RECT32 bound;
LPSTR text;
} STATUSWINDOWPART;
typedef struct
{
UINT16 numParts;
UINT16 textHeight;
BOOL32 simple;
STATUSWINDOWPART part0; /* simple window */
STATUSWINDOWPART *parts;
} STATUSWINDOWINFO;
#endif /* __WINE_STATUS_H */
......@@ -88,6 +88,7 @@
#undef DEBUG_COMBO
#undef DEBUG_COMM
#undef DEBUG_COMMDLG
#undef DEBUG_CRTDLL
#undef DEBUG_CURSOR
#undef DEBUG_DC
#undef DEBUG_DDE
......@@ -165,6 +166,7 @@
#define DEBUG_COMBO
#define DEBUG_COMM
#define DEBUG_COMMDLG
#define DEBUG_CRTDLL
#define DEBUG_CURSOR
#define DEBUG_DC
#define DEBUG_DDE
......
......@@ -11,27 +11,27 @@
struct SysColorObjects
{
HBRUSH hbrushScrollbar; /* COLOR_SCROLLBAR */
/* COLOR_BACKGROUND */
HBRUSH hbrushActiveCaption; /* COLOR_ACTIVECAPTION */
HBRUSH hbrushInactiveCaption; /* COLOR_INACTIVECAPTION */
HBRUSH hbrushMenu; /* COLOR_MENU */
HBRUSH hbrushWindow; /* COLOR_WINDOW */
HPEN16 hpenWindowFrame; /* COLOR_WINDOWFRAME */
/* COLOR_MENUTEXT */
HPEN16 hpenWindowText; /* COLOR_WINDOWTEXT */
/* COLOR_CAPTIONTEXT */
HBRUSH hbrushActiveBorder; /* COLOR_ACTIVEBORDER */
HBRUSH hbrushInactiveBorder; /* COLOR_INACTIVEBORDER */
/* COLOR_APPWORKSPACE */
HBRUSH hbrushHighlight; /* COLOR_HIGHLIGHT */
/* COLOR_HIGHLIGHTTEXT */
HBRUSH hbrushBtnFace; /* COLOR_BTNFACE */
HBRUSH hbrushBtnShadow; /* COLOR_BTNSHADOW */
/* COLOR_GRAYTEXT */
/* COLOR_BTNTEXT */
/* COLOR_INACTIVECAPTIONTEXT */
HBRUSH hbrushBtnHighlight; /* COLOR_BTNHIGHLIGHT */
HBRUSH16 hbrushScrollbar; /* COLOR_SCROLLBAR */
/* COLOR_BACKGROUND */
HBRUSH16 hbrushActiveCaption; /* COLOR_ACTIVECAPTION */
HBRUSH16 hbrushInactiveCaption; /* COLOR_INACTIVECAPTION */
HBRUSH16 hbrushMenu; /* COLOR_MENU */
HBRUSH16 hbrushWindow; /* COLOR_WINDOW */
HPEN16 hpenWindowFrame; /* COLOR_WINDOWFRAME */
/* COLOR_MENUTEXT */
HPEN16 hpenWindowText; /* COLOR_WINDOWTEXT */
/* COLOR_CAPTIONTEXT */
HBRUSH16 hbrushActiveBorder; /* COLOR_ACTIVEBORDER */
HBRUSH16 hbrushInactiveBorder; /* COLOR_INACTIVEBORDER */
/* COLOR_APPWORKSPACE */
HBRUSH16 hbrushHighlight; /* COLOR_HIGHLIGHT */
/* COLOR_HIGHLIGHTTEXT */
HBRUSH16 hbrushBtnFace; /* COLOR_BTNFACE */
HBRUSH16 hbrushBtnShadow; /* COLOR_BTNSHADOW */
/* COLOR_GRAYTEXT */
/* COLOR_BTNTEXT */
/* COLOR_INACTIVECAPTIONTEXT */
HBRUSH16 hbrushBtnHighlight; /* COLOR_BTNHIGHLIGHT */
};
extern void SYSCOLOR_Init(void);
......
......@@ -135,28 +135,30 @@ DECL_WINELIB_TYPE_AW(OSVERSIONINFO);
typedef struct
{
DWORD FileAttributes;
FILETIME CreationTime;
FILETIME LastAccessTime;
FILETIME LastWriteTime;
DWORD FileSizeHigh;
DWORD FileSizeLow;
DWORD reserved[2];
CHAR FileName[260];
CHAR AlternateName[14];
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
CHAR cFileName[260];
CHAR cAlternateFileName[14];
} WIN32_FIND_DATA32A, *LPWIN32_FIND_DATA32A;
typedef struct
{
DWORD FileAttributes;
FILETIME CreationTime;
FILETIME LastAccessTime;
FILETIME LastWriteTime;
DWORD FileSizeHigh;
DWORD FileSizeLow;
DWORD reserved[2];
WCHAR FileName[260];
WCHAR AlternateName[14];
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
WCHAR cFileName[260];
WCHAR cAlternateName[14];
} WIN32_FIND_DATA32W, *LPWIN32_FIND_DATA32W;
DECL_WINELIB_TYPE_AW(WIN32_FIND_DATA);
......
......@@ -116,13 +116,13 @@ typedef UINT32 *LPUINT32;
typedef HKEY *LPHKEY;
typedef HMIXEROBJ *LPHMIXEROBJ;
/* Special case: a segmented pointer is just a pointer in the library. */
/* Special case: a segmented pointer is just a pointer in the user's code. */
#ifdef WINELIB
typedef void* SEGPTR;
#else /* WINELIB */
#ifdef __WINE__
typedef DWORD SEGPTR;
#endif /* WINELIB */
#else
typedef void* SEGPTR;
#endif /* __WINE__ */
/* Handle types that exist both in Win16 and Win32. */
......
......@@ -55,7 +55,7 @@ int debug_last_handle_size= 0; /* for debugging purpose only */
* h - the handle.
* RETURN: pointer to handle info.
*/
static struct handle_info *locate_handle(HGLOBAL h, struct local_shm_map *map)
static struct handle_info *locate_handle(HGLOBAL16 h, struct local_shm_map *map)
{
struct shm_block *block;
......@@ -79,7 +79,7 @@ static struct handle_info *locate_handle(HGLOBAL h, struct local_shm_map *map)
}
/* dde_alloc_handle: allocate shared DDE handle */
static HGLOBAL dde_alloc_handle()
static HGLOBAL16 dde_alloc_handle()
{
int bit_nr;
......@@ -101,7 +101,7 @@ DDE_malloc(unsigned int flags, unsigned long size, SHMDATA *shmdata)
struct shm_block *block;
struct handle_info *h_info;
struct local_shm_map *curr;
HGLOBAL handle;
HGLOBAL16 handle;
dprintf_global(stddeb,"DDE_malloc flags %4X, size %ld\n", flags, size);
DDE_IPC_init(); /* make sure main shm block allocated */
......@@ -167,7 +167,7 @@ DDE_malloc(unsigned int flags, unsigned long size, SHMDATA *shmdata)
return (char *)HINFO2DATAPTR(h_info);
}
HGLOBAL DDE_GlobalFree(HGLOBAL h)
HGLOBAL16 DDE_GlobalFree(HGLOBAL16 h)
{
struct handle_info *h_info;
int handle_index= h & 0x7fff;
......@@ -193,7 +193,7 @@ HGLOBAL DDE_GlobalFree(HGLOBAL h)
return 0;
}
WORD DDE_SyncHandle(HGLOBAL handle, WORD sel)
WORD DDE_SyncHandle(HGLOBAL16 handle, WORD sel)
{
struct handle_info *h_info;
......@@ -228,12 +228,12 @@ WORD DDE_SyncHandle(HGLOBAL handle, WORD sel)
* 32 bit pointer to the memory.
*/
void *DDE_AttachHandle(HGLOBAL handle, SEGPTR *segptr)
void *DDE_AttachHandle(HGLOBAL16 handle, SEGPTR *segptr)
{
struct handle_info *h_info;
SHMDATA shmdata;
void *ptr;
HGLOBAL hOwner = GetCurrentPDB();
HGLOBAL16 hOwner = GetCurrentPDB();
assert(is_dde_handle(handle));
if (segptr != NULL)
......
......@@ -75,8 +75,8 @@ WORD FreeSelector(WORD a)
}
/* stub that partially emulates the true GLOBAL_CreateBlock function */
HGLOBAL GLOBAL_CreateBlock( WORD flags, void *ptr, DWORD size,
HGLOBAL hOwner, BOOL isCode,
HGLOBAL16 GLOBAL_CreateBlock( WORD flags, void *ptr, DWORD size,
HGLOBAL16 hOwner, BOOL isCode,
BOOL is32Bit, BOOL isReadOnly,
SHMDATA *shmdata )
{
......
......@@ -99,7 +99,7 @@ LPVOID LIBRES_LockResource( HGLOBAL32 handle )
/**********************************************************************
* LIBRES_FreeResource
*/
BOOL LIBRES_FreeResource( HGLOBAL handle )
BOOL LIBRES_FreeResource( HGLOBAL32 handle )
{
return 0; /* Obsolete in Win32 */
}
......@@ -108,7 +108,7 @@ BOOL LIBRES_FreeResource( HGLOBAL handle )
/**********************************************************************
* LIBRES_AccessResource
*/
INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC hRsrc )
INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC32 hRsrc )
{
WINELIB_UNIMP("LIBRES_AccessResource()");
return -1; /* Obsolete in Win32 */
......@@ -127,7 +127,7 @@ DWORD LIBRES_SizeofResource( HINSTANCE hModule, HRSRC32 hRsrc )
/**********************************************************************
* LIBRES_AllocResource
*/
HGLOBAL LIBRES_AllocResource( HINSTANCE hModule, HRSRC hRsrc, DWORD size )
HGLOBAL32 LIBRES_AllocResource( HINSTANCE hModule, HRSRC32 hRsrc, DWORD size )
{
WINELIB_UNIMP("LIBRES_AllocResource()");
return 0; /* Obsolete in Win32 */
......
......@@ -16,7 +16,6 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "comm.h"
#include "win.h"
#include "menu.h"
#include "kernel32.h"
#include "atom.h"
#include "dialog.h"
#include "directory.h"
......@@ -59,6 +58,7 @@ int MAIN_Init(void)
extern BOOL32 RELAY_Init(void);
extern BOOL32 SIGNAL_Init(void);
extern BOOL32 WIDGETS_Init(void);
extern int KERN32_Init(void);
int queueSize;
......
......@@ -20,6 +20,7 @@
#include "arch.h"
#include "selectors.h"
#include "callback.h"
#include "file.h"
#include "module.h"
#include "stackframe.h"
#include "stddebug.h"
......
......@@ -35,7 +35,7 @@ static DWORD NE_FindNameTableId( HMODULE16 hModule, SEGPTR typeId, SEGPTR resId
NE_MODULE *pModule;
NE_TYPEINFO *pTypeInfo;
NE_NAMEINFO *pNameInfo;
HGLOBAL handle;
HGLOBAL16 handle;
WORD *p;
DWORD ret = 0;
int count;
......@@ -101,8 +101,8 @@ static DWORD NE_FindNameTableId( HMODULE16 hModule, SEGPTR typeId, SEGPTR resId
*
* Find a resource once the type info structure has been found.
*/
static HRSRC NE_FindResourceFromType( NE_MODULE *pModule,
NE_TYPEINFO *pTypeInfo, SEGPTR resId )
static HRSRC16 NE_FindResourceFromType( NE_MODULE *pModule,
NE_TYPEINFO *pTypeInfo, SEGPTR resId )
{
BYTE *p;
int count;
......@@ -117,7 +117,7 @@ static HRSRC NE_FindResourceFromType( NE_MODULE *pModule,
if (pNameInfo->id & 0x8000) continue;
p = (BYTE *)pModule + pModule->res_table + pNameInfo->id;
if ((*p == len) && !lstrncmpi32A( p+1, str, len ))
return (HRSRC)((int)pNameInfo - (int)pModule);
return (HRSRC16)((int)pNameInfo - (int)pModule);
}
}
else /* Numeric resource id */
......@@ -125,7 +125,7 @@ static HRSRC NE_FindResourceFromType( NE_MODULE *pModule,
WORD id = LOWORD(resId) | 0x8000;
for (count = pTypeInfo->count; count > 0; count--, pNameInfo++)
if (pNameInfo->id == id)
return (HRSRC)((int)pNameInfo - (int)pModule);
return (HRSRC16)((int)pNameInfo - (int)pModule);
}
return 0;
}
......@@ -134,10 +134,10 @@ static HRSRC NE_FindResourceFromType( NE_MODULE *pModule,
/***********************************************************************
* NE_FindResource
*/
HRSRC NE_FindResource( HMODULE16 hModule, SEGPTR typeId, SEGPTR resId )
HRSRC16 NE_FindResource( HMODULE16 hModule, SEGPTR typeId, SEGPTR resId )
{
NE_TYPEINFO *pTypeInfo;
HRSRC hRsrc;
HRSRC16 hRsrc;
NE_MODULE *pModule = MODULE_GetPtr( hModule );
if (!pModule || !pModule->res_table) return 0;
......@@ -211,7 +211,7 @@ HRSRC NE_FindResource( HMODULE16 hModule, SEGPTR typeId, SEGPTR resId )
/***********************************************************************
* NE_AllocResource
*/
HGLOBAL NE_AllocResource( HMODULE16 hModule, HRSRC hRsrc, DWORD size )
HGLOBAL16 NE_AllocResource( HMODULE16 hModule, HRSRC16 hRsrc, DWORD size )
{
NE_NAMEINFO *pNameInfo=NULL;
WORD sizeShift;
......@@ -231,7 +231,7 @@ HGLOBAL NE_AllocResource( HMODULE16 hModule, HRSRC hRsrc, DWORD size )
/***********************************************************************
* NE_AccessResource
*/
int NE_AccessResource( HMODULE16 hModule, HRSRC hRsrc )
int NE_AccessResource( HMODULE16 hModule, HRSRC16 hRsrc )
{
NE_NAMEINFO *pNameInfo=NULL;
int fd;
......@@ -254,7 +254,7 @@ int NE_AccessResource( HMODULE16 hModule, HRSRC hRsrc )
/***********************************************************************
* NE_SizeofResource
*/
DWORD NE_SizeofResource( HMODULE16 hModule, HRSRC hRsrc )
DWORD NE_SizeofResource( HMODULE16 hModule, HRSRC16 hRsrc )
{
NE_NAMEINFO *pNameInfo=NULL;
WORD sizeShift;
......@@ -272,7 +272,7 @@ DWORD NE_SizeofResource( HMODULE16 hModule, HRSRC hRsrc )
/***********************************************************************
* NE_LoadResource
*/
HGLOBAL NE_LoadResource( HMODULE16 hModule, HRSRC hRsrc )
HGLOBAL16 NE_LoadResource( HMODULE16 hModule, HRSRC16 hRsrc )
{
NE_NAMEINFO *pNameInfo=NULL;
WORD sizeShift;
......@@ -307,7 +307,7 @@ HGLOBAL NE_LoadResource( HMODULE16 hModule, HRSRC hRsrc )
/***********************************************************************
* NE_LockResource
*/
SEGPTR NE_LockResource( HMODULE16 hModule, HGLOBAL handle )
SEGPTR NE_LockResource( HMODULE16 hModule, HGLOBAL16 handle )
{
/* May need to reload the resource if discarded */
......@@ -318,7 +318,7 @@ SEGPTR NE_LockResource( HMODULE16 hModule, HGLOBAL handle )
/***********************************************************************
* NE_FreeResource
*/
BOOL NE_FreeResource( HMODULE16 hModule, HGLOBAL handle )
BOOL NE_FreeResource( HMODULE16 hModule, HGLOBAL16 handle )
{
NE_TYPEINFO *pTypeInfo;
NE_NAMEINFO *pNameInfo;
......
......@@ -15,7 +15,6 @@
#include <sys/types.h>
#include "wintypes.h"
#include "windows.h"
#include "kernel32.h"
#include "pe_image.h"
#include "module.h"
#include "handle32.h"
......@@ -29,8 +28,6 @@
#include "stddebug.h"
#include "debug.h"
int language = 0x0409;
#define PrintIdA(name) \
if (HIWORD((DWORD)name)) \
dprintf_resource( stddeb, "'%s'", name); \
......@@ -116,9 +113,11 @@ PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA(PIMAGE_RESOURCE_DIRECTORY resdirptr,
}
/**********************************************************************
* PE_FindResource32W
* PE_FindResourceEx32W
*/
HANDLE32 PE_FindResource32W( HINSTANCE hModule, LPCWSTR name, LPCWSTR type )
HANDLE32 PE_FindResourceEx32W(
HINSTANCE hModule, LPCWSTR name, LPCWSTR type, WORD lang
)
{
PE_MODULE *pe;
NE_MODULE *pModule;
......@@ -142,7 +141,7 @@ HANDLE32 PE_FindResource32W( HINSTANCE hModule, LPCWSTR name, LPCWSTR type )
return 0;
if ((resdirptr = GetResDirEntryW(resdirptr, name, root)) == NULL)
return 0;
result = (HANDLE32)GetResDirEntryW(resdirptr, (LPCWSTR)language, root);
result = (HANDLE32)GetResDirEntryW(resdirptr, (LPCWSTR)(UINT32)lang, root);
/* Try LANG_NEUTRAL, too */
if(!result)
return (HANDLE32)GetResDirEntryW(resdirptr, (LPCWSTR)0, root);
......
......@@ -32,6 +32,7 @@
else \
dprintf_resource( stddeb, "#%04x", LOWORD(name));
extern WORD WINE_LanguageId;
/**********************************************************************
* FindResource16 (KERNEL.60)
......@@ -72,6 +73,15 @@ HRSRC16 FindResource16( HMODULE16 hModule, SEGPTR name, SEGPTR type )
*/
HANDLE32 FindResource32A( HINSTANCE32 hModule, LPCSTR name, LPCSTR type )
{
return FindResourceEx32A(hModule,name,type,WINE_LanguageId);
}
/**********************************************************************
* FindResourceEx32A (KERNEL32.129)
*/
HANDLE32 FindResourceEx32A(
HINSTANCE32 hModule,LPCSTR name,LPCSTR type,WORD lang
) {
LPWSTR xname,xtype;
HANDLE32 ret;
......@@ -79,7 +89,7 @@ HANDLE32 FindResource32A( HINSTANCE32 hModule, LPCSTR name, LPCSTR type )
else xname = (LPWSTR)name;
if (HIWORD((DWORD)type)) xtype = STRING32_DupAnsiToUni(type);
else xtype = (LPWSTR)type;
ret = FindResource32W(hModule,xname,xtype);
ret = FindResourceEx32W(hModule,xname,xtype,lang);
if (HIWORD((DWORD)name)) free(xname);
if (HIWORD((DWORD)type)) free(xtype);
return ret;
......@@ -87,16 +97,14 @@ HANDLE32 FindResource32A( HINSTANCE32 hModule, LPCSTR name, LPCSTR type )
/**********************************************************************
* FindResource32W (KERNEL32.131)
* FindResourceEx32W (KERNEL32.130)
*/
HRSRC32 FindResource32W( HINSTANCE32 hModule, LPCWSTR name, LPCWSTR type )
{
HRSRC32 FindResourceEx32W(
HINSTANCE32 hModule, LPCWSTR name, LPCWSTR type, WORD lang
) {
#ifndef WINELIB
NE_MODULE *pModule;
/* Sometimes we get passed hModule = 0x00000000. FIXME: is GetTaskDS()
* ok?
*/
if (!hModule) hModule = GetTaskDS();
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "FindResource32W: module=%08x type=", hModule );
......@@ -106,12 +114,20 @@ HRSRC32 FindResource32W( HINSTANCE32 hModule, LPCWSTR name, LPCWSTR type )
dprintf_resource( stddeb, "\n" );
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
if (!(pModule->flags & NE_FFLAGS_WIN32)) return 0;
return PE_FindResource32W(hModule,name,type);
return PE_FindResourceEx32W(hModule,name,type,lang);
#else
return LIBRES_FindResource( hModule, name, type );
#endif
}
/**********************************************************************
* FindResource32W (KERNEL32.131)
*/
HRSRC32 FindResource32W( HINSTANCE32 hModule, LPCWSTR name, LPCWSTR type )
{
return FindResourceEx32W(hModule,name,type,WINE_LanguageId);
}
/**********************************************************************
* LoadResource16 (KERNEL.61)
......@@ -642,11 +658,121 @@ LoadString32W(HINSTANCE32 instance,UINT32 resource_id,LPWSTR buffer,int buflen)
INT32
LoadString32A(HINSTANCE32 instance,UINT32 resource_id,LPSTR buffer,int buflen)
{
LPWSTR buffer2 = (LPWSTR)xmalloc(buflen*2);
LPWSTR buffer2 = buffer?(LPWSTR)xmalloc(buflen*2):NULL;
INT32 retval = LoadString32W(instance,resource_id,buffer2,buflen);
STRING32_UniToAnsi(buffer,buffer2);
free(buffer2);
if (buffer) {
STRING32_UniToAnsi(buffer,buffer2);
free(buffer2);
}
return retval;
}
/* Messages...used by FormatMessage32* (KERNEL32.something)
*
* They can be specified either directly or using a message ID and
* loading them from the resource.
*
* The resourcedata has following format:
* start:
* 0: DWORD nrofentries
* nrofentries * subentry:
* 0: DWORD firstentry
* 4: DWORD lastentry
* 8: DWORD offset from start to the stringentries
*
* (lastentry-firstentry) * stringentry:
* 0: WORD len (0 marks end)
* 2: WORD unknown (flags?)
* 4: CHAR[len-4]
* (stringentry i of a subentry refers to the ID 'firstentry+i')
*
* Yes, ANSI strings in win32 resources. Go figure.
*/
/**********************************************************************
* LoadMessage32A (internal)
*/
INT32
LoadMessage32A(
HINSTANCE32 instance,UINT32 id,WORD lang,LPSTR buffer,int buflen
) {
HGLOBAL32 hmem;
HRSRC32 hrsrc;
BYTE *p;
int nrofentries,i,slen;
struct _subentry {
DWORD firstentry;
DWORD lastentry;
DWORD offset;
} *se;
struct _stringentry {
WORD len;
WORD unknown;
CHAR str[1];
} *stre;
dprintf_resource(stddeb, "LoadMessage: instance = %04x, id = %04x, buffer = %08x, "
"length = %d\n", instance, (int)id, (int) buffer, buflen);
/*FIXME: I am not sure about the '1' ... But I've only seen those entries*/
hrsrc = FindResourceEx32W(instance,(LPWSTR)1,(LPCWSTR)RT_MESSAGELIST,lang);
if (!hrsrc) return 0;
hmem = LoadResource32( instance, hrsrc );
if (!hmem) return 0;
p = LockResource32(hmem);
nrofentries = *(DWORD*)p;
stre = NULL;
se = (struct _subentry*)(p+4);
for (i=nrofentries;i--;) {
if ((id>=se->firstentry) && (id<se->lastentry)) {
stre = (struct _stringentry*)(p+se->offset);
id -= se->firstentry;
break;
}
se++;
}
if (!stre)
return 0;
for (i=id;i--;) {
if (!(slen=stre->len))
return 0;
stre = (struct _stringentry*)(((char*)stre)+slen);
}
slen=stre->len;
dprintf_resource(stddeb," - strlen=%d\n",slen);
i = MIN(buflen - 1, slen);
if (buffer == NULL)
return slen; /* different to LoadString */
if (i>0) {
lstrcpyn32A(buffer,stre->str,i);
buffer[i]=0;
} else {
if (buflen>1) {
buffer[0]=0;
return 0;
}
}
if (buffer)
dprintf_resource(stddeb,"LoadMessage // '%s' copied !\n", buffer);
return i;
}
/**********************************************************************
* LoadMessage32W (internal)
*/
INT32
LoadMessage32W(
HINSTANCE32 instance,UINT32 id,WORD lang,LPWSTR buffer,int buflen
) {
LPSTR buffer2 = buffer?(LPSTR)xmalloc(buflen):NULL;
INT32 retval = LoadMessage32A(instance,id,lang,buffer2,buflen);
if (buffer) {
STRING32_AnsiToUni(buffer,buffer2);
free(buffer2);
}
return retval;
}
......@@ -38,7 +38,7 @@
/* Must not be greater than 64k, or MAKE_SEGPTR won't work */
#define STACK32_SIZE 0x10000
extern void USER_AppExit(HTASK, HINSTANCE, HQUEUE );
extern void USER_AppExit( HTASK16, HINSTANCE16, HQUEUE16 );
/* Saved 16-bit stack for current process (Win16 only) */
WORD IF1632_Saved16_ss = 0;
......@@ -254,7 +254,7 @@ static void TASK_UnlinkTask( HTASK16 hTask )
* Create a thunk free-list in segment 'handle', starting from offset 'offset'
* and containing 'count' entries.
*/
static void TASK_CreateThunks( HGLOBAL handle, WORD offset, WORD count )
static void TASK_CreateThunks( HGLOBAL16 handle, WORD offset, WORD count )
{
int i;
WORD free;
......@@ -1030,9 +1030,9 @@ HANDLE GetCodeHandle( FARPROC16 proc )
/***********************************************************************
* SetTaskQueue (KERNEL.34)
*/
HQUEUE SetTaskQueue( HANDLE hTask, HQUEUE hQueue )
HQUEUE16 SetTaskQueue( HTASK16 hTask, HQUEUE16 hQueue )
{
HQUEUE hPrev;
HQUEUE16 hPrev;
TDB *pTask;
if (!hTask) hTask = hCurrentTask;
......
......@@ -111,7 +111,7 @@ HGLOBAL16 GLOBAL_CreateBlock( WORD flags, const void *ptr, DWORD size,
if (!(pArena = GLOBAL_GetArena( sel, selcount )))
{
FreeSelector( sel );
SELECTOR_FreeBlock( sel, selcount );
return 0;
}
......@@ -159,11 +159,13 @@ HGLOBAL16 GLOBAL_CreateBlock( WORD flags, const void *ptr, DWORD size,
BOOL16 GLOBAL_FreeBlock( HGLOBAL16 handle )
{
WORD sel;
GLOBALARENA *pArena;
if (!handle) return TRUE;
sel = GlobalHandleToSel( handle );
if (FreeSelector( sel )) return FALSE; /* failed */
memset( GET_ARENA_PTR(sel), 0, sizeof(GLOBALARENA) );
sel = GlobalHandleToSel( handle );
pArena = GET_ARENA_PTR(sel);
SELECTOR_FreeBlock( sel, (pArena->size + 0xffff) / 0x10000 );
memset( pArena, 0, sizeof(GLOBALARENA) );
return TRUE;
}
......@@ -226,7 +228,7 @@ HGLOBAL16 GLOBAL_Alloc( UINT16 flags, DWORD size, HGLOBAL16 hOwner,
* Find the arena for a given handle
* (when handle is not serial - e.g. DDE)
*/
static GLOBALARENA *GLOBAL_FindArena( HGLOBAL handle)
static GLOBALARENA *GLOBAL_FindArena( HGLOBAL16 handle)
{
int i;
for (i = globalArenaSize-1 ; i>=0 ; i--) {
......@@ -241,7 +243,7 @@ static GLOBALARENA *GLOBAL_FindArena( HGLOBAL handle)
* DDE_GlobalHandleToSel
*/
WORD DDE_GlobalHandleToSel( HGLOBAL handle )
WORD DDE_GlobalHandleToSel( HGLOBAL16 handle )
{
GLOBALARENA *pArena;
SEGPTR segptr;
......@@ -341,7 +343,7 @@ HGLOBAL16 GlobalReAlloc16( HGLOBAL16 handle, DWORD size, UINT16 flags )
ptr = HeapReAlloc( SystemHeap, 0, ptr, size );
if (!ptr)
{
FreeSelector( sel );
SELECTOR_FreeBlock( sel, (oldsize + 0xffff) / 0x10000 );
memset( pArena, 0, sizeof(GLOBALARENA) );
return 0;
}
......@@ -360,7 +362,7 @@ HGLOBAL16 GlobalReAlloc16( HGLOBAL16 handle, DWORD size, UINT16 flags )
if (!(pNewArena = GLOBAL_GetArena( sel, selcount )))
{
HeapFree( SystemHeap, 0, ptr );
FreeSelector( sel );
SELECTOR_FreeBlock( sel, selcount );
return 0;
}
......
......@@ -10,7 +10,6 @@
#include <string.h>
#include "windows.h"
#include "debugger.h"
#include "kernel32.h" /* for CRITICAL_SECTION */
#include "selectors.h"
#include "winbase.h"
#include "winerror.h"
......
......@@ -64,31 +64,8 @@ WORD AllocSelector( WORD sel )
*/
WORD FreeSelector( WORD sel )
{
WORD i, count, nextsel;
ldt_entry entry;
STACK16FRAME *frame;
dprintf_selector( stddeb, "FreeSelector(%04x)\n", sel );
if (IS_SELECTOR_FREE(sel)) return sel; /* error */
count = (GET_SEL_LIMIT(sel) >> 16) + 1;
sel &= ~(__AHINCR - 1); /* clear bottom bits of selector */
nextsel = sel + (count << __AHSHIFT);
memset( &entry, 0, sizeof(entry) ); /* clear the LDT entries */
/* FIXME: is it correct to free the whole array? */
for (i = SELECTOR_TO_ENTRY(sel); count; i++, count--)
{
LDT_SetEntry( i, &entry );
ldt_flags_copy[i] &= ~LDT_FLAGS_ALLOCATED;
}
/* Clear the saved 16-bit selector */
frame = CURRENT_STACK16;
while (frame)
{
if ((frame->ds >= sel) && (frame->ds < nextsel)) frame->ds = 0;
if ((frame->es >= sel) && (frame->es < nextsel)) frame->es = 0;
frame = PTR_SEG_OFF_TO_LIN(frame->saved_ss, frame->saved_sp);
}
SELECTOR_FreeBlock( sel, 1 );
return 0;
}
......@@ -147,6 +124,38 @@ WORD SELECTOR_AllocBlock( const void *base, DWORD size, enum seg_type type,
/***********************************************************************
* SELECTOR_FreeBlock
*
* Free a block of selectors.
*/
void SELECTOR_FreeBlock( WORD sel, WORD count )
{
WORD i, nextsel;
ldt_entry entry;
STACK16FRAME *frame;
dprintf_selector( stddeb, "SELECTOR_FreeBlock(%04x,%d)\n", sel, count );
sel &= ~(__AHINCR - 1); /* clear bottom bits of selector */
nextsel = sel + (count << __AHSHIFT);
memset( &entry, 0, sizeof(entry) ); /* clear the LDT entries */
for (i = SELECTOR_TO_ENTRY(sel); count; i++, count--)
{
LDT_SetEntry( i, &entry );
ldt_flags_copy[i] &= ~LDT_FLAGS_ALLOCATED;
}
/* Clear the saved 16-bit selector */
frame = CURRENT_STACK16;
while (frame)
{
if ((frame->ds >= sel) && (frame->ds < nextsel)) frame->ds = 0;
if ((frame->es >= sel) && (frame->es < nextsel)) frame->es = 0;
frame = PTR_SEG_OFF_TO_LIN(frame->saved_ss, frame->saved_sp);
}
}
/***********************************************************************
* SELECTOR_ReallocBlock
*
* Change the size of a block of selectors.
......@@ -155,7 +164,6 @@ WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size,
enum seg_type type, BOOL32 is32bit, BOOL32 readonly)
{
WORD i, oldcount, newcount;
ldt_entry entry;
if (!size) size = 1;
oldcount = (GET_SEL_LIMIT(sel) >> 16) + 1;
......@@ -171,7 +179,7 @@ WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size,
if (i < newcount) /* they are not free */
{
FreeSelector( sel );
SELECTOR_FreeBlock( sel, oldcount );
sel = AllocSelectorArray( newcount );
}
else /* mark the selectors as allocated */
......@@ -182,12 +190,8 @@ WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size,
}
else if (oldcount > newcount) /* We need to remove selectors */
{
memset( &entry, 0, sizeof(entry) ); /* clear the LDT entries */
for (i = oldcount; i < newcount; i++)
{
LDT_SetEntry( SELECTOR_TO_ENTRY(sel) + i, &entry );
ldt_flags_copy[SELECTOR_TO_ENTRY(sel) + i] &= ~LDT_FLAGS_ALLOCATED;
}
SELECTOR_FreeBlock( ENTRY_TO_SELECTOR(SELECTOR_TO_ENTRY(sel)+newcount),
oldcount - newcount );
}
if (sel) SELECTOR_SetEntries( sel, base, size, type, is32bit, readonly );
return sel;
......
......@@ -7,6 +7,7 @@ C_SRCS = \
comm.c \
commdlg.c \
compobj.c \
crtdll.c \
driver.c \
exec.c \
escape.c \
......
......@@ -1571,7 +1571,7 @@ static void CC_PrepareColorGraph(HWND hDlg)
HBRUSH hbrush;
HDC hdc ;
RECT16 rect,client;
HCURSOR hcursor=SetCursor(LoadCursor16(0,IDC_WAIT));
HCURSOR16 hcursor=SetCursor(LoadCursor16(0,IDC_WAIT));
GetClientRect16(hwnd,&client);
hdc=GetDC(hwnd);
......@@ -2383,7 +2383,7 @@ LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam)
int i,j,res,init=0;
long l;
LPLOGFONT16 lpxx;
HCURSOR hcursor=SetCursor(LoadCursor16(0,IDC_WAIT));
HCURSOR16 hcursor=SetCursor(LoadCursor16(0,IDC_WAIT));
LPCHOOSEFONT lpcf;
SetWindowLong32A(hDlg, DWL_USER, lParam);
......@@ -2635,7 +2635,7 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam)
i=SendDlgItemMessage16(hDlg,cmb1,CB_GETCURSEL,0,0);
if (i!=CB_ERR)
{
HCURSOR hcursor=SetCursor(LoadCursor16(0,IDC_WAIT));
HCURSOR16 hcursor=SetCursor(LoadCursor16(0,IDC_WAIT));
SendDlgItemMessage16(hDlg,cmb1,CB_GETLBTEXT,i,(LPARAM)MAKE_SEGPTR(buffer));
dprintf_commdlg(stddeb,"WM_COMMAND/cmb1 =>%s\n",buffer);
EnumFontFamilies(hdc,buffer,FontStyleEnumProc,
......
/*
* The C RunTime DLL
*
* Implements C run-time functionality as known from UNIX.
*
* Copyright 1996 Marcus Meissner
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <ctype.h>
#include "win.h"
#include "windows.h"
#include "stddebug.h"
#include "debug.h"
#include "module.h"
#include "callback.h"
#include "xmalloc.h"
UINT32 CRTDLL_argc_dll; /* CRTDLL.23 */
LPSTR *CRTDLL_argv_dll; /* CRTDLL.24 */
LPSTR CRTDLL_acmdln_dll; /* CRTDLL.38 */
UINT32 CRTDLL_basemajor_dll; /* CRTDLL.42 */
UINT32 CRTDLL_baseminor_dll; /* CRTDLL.43 */
UINT32 CRTDLL_baseversion_dll; /* CRTDLL.44 */
LPSTR CRTDLL_environ_dll; /* CRTDLL.75 */
UINT32 CRTDLL_osmajor_dll; /* CRTDLL.241 */
UINT32 CRTDLL_osminor_dll; /* CRTDLL.242 */
UINT32 CRTDLL_osver_dll; /* CRTDLL.244 */
UINT32 CRTDLL_osversion_dll; /* CRTDLL.245 */
UINT32 CRTDLL_winmajor_dll; /* CRTDLL.329 */
UINT32 CRTDLL_winminor_dll; /* CRTDLL.330 */
UINT32 CRTDLL_winver_dll; /* CRTDLL.331 */
DWORD
CRTDLL__GetMainArgs(LPDWORD argc,LPSTR **argv,LPSTR *environ,DWORD flag)
{
char *cmdline;
char **xargv;
int xargc,i,afterlastspace;
DWORD version;
dprintf_crtdll(stderr,"__GetMainArgs(%p,%p,%p,%ld).\n",
argc,argv,environ,flag
);
CRTDLL_acmdln_dll = cmdline = xstrdup( GetCommandLine32A() );
version = GetVersion32();
CRTDLL_osver_dll = version >> 16;
CRTDLL_winminor_dll = version & 0xFF;
CRTDLL_winmajor_dll = (version>>8) & 0xFF;
CRTDLL_baseversion_dll = version >> 16;
CRTDLL_winver_dll = ((version >> 8) & 0xFF) + ((version & 0xFF) << 8);
CRTDLL_baseminor_dll = (version >> 16) & 0xFF;
CRTDLL_basemajor_dll = (version >> 24) & 0xFF;
CRTDLL_osversion_dll = version & 0xFFFF;
CRTDLL_osminor_dll = version & 0xFF;
CRTDLL_osmajor_dll = (version>>8) & 0xFF;
/* missing heapinit */
/* missing threading init */
i=0;xargv=NULL;xargc=0;afterlastspace=0;
while (cmdline[i]) {
if (cmdline[i]==' ') {
xargv=(char**)xrealloc(xargv,sizeof(char*)*(++xargc));
cmdline[i]='\0';
xargv[xargc-1] = xstrdup(cmdline+afterlastspace);
i++;
while (cmdline[i]==' ')
i++;
if (cmdline[i])
afterlastspace=i;
} else
i++;
}
xargv=(char**)xrealloc(xargv,sizeof(char*)*(++xargc));
cmdline[i]='\0';
xargv[xargc-1] = xstrdup(cmdline+afterlastspace);
CRTDLL_argc_dll = xargc;
*argc = xargc;
CRTDLL_argv_dll = xargv;
*argv = xargv;
/* FIXME ... use real environment */
*environ = xmalloc(sizeof(LPSTR));
CRTDLL_environ_dll = *environ;
(*environ)[0] = NULL;
return 0;
}
typedef void (*_INITTERMFUN)();
DWORD
CRTDLL__initterm(_INITTERMFUN *start,_INITTERMFUN *end)
{
_INITTERMFUN *current;
dprintf_crtdll(stddeb,"_initterm(%p,%p)\n",start,end);
current=start;
while (current<end) {
if (*current)
_InitTermProc(*current);
current++;
}
return 0;
}
void
CRTDLL_srand(DWORD seed) {
/* FIXME: should of course be thread? process? local */
srand(seed);
}
int
CRTDLL_fprintf(DWORD *args) {
/* FIXME: use args[0] */
return vfprintf(stderr,(LPSTR)(args[1]),args+2);
}
int
CRTDLL_printf(DWORD *args) {
return vfprintf(stdout,(LPSTR)(args[0]),args+1);
}
time_t
CRTDLL_time(time_t *timeptr) {
time_t curtime = time(NULL);
if (timeptr)
*timeptr = curtime;
return curtime;
}
BOOL32
CRTDLL__isatty(DWORD x) {
dprintf_crtdll(stderr,"CRTDLL__isatty(%ld)\n",x);
return TRUE;
}
INT32
CRTDLL__write(DWORD x,LPVOID buf,DWORD len) {
if (x<=2)
return write(x,buf,len);
/* hmm ... */
dprintf_crtdll(stderr,"CRTDLL__write(%ld,%p,%ld)\n",x,buf,len);
return len;
}
void
CRTDLL_exit(DWORD ret) {
dprintf_crtdll(stderr,"CRTDLL_exit(%ld)\n",ret);
ExitProcess(ret);
}
void
CRTDLL_fflush(DWORD x) {
dprintf_crtdll(stderr,"CRTDLL_fflush(%ld)\n",x);
}
/* BAD, for the whole WINE process blocks... just done this way to test
* windows95's ftp.exe.
*/
LPSTR
CRTDLL_gets(LPSTR buf) {
return gets(buf);
}
CHAR
CRTDLL_toupper(CHAR x) {
return toupper(x);
}
void
CRTDLL_putchar(INT32 x) {
putchar(x);
}
......@@ -211,7 +211,7 @@ HMODULE16 GetDriverModuleHandle(HDRVR16 hDrvr)
/**************************************************************************
* DefDriverProc [USER.255]
*/
LRESULT DefDriverProc(DWORD dwDevID, HDRVR hDriv, UINT16 wMsg,
LRESULT DefDriverProc(DWORD dwDevID, HDRVR16 hDriv, UINT16 wMsg,
LPARAM lParam1, LPARAM lParam2)
{
switch(wMsg)
......
......@@ -559,6 +559,8 @@ BOOL32 IsCharUpper32W(WCHAR x)
*/
BOOL32 CharToOem32A(LPSTR s,LPSTR d)
{
if (!s || !d)
return TRUE;
AnsiToOem(s,d);
return TRUE;
}
......@@ -633,8 +635,8 @@ BOOL32 OemToChar32W(LPCSTR s,LPWSTR d)
}
/***********************************************************************
* FormatMessageA (KERNEL32.138)
* FIXME: missing wrap, function has no clue about varargs handling
* FormatMessageA (KERNEL32.138) Library Version
* FIXME: missing wrap,FROM_SYSTEM message-loading,
*/
DWORD
FormatMessage32A(
......@@ -644,29 +646,36 @@ FormatMessage32A(
DWORD dwLanguageId,
LPSTR lpBuffer,
DWORD nSize,
LPDWORD *Arguments /* va_list *Arguments */
LPDWORD args /* va_list *args */
) {
LPSTR target,t;
DWORD talloced;
LPSTR from,f;
DWORD width = dwFlags & FORMAT_MESSAGE_MAX_WIDTH_MASK;
DWORD nolinefeed = 0;
fprintf(stddeb,"FormatMessage32A(0x%lx,%p,%ld,0x%lx,%p,%ld,%p)\n",
dwFlags,lpSource,dwMessageId,dwLanguageId,lpBuffer,
nSize,Arguments
dprintf_resource(stddeb,
"FormatMessage32A(0x%lx,%p,%ld,0x%lx,%p,%ld,%p)\n",
dwFlags,lpSource,dwMessageId,dwLanguageId,lpBuffer,nSize,args
);
if (width)
fprintf(stdnimp," - line wrapping not supported.\n");
from = NULL;
if (dwFlags & FORMAT_MESSAGE_FROM_STRING)
from = (LPSTR)lpSource;
from = xstrdup((LPSTR)lpSource);
if (dwFlags & FORMAT_MESSAGE_FROM_SYSTEM) {
/* gather information from system message tables ... */
fprintf(stdnimp," - FORMAT_MESSAGE_FROM_SYSTEM not implemented.\n");
}
if (dwFlags & FORMAT_MESSAGE_FROM_HMODULE) {
/* gather information from module's message tables ... */
fprintf(stdnimp," - FORMAT_MESSAGE_FROM_HMODULE not implemented.\n");
INT32 bufsize;
dwMessageId &= 0xFFFF;
bufsize=LoadMessage32A(0,dwMessageId,dwLanguageId,NULL,100);
if (bufsize) {
from = (char*)xmalloc(bufsize+1);
LoadMessage32A(0,dwMessageId,dwLanguageId,from,bufsize+1);
}
}
target = (char*)xmalloc(100);
t = target;
......@@ -683,12 +692,11 @@ FormatMessage32A(
if (from) {
f=from;
fprintf(stddeb," from is %s\n",from);
while (*f) {
if (*f=='%') {
int insertnr;
char *fmtstr,*sprintfbuf,*x;
DWORD arg1,arg2,arg3;
DWORD *argliststart;
f++;
if (!*f) {
......@@ -705,47 +713,35 @@ FormatMessage32A(
case '8':case '9':
f++;
insertnr=insertnr*10+*f-'0';
f++;
break;
default:
f++;
break;
default:break;
}
if (f[1]=='!') {
f+=2;
if (*f=='!') {
f++;
if (NULL!=(x=strchr(f,'!'))) {
*x='\0';
fmtstr=strdup(f);
fmtstr=xmalloc(strlen(f)+2);
sprintf(fmtstr,"%%%s",f);
f=x+1;
}
} else {
} else
fmtstr=strdup("%s");
}
if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY) {
DWORD *args = (DWORD*)Arguments;
arg1 = args[insertnr-1];
arg2 = args[insertnr+0];
arg3 = args[insertnr+1];
} else {
/*
int i;
va_list vl;
vl=va_start(Arguments,7);
for (i=insertnr;i--;)
va_arg(vl,DWORD);
arg1 = va_arg(vl,DWORD);
arg2 = va_arg(vl,DWORD);
arg3 = va_arg(vl,DWORD);
va_end(vl);
*/
fprintf(stdnimp," - varargs not supported yet.\n");
}
if (fmtstr[strlen(fmtstr)]=='s') {
sprintfbuf=(char*)xmalloc(strlen((LPSTR)arg1)+1);
} else {
if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY)
argliststart=args+insertnr-1;
else
/* FIXME: not sure that this is
* correct for unix-c-varargs.
*/
argliststart=((DWORD*)&args)+insertnr-1;
if (fmtstr[strlen(fmtstr)]=='s')
sprintfbuf=(char*)xmalloc(strlen((LPSTR)argliststart[0])+1);
else
sprintfbuf=(char*)xmalloc(100);
}
sprintf(sprintfbuf,fmtstr,arg1,arg2,arg3);
vsprintf(sprintfbuf,fmtstr,argliststart);
x=sprintfbuf;
while (*x) {
ADD_TO_T(*x++);
......@@ -753,6 +749,10 @@ FormatMessage32A(
free(sprintfbuf);
free(fmtstr);
break;
case '0':
nolinefeed=1;
f++;
break;
default:ADD_TO_T(*f++)
break;
......@@ -763,6 +763,8 @@ FormatMessage32A(
}
*t='\0';
}
if (!nolinefeed && t[-1]!='\n')
ADD_TO_T('\n');
talloced = strlen(target)+1;
if (nSize && talloced<nSize) {
target = (char*)xrealloc(target,nSize);
......@@ -774,5 +776,46 @@ FormatMessage32A(
} else
strncpy(lpBuffer,target,nSize);
free(target);
return strlen(lpBuffer);
if (from) free(from);
return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?
strlen(*(LPSTR*)lpBuffer):
strlen(lpBuffer);
}
/***********************************************************************
* FormatMessageA (KERNEL32.138) Emulator Version
*/
DWORD
WIN32_FormatMessage32A(DWORD *args) {
DWORD dwFlags = args[0];
LPCVOID lpSource = (LPCVOID)args[1];
DWORD dwMessageId = args[2];
DWORD dwLanguageId = args[3];
LPSTR lpBuffer = (LPSTR)args[4];
DWORD nSize = args[5];
DWORD *xargs;
/* convert possible varargs to an argument array look-a-like */
if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY) {
xargs=(DWORD*)args[6];
} else {
/* args[6] is a pointer to a pointer to the start of
* a list of arguments.
*/
if (args[6])
xargs=(DWORD*)(((DWORD*)args[6])[0]);
else
xargs=NULL;
dwFlags|=FORMAT_MESSAGE_ARGUMENT_ARRAY;
}
return FormatMessage32A(
dwFlags,
lpSource,
dwMessageId,
dwLanguageId,
lpBuffer,
nSize,
xargs
);
}
......@@ -55,22 +55,27 @@ const char people[] = "Wine is available thanks to the work of "
"Jan Willamowius, Carl Williams, Karl Guenter Wuensch, Eric Youngdale, "
"and James Youngman. ";
const char * langNames[] =
const struct _langentry {
char *name;
WORD langid;
} languages[] =
{
"En", /* LANG_En */
"Es", /* LANG_Es */
"De", /* LANG_De */
"No", /* LANG_No */
"Fr", /* LANG_Fr */
"Fi", /* LANG_Fi */
"Da", /* LANG_Da */
"Cz", /* LANG_Cz */
"Eo", /* LANG_Eo */
"It", /* LANG_It */
"Ko", /* LANG_Ko */
NULL
{"En",0x0409}, /* LANG_En */
{"Es",0x040A}, /* LANG_Es */
{"De",0x0407}, /* LANG_De */
{"No",0x0414}, /* LANG_No */
{"Fr",0x0400}, /* LANG_Fr */
{"Fi",0x040B}, /* LANG_Fi */
{"Da",0x0406}, /* LANG_Da */
{"Cz",0x0405}, /* LANG_Cz */
{"Eo", 0}, /* LANG_Eo */ /* FIXME languageid */
{"It",0x0410}, /* LANG_It */
{"Ko",0x0412}, /* LANG_Ko */
{NULL,0}
};
WORD WINE_LanguageId = 0;
#define WINE_CLASS "Wine" /* Class name for resources */
typedef struct tagENVENTRY {
......@@ -284,16 +289,19 @@ BOOL ParseDebugOptions(char *options)
*/
static void MAIN_ParseLanguageOption( char *arg )
{
const char **p = langNames;
const struct _langentry *p = languages;
Options.language = LANG_En; /* First language */
for (p = langNames; *p; p++)
for (;p->name;p++)
{
if (!lstrcmpi32A( *p, arg )) return;
if (!lstrcmpi32A( p->name, arg )) {
WINE_LanguageId = p->langid;
return;
}
Options.language++;
}
fprintf( stderr, "Invalid language specified '%s'. Supported languages are: ", arg );
for (p = langNames; *p; p++) fprintf( stderr, "%s ", *p );
for (p = languages; p->name; p++) fprintf( stderr, "%s ", p->name );
fprintf( stderr, "\n" );
exit(1);
}
......@@ -678,9 +686,9 @@ BOOL32 Beep( DWORD dwFreq, DWORD dwDur )
/***********************************************************************
* GetVersion (KERNEL.3)
* GetVersion16 (KERNEL.3)
*/
LONG GetVersion(void)
LONG GetVersion16(void)
{
if (getVersion16) return getVersion16;
return MAKELONG( WINVERSION, WINDOSVER );
......
......@@ -19,6 +19,7 @@
#include "windows.h"
#include "win.h"
#include "winerror.h"
#include "file.h"
#include "string32.h"
#include "stddebug.h"
#include "debug.h"
......
......@@ -124,6 +124,7 @@ static HINSTANCE SHELL_FindExecutable( LPCSTR lpFile,
HINSTANCE retval=31; /* default - 'No association was found' */
char *tok; /* token pointer */
int i; /* random counter */
char xlpFile[256]; /* result of SearchPath */
dprintf_exec(stddeb, "SHELL_FindExecutable: File %s, Dir %s\n",
(lpFile != NULL?lpFile:"-"),
......@@ -132,18 +133,19 @@ static HINSTANCE SHELL_FindExecutable( LPCSTR lpFile,
lpResult[0]='\0'; /* Start off with an empty return string */
/* trap NULL parameters on entry */
if (( lpFile == NULL ) || ( lpDirectory == NULL ) ||
( lpResult == NULL ) || ( lpOperation == NULL ))
if (( lpFile == NULL ) || ( lpResult == NULL ) || ( lpOperation == NULL ))
{
/* FIXME - should throw a warning, perhaps! */
return 2; /* File not found. Close enough, I guess. */
}
if (SearchPath32A(lpDirectory,lpFile,NULL,sizeof(xlpFile),xlpFile,NULL))
lpFile = xlpFile;
/* First thing we need is the file's extension */
extension = strrchr( lpFile, '.' ); /* Assume last "." is the one; */
extension = strrchr( xlpFile, '.' ); /* Assume last "." is the one; */
/* File->Run in progman uses */
/* .\FILE.EXE :( */
if ((extension == NULL) || (extension == &lpFile[strlen(lpFile)]))
if ((extension == NULL) || (extension == &xlpFile[strlen(xlpFile)]))
{
return 31; /* no association */
}
......@@ -176,7 +178,7 @@ static HINSTANCE SHELL_FindExecutable( LPCSTR lpFile,
{
if (strcmp(tok, &tmpext[1])==0) /* have to skip the leading "." */
{
strcpy(lpResult, lpFile); /* Need to perhaps check that */
strcpy(lpResult, xlpFile); /* Need to perhaps check that */
/* the file has a path attached */
dprintf_exec(stddeb, "SHELL_FindExecutable: found %s\n",
lpResult);
......@@ -212,7 +214,7 @@ static HINSTANCE SHELL_FindExecutable( LPCSTR lpFile,
if (tok != NULL)
{
tok[0]='\0'; /* truncate string at the percent */
strcat( lpResult, lpFile ); /* what if no dir in lpFile? */
strcat( lpResult, xlpFile ); /* what if no dir in xlpFile? */
tok=strstr( command, "%1" );
if ((tok!=NULL) && (strlen(tok)>2))
{
......@@ -235,7 +237,7 @@ static HINSTANCE SHELL_FindExecutable( LPCSTR lpFile,
if (tok != NULL)
{
tok[0]='\0';
strcat( lpResult, lpFile ); /* what if no dir in lpFile? */
strcat( lpResult, xlpFile ); /* what if no dir in xlpFile? */
tok=strstr( command, "^" ); /* see above */
if ((tok != NULL) && (strlen(tok)>5))
{
......@@ -300,8 +302,7 @@ HINSTANCE FindExecutable(LPCSTR lpFile, LPCSTR lpDirectory, LPSTR lpResult)
lpResult[0]='\0'; /* Start off with an empty return string */
/* trap NULL parameters on entry */
if (( lpFile == NULL ) || ( lpDirectory == NULL ) ||
( lpResult == NULL ))
if (( lpFile == NULL ) || ( lpResult == NULL ))
{
/* FIXME - should throw a warning, perhaps! */
return 2; /* File not found. Close enough, I guess. */
......@@ -346,7 +347,7 @@ LRESULT AboutDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
/*************************************************************************
* ShellAbout [SHELL.22]
*/
INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon)
INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON16 hIcon)
{
HANDLE handle;
BOOL bRet;
......@@ -435,10 +436,10 @@ HANDLE SHELL_LoadResource(HINSTANCE hInst, HFILE hFile, NE_NAMEINFO* pNInfo, WOR
*
* This abortion is called directly by Progman
*/
HICON InternalExtractIcon(HINSTANCE hInstance, LPCSTR lpszExeFileName, UINT nIconIndex, WORD n )
HICON16 InternalExtractIcon(HINSTANCE hInstance, LPCSTR lpszExeFileName, UINT nIconIndex, WORD n )
{
HANDLE hRet = 0;
HICON* RetPtr = NULL;
HICON16* RetPtr = NULL;
BYTE* pData;
OFSTRUCT ofs;
HFILE hFile = OpenFile( lpszExeFileName, &ofs, OF_READ );
......@@ -448,8 +449,8 @@ HICON InternalExtractIcon(HINSTANCE hInstance, LPCSTR lpszExeFileName, UINT nIco
if( hFile == HFILE_ERROR || !n ) return 0;
hRet = GlobalAlloc16( GMEM_FIXED, sizeof(HICON)*n);
RetPtr = (HICON*)GlobalLock16(hRet);
hRet = GlobalAlloc16( GMEM_FIXED, sizeof(HICON16)*n);
RetPtr = (HICON16*)GlobalLock16(hRet);
*RetPtr = (n == 0xFFFF)? 0: 1; /* error return values */
......@@ -495,7 +496,7 @@ HICON InternalExtractIcon(HINSTANCE hInstance, LPCSTR lpszExeFileName, UINT nIco
if( nIconIndex == (UINT)-1 ) RetPtr[0] = iconDirCount;
else if( nIconIndex < iconDirCount )
{
HANDLE hIcon;
HICON16 hIcon;
UINT i, icon;
if( n > iconDirCount - nIconIndex ) n = iconDirCount - nIconIndex;
......@@ -531,14 +532,14 @@ HICON InternalExtractIcon(HINSTANCE hInstance, LPCSTR lpszExeFileName, UINT nIco
/*************************************************************************
* ExtractIcon [SHELL.34]
*/
HICON ExtractIcon(HINSTANCE hInstance, LPCSTR lpszExeFileName, WORD nIconIndex)
HICON16 ExtractIcon(HINSTANCE hInstance, LPCSTR lpszExeFileName, WORD nIconIndex)
{
HANDLE handle = InternalExtractIcon(hInstance,lpszExeFileName,nIconIndex, 1);
if( handle )
{
HICON* ptr = (HICON*)GlobalLock16(handle);
HICON hIcon = *ptr;
HICON16* ptr = (HICON16*)GlobalLock16(handle);
HICON16 hIcon = *ptr;
GlobalFree16(handle);
return hIcon;
......
......@@ -21,7 +21,6 @@ WORD USER_HeapSel = 0;
extern HTASK TASK_GetNextTask(HTASK);
extern void QUEUE_SetDoomedQueue(HQUEUE);
/***********************************************************************
* GetFreeSystemResources (USER.284)
......@@ -109,7 +108,7 @@ int USER_InitApp(HINSTANCE hInstance)
/**********************************************************************
* USER_AppExit
*/
void USER_AppExit(HTASK hTask, HINSTANCE hInstance, HQUEUE hQueue)
void USER_AppExit( HTASK16 hTask, HINSTANCE16 hInstance, HQUEUE16 hQueue )
{
/* FIXME: flush send messages (which are not implemented yet),
* empty clipboard if needed, maybe destroy menus (Windows
......
......@@ -71,7 +71,7 @@ typedef struct {
BOOL fShareable; /* TRUE if first open was shareable */
WORD wNotifyDeviceID; /* MCI device ID with a pending notification */
HANDLE hCallback; /* Callback handle for pending notification */
HMMIO hFile; /* mmio file handle open as Element */
HMMIO16 hFile; /* mmio file handle open as Element */
MCI_WAVE_OPEN_PARMS openParms;
PCMWAVEFORMAT WaveFormat;
WAVEHDR WaveHdr;
......@@ -1580,7 +1580,7 @@ DWORD widMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
/**************************************************************************
* AUDIO_DriverProc [sample driver]
*/
LONG WAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
LONG WAVE_DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
DWORD dwParam1, DWORD dwParam2)
{
#ifdef linux
......
......@@ -605,7 +605,7 @@ static DWORD ANIM_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
/**************************************************************************
* ANIM_DriverProc [sample driver]
*/
LONG ANIM_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
LONG ANIM_DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
DWORD dwParam1, DWORD dwParam2)
{
#ifdef linux
......
......@@ -834,7 +834,7 @@ static DWORD CDAUDIO_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
/**************************************************************************
* CDAUDIO_DriverProc [sample driver]
*/
LONG CDAUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
LONG CDAUDIO_DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
DWORD dwParam1, DWORD dwParam2)
{
#ifdef linux
......
......@@ -19,6 +19,7 @@
#include "user.h"
#include "driver.h"
#include "mmsystem.h"
#include "stackframe.h"
#include "stddebug.h"
#include "debug.h"
#include "xmalloc.h"
......@@ -31,16 +32,16 @@ extern MCI_OPEN_DRIVER_PARMS mciDrv[MAXMCIDRIVERS];
*/
extern MCI_OPEN_PARMS mciOpenDrv[MAXMCIDRIVERS];
LONG DrvDefDriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
LONG DrvDefDriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
DWORD dwParam1, DWORD dwParam2);
LONG WAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
LONG WAVE_DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
DWORD dwParam1, DWORD dwParam2);
LONG MIDI_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
LONG MIDI_DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
DWORD dwParam1, DWORD dwParam2);
LONG CDAUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
LONG CDAUDIO_DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
DWORD dwParam1, DWORD dwParam2);
LONG ANIM_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
LONG ANIM_DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
DWORD dwParam1, DWORD dwParam2);
/* The reason why I just don't lowercase the keywords array in
......
......@@ -66,7 +66,7 @@ typedef struct {
BOOL fShareable; /* TRUE if first open was shareable */
WORD wNotifyDeviceID; /* MCI device ID with a pending notification */
HANDLE hCallback; /* Callback handle for pending notification */
HMMIO hFile; /* mmio file handle open as Element */
HMMIO16 hFile; /* mmio file handle open as Element */
DWORD dwBeginData;
DWORD dwTotalLen;
WORD wFormat;
......@@ -1267,7 +1267,7 @@ DWORD modMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
/**************************************************************************
* MIDI_DriverProc [sample driver]
*/
LONG MIDI_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
LONG MIDI_DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
DWORD dwParam1, DWORD dwParam2)
{
#ifdef linux
......
......@@ -660,8 +660,9 @@ static void BITBLT_StretchImage( XImage *srcImage, XImage *dstImage,
memset( rowDst, (mode == STRETCH_ANDSCANS) ? 0xff : 0x00,
widthDst*sizeof(int) );
hstretch = ((widthSrc < widthDst) || (mode == STRETCH_DELETESCANS));
vstretch = ((heightSrc < heightDst) || (mode == STRETCH_DELETESCANS));
hstretch = (widthSrc < widthDst);
vstretch = (heightSrc < heightDst);
xinc = hstretch ? ((int)widthSrc << 16) / widthDst :
((int)widthDst << 16) / widthSrc;
......
......@@ -190,7 +190,7 @@ HBRUSH CreatePatternBrush( HBITMAP hbitmap )
/***********************************************************************
* CreateDIBPatternBrush (GDI.445)
*/
HBRUSH CreateDIBPatternBrush( HGLOBAL hbitmap, UINT coloruse )
HBRUSH CreateDIBPatternBrush( HGLOBAL16 hbitmap, UINT coloruse )
{
LOGBRUSH16 logbrush = { BS_DIBPATTERN, coloruse, 0 };
BITMAPINFO *info, *newInfo;
......
......@@ -736,9 +736,9 @@ COLORREF COLOR_ToLogical(int pixel)
if ( cSpace.flags & COLOR_FIXED && !COLOR_Graymax )
{
color.red = pixel >> COLOR_Redshift;
color.green = pixel >> COLOR_Greenshift;
color.blue = pixel >> COLOR_Blueshift;
color.red = (pixel >> COLOR_Redshift) & COLOR_Redmax;
color.green = (pixel >> COLOR_Greenshift) & COLOR_Greenmax;
color.blue = (pixel >> COLOR_Blueshift) & COLOR_Bluemax;
}
else if ((screenDepth <= 8) && (pixel < 256) &&
!(cSpace.flags & (COLOR_VIRTUAL | COLOR_FIXED)) )
......
......@@ -38,7 +38,7 @@
extern UINT16 COLOR_GetSystemPaletteSize();
Cursor CURSORICON_XCursor = None; /* Current X cursor */
static HCURSOR hActiveCursor = 0; /* Active cursor */
static HCURSOR16 hActiveCursor = 0; /* Active cursor */
static int CURSOR_ShowCount = 0; /* Cursor display count */
static RECT32 CURSOR_ClipRect; /* Cursor clipping rect */
......@@ -371,7 +371,7 @@ static HANDLE CURSORICON_Load( HANDLE hInstance, SEGPTR name, int width,
int height, int colors, BOOL fCursor )
{
HANDLE handle,hRet;
HRSRC hRsrc;
HRSRC16 hRsrc;
CURSORICONDIRENTRY dirEntry;
if (!hInstance) /* OEM cursor/icon */
......@@ -433,7 +433,7 @@ static HANDLE CURSORICON_Copy( HANDLE hInstance, HANDLE handle )
* FIXME: if icon is passed returns a copy of OCR_DRAGOBJECT cursor
* but should actually convert icon to cursor.
*/
HCURSOR CURSORICON_IconToCursor(HICON hIcon)
HCURSOR16 CURSORICON_IconToCursor(HICON16 hIcon)
{
CURSORICONINFO *ptr = NULL;
......@@ -499,9 +499,9 @@ HICON16 LoadIcon16(HINSTANCE16 hInstance,SEGPTR name)
/***********************************************************************
* CreateCursor (USER.406)
*/
HCURSOR CreateCursor( HINSTANCE hInstance, INT xHotSpot, INT yHotSpot,
INT nWidth, INT nHeight,
const BYTE *lpANDbits, const BYTE *lpXORbits )
HCURSOR16 CreateCursor( HINSTANCE hInstance, INT xHotSpot, INT yHotSpot,
INT nWidth, INT nHeight,
const BYTE *lpANDbits, const BYTE *lpXORbits )
{
CURSORICONINFO info = { { xHotSpot, yHotSpot }, nWidth, nHeight, 0, 1, 1 };
......@@ -514,7 +514,7 @@ HCURSOR CreateCursor( HINSTANCE hInstance, INT xHotSpot, INT yHotSpot,
/***********************************************************************
* CreateIcon (USER.407)
*/
HICON CreateIcon( HINSTANCE hInstance, INT nWidth, INT nHeight, BYTE bPlanes,
HICON16 CreateIcon( HINSTANCE hInstance, INT nWidth, INT nHeight, BYTE bPlanes,
BYTE bBitsPixel, const BYTE* lpANDbits, const BYTE* lpXORbits)
{
CURSORICONINFO info = { { 0, 0 }, nWidth, nHeight, 0, bPlanes, bBitsPixel };
......@@ -585,7 +585,7 @@ HCURSOR16 CopyCursor16( HINSTANCE16 hInstance, HCURSOR16 hCursor )
/***********************************************************************
* DestroyIcon (USER.457)
*/
BOOL DestroyIcon( HICON hIcon )
BOOL DestroyIcon( HICON16 hIcon )
{
dprintf_icon( stddeb, "DestroyIcon: %04x\n", hIcon );
/* FIXME: should check for OEM icon here */
......@@ -596,7 +596,7 @@ BOOL DestroyIcon( HICON hIcon )
/***********************************************************************
* DestroyCursor (USER.458)
*/
BOOL DestroyCursor( HCURSOR hCursor )
BOOL DestroyCursor( HCURSOR16 hCursor )
{
dprintf_cursor( stddeb, "DestroyCursor: %04x\n", hCursor );
/* FIXME: should check for OEM cursor here */
......@@ -607,7 +607,7 @@ BOOL DestroyCursor( HCURSOR hCursor )
/***********************************************************************
* DrawIcon (USER.84)
*/
BOOL DrawIcon( HDC hdc, INT x, INT y, HICON hIcon )
BOOL DrawIcon( HDC hdc, INT x, INT y, HICON16 hIcon )
{
CURSORICONINFO *ptr;
HDC hMemDC;
......@@ -665,7 +665,7 @@ DWORD DumpIcon( SEGPTR pInfo, WORD *lpLen,
*
* Change the X cursor. Helper function for SetCursor() and ShowCursor().
*/
static BOOL CURSORICON_SetCursor( HCURSOR hCursor )
static BOOL CURSORICON_SetCursor( HCURSOR16 hCursor )
{
Pixmap pixmapBits, pixmapMask, pixmapAll;
XColor fg, bg;
......@@ -803,9 +803,9 @@ static BOOL CURSORICON_SetCursor( HCURSOR hCursor )
/***********************************************************************
* SetCursor (USER.69)
*/
HCURSOR SetCursor( HCURSOR hCursor )
HCURSOR16 SetCursor( HCURSOR16 hCursor )
{
HCURSOR hOldCursor;
HCURSOR16 hOldCursor;
if (hCursor == hActiveCursor) return hActiveCursor; /* No change */
dprintf_cursor( stddeb, "SetCursor: %04x\n", hCursor );
......@@ -852,7 +852,7 @@ int ShowCursor( BOOL bShow )
/***********************************************************************
* GetCursor (USER.247)
*/
HCURSOR GetCursor(void)
HCURSOR16 GetCursor(void)
{
return hActiveCursor;
}
......@@ -973,7 +973,7 @@ WORD GetIconID( HANDLE hResource, DWORD resType )
/**********************************************************************
* LoadIconHandler (USER.456)
*/
HICON LoadIconHandler( HANDLE hResource, BOOL bNew )
HICON16 LoadIconHandler( HANDLE hResource, BOOL bNew )
{
dprintf_cursor(stddeb,"LoadIconHandler: hRes=%04x\n",hResource);
......
......@@ -515,11 +515,10 @@ INT EnumObjects( HDC hdc, INT nObjType, GOBJENUMPROC16 lpEnumFunc,
*/
BOOL IsGDIObject(HANDLE handle)
{
GDIOBJHDR *object;
object = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle );
/* FIXME: should check magic here */
return (object != NULL);
GDIOBJHDR *object = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle );
if (object)
return (object->wMagic>=PEN_MAGIC && object->wMagic<= METAFILE_DC_MAGIC);
return FALSE;
}
......
......@@ -25,9 +25,9 @@ static int HTLen; /* allocated length of handle table */
* GetMetafile GDI.124 By Kenny MacDonald 30 Nov 94
*/
HMETAFILE GetMetaFile(LPSTR lpFilename)
HMETAFILE16 GetMetaFile(LPSTR lpFilename)
{
HMETAFILE hmf;
HMETAFILE16 hmf;
METAHEADER *mh;
HFILE hFile;
DWORD size;
......@@ -146,9 +146,9 @@ HANDLE CreateMetaFile(LPCSTR lpFilename)
* CopyMetafile GDI.151 Niels de Carpentier, April 1996
*/
HMETAFILE CopyMetaFile(HMETAFILE hSrcMetaFile, LPCSTR lpFilename)
HMETAFILE16 CopyMetaFile(HMETAFILE16 hSrcMetaFile, LPCSTR lpFilename)
{
HMETAFILE handle = 0;
HMETAFILE16 handle = 0;
METAHEADER *mh;
METAHEADER *mh2;
int hFile;
......@@ -168,12 +168,9 @@ HMETAFILE CopyMetaFile(HMETAFILE hSrcMetaFile, LPCSTR lpFilename)
mh->mtType=1; /* disk file version stores 1 here */
i=_lwrite(hFile, (char *)mh, mh->mtSize * 2) ;
mh->mtType=j; /* restore old value [0 or 1] */
_lclose(hFile);
if (i == -1)
{
_lclose(hFile);
return 0;
}
_lclose(hFile);
}
else /* memory based metafile */
{
......@@ -186,16 +183,35 @@ HMETAFILE CopyMetaFile(HMETAFILE hSrcMetaFile, LPCSTR lpFilename)
return handle;
}
/******************************************************************
* IsValidMetaFile (GDI.410)
* (This is not exactly what windows does, see "Undoc Win")
*/
BOOL IsValidMetaFile(HMETAFILE16 hmf)
{
BOOL resu=FALSE;
METAHEADER *mh = (METAHEADER *)GlobalLock16(hmf);
if (mh)
if (mh->mtType == 1 || mh->mtType == 0)
if (mh->mtHeaderSize == MFHEADERSIZE/sizeof(INT16))
if (mh->mtVersion == MFVERSION)
resu=TRUE;
GlobalUnlock16(hmf);
dprintf_metafile(stddeb,"IsValidMetaFile %x => %d\n",hmf,resu);
return resu;
}
/******************************************************************
* CloseMetafile GDI.126
*/
HMETAFILE CloseMetaFile(HDC hdc)
HMETAFILE16 CloseMetaFile(HDC hdc)
{
DC *dc;
METAHEADER *mh;
HMETAFILE hmf;
HMETAFILE16 hmf;
HFILE hFile;
dprintf_metafile(stddeb,"CloseMetaFile\n");
......@@ -248,7 +264,7 @@ HMETAFILE CloseMetaFile(HDC hdc)
* DeleteMetafile GDI.127
*/
BOOL DeleteMetaFile(HMETAFILE hmf)
BOOL DeleteMetaFile(HMETAFILE16 hmf)
{
METAHEADER *mh = (METAHEADER *)GlobalLock16(hmf);
......@@ -264,7 +280,7 @@ BOOL DeleteMetaFile(HMETAFILE hmf)
* PlayMetafile GDI.123
*/
BOOL PlayMetaFile(HDC hdc, HMETAFILE hmf)
BOOL PlayMetaFile(HDC hdc, HMETAFILE16 hmf)
{
METAHEADER *mh = (METAHEADER *)GlobalLock16(hmf);
METARECORD *mr;
......@@ -307,7 +323,7 @@ BOOL PlayMetaFile(HDC hdc, HMETAFILE hmf)
* Niels de carpentier, april 1996
*/
BOOL EnumMetaFile(HDC hdc, HMETAFILE hmf, MFENUMPROC16 lpEnumFunc,LPARAM lpData)
BOOL EnumMetaFile(HDC hdc, HMETAFILE16 hmf, MFENUMPROC16 lpEnumFunc,LPARAM lpData)
{
METAHEADER *mh = (METAHEADER *)GlobalLock16(hmf);
METARECORD *mr;
......@@ -740,7 +756,7 @@ void PlayMetaFileRecord(HDC hdc, HANDLETABLE16 *ht, METARECORD *mr,
* Trade in a meta file object handle for a handle to the meta file memory
*/
HANDLE GetMetaFileBits(HMETAFILE hmf)
HANDLE GetMetaFileBits(HMETAFILE16 hmf)
{
dprintf_metafile(stddeb,"GetMetaFileBits: hMem out: %04x\n", hmf);
......@@ -753,7 +769,7 @@ HANDLE GetMetaFileBits(HMETAFILE hmf)
* Trade in a meta file memory handle for a handle to a meta file object
*/
HMETAFILE SetMetaFileBits(HANDLE hMem)
HMETAFILE16 SetMetaFileBits(HANDLE hMem)
{
dprintf_metafile(stddeb,"SetMetaFileBits: hmf out: %04x\n", hMem);
......@@ -764,7 +780,7 @@ HMETAFILE SetMetaFileBits(HANDLE hMem)
* MF_WriteRecord
*/
HMETAFILE MF_WriteRecord(HMETAFILE hmf, METARECORD *mr, WORD rlen)
HMETAFILE16 MF_WriteRecord(HMETAFILE16 hmf, METARECORD *mr, WORD rlen)
{
DWORD len;
METAHEADER *mh = (METAHEADER *)GlobalLock16(hmf);
......@@ -860,7 +876,7 @@ BOOL MF_MetaParam0(DC *dc, short func)
{
char buffer[8];
METARECORD *mr = (METARECORD *)&buffer;
HMETAFILE handle;
HMETAFILE16 handle;
mr->rdSize = 3;
mr->rdFunction = func;
......@@ -878,7 +894,7 @@ BOOL MF_MetaParam1(DC *dc, short func, short param1)
{
char buffer[8];
METARECORD *mr = (METARECORD *)&buffer;
HMETAFILE handle;
HMETAFILE16 handle;
mr->rdSize = 4;
mr->rdFunction = func;
......@@ -897,7 +913,7 @@ BOOL MF_MetaParam2(DC *dc, short func, short param1, short param2)
{
char buffer[10];
METARECORD *mr = (METARECORD *)&buffer;
HMETAFILE handle;
HMETAFILE16 handle;
mr->rdSize = 5;
mr->rdFunction = func;
......@@ -919,7 +935,7 @@ BOOL MF_MetaParam4(DC *dc, short func, short param1, short param2,
{
char buffer[14];
METARECORD *mr = (METARECORD *)&buffer;
HMETAFILE handle;
HMETAFILE16 handle;
mr->rdSize = 7;
mr->rdFunction = func;
......@@ -943,7 +959,7 @@ BOOL MF_MetaParam6(DC *dc, short func, short param1, short param2,
{
char buffer[18];
METARECORD *mr = (METARECORD *)&buffer;
HMETAFILE handle;
HMETAFILE16 handle;
mr->rdSize = 9;
mr->rdFunction = func;
......@@ -969,7 +985,7 @@ BOOL MF_MetaParam8(DC *dc, short func, short param1, short param2,
{
char buffer[22];
METARECORD *mr = (METARECORD *)&buffer;
HMETAFILE handle;
HMETAFILE16 handle;
mr->rdSize = 11;
mr->rdFunction = func;
......@@ -995,7 +1011,7 @@ BOOL MF_MetaParam8(DC *dc, short func, short param1, short param2,
BOOL MF_CreateBrushIndirect(DC *dc, HBRUSH hBrush, LOGBRUSH16 *logbrush)
{
int index;
HMETAFILE handle;
HMETAFILE16 handle;
char buffer[sizeof(METARECORD) - 2 + sizeof(LOGBRUSH16)];
METARECORD *mr = (METARECORD *)&buffer;
METAHEADER *mh;
......@@ -1039,7 +1055,7 @@ BOOL MF_CreatePatternBrush(DC *dc, HBRUSH hBrush, LOGBRUSH16 *logbrush)
BITMAPINFO *info;
BITMAPINFOHEADER *infohdr;
int index;
HMETAFILE handle;
HMETAFILE16 handle;
char buffer[sizeof(METARECORD)];
METAHEADER *mh;
......@@ -1124,7 +1140,7 @@ BOOL MF_CreatePatternBrush(DC *dc, HBRUSH hBrush, LOGBRUSH16 *logbrush)
BOOL MF_CreatePenIndirect(DC *dc, HPEN16 hPen, LOGPEN16 *logpen)
{
int index;
HMETAFILE handle;
HMETAFILE16 handle;
char buffer[sizeof(METARECORD) - 2 + sizeof(LOGPEN16)];
METARECORD *mr = (METARECORD *)&buffer;
METAHEADER *mh;
......@@ -1161,7 +1177,7 @@ BOOL MF_CreatePenIndirect(DC *dc, HPEN16 hPen, LOGPEN16 *logpen)
BOOL MF_CreateFontIndirect(DC *dc, HFONT hFont, LOGFONT16 *logfont)
{
int index;
HMETAFILE handle;
HMETAFILE16 handle;
char buffer[sizeof(METARECORD) - 2 + sizeof(LOGFONT16)];
METARECORD *mr = (METARECORD *)&buffer;
METAHEADER *mh;
......@@ -1196,7 +1212,7 @@ BOOL MF_CreateFontIndirect(DC *dc, HFONT hFont, LOGFONT16 *logfont)
*/
BOOL MF_TextOut(DC *dc, short x, short y, LPCSTR str, short count)
{
HMETAFILE handle;
HMETAFILE16 handle;
DWORD len;
HANDLE hmr;
METARECORD *mr;
......@@ -1225,7 +1241,7 @@ BOOL MF_TextOut(DC *dc, short x, short y, LPCSTR str, short count)
BOOL MF_ExtTextOut(DC *dc, short x, short y, UINT16 flags, const RECT16 *rect,
LPCSTR str, short count, const INT16 *lpDx)
{
HMETAFILE handle;
HMETAFILE16 handle;
DWORD len;
HANDLE hmr;
METARECORD *mr;
......@@ -1259,7 +1275,7 @@ BOOL MF_ExtTextOut(DC *dc, short x, short y, UINT16 flags, const RECT16 *rect,
*/
BOOL MF_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count)
{
HMETAFILE handle;
HMETAFILE16 handle;
DWORD len;
HANDLE hmr;
METARECORD *mr;
......@@ -1287,7 +1303,7 @@ BOOL MF_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count)
BOOL MF_BitBlt(DC *dcDest, short xDest, short yDest, short width,
short height, HDC hdcSrc, short xSrc, short ySrc, DWORD rop)
{
HMETAFILE handle;
HMETAFILE16 handle;
DWORD len;
HANDLE hmr;
METARECORD *mr;
......@@ -1339,7 +1355,7 @@ BOOL MF_StretchBlt(DC *dcDest, short xDest, short yDest, short widthDest,
short heightDest, HDC hdcSrc, short xSrc, short ySrc,
short widthSrc, short heightSrc, DWORD rop)
{
HMETAFILE handle;
HMETAFILE16 handle;
DWORD len;
HANDLE hmr;
METARECORD *mr;
......
......@@ -216,7 +216,7 @@ static char **OBM_Cursors_Data[NB_CURSORS] =
#endif
};
static HCURSOR OBM_Cursors[NB_CURSORS];
static HGLOBAL16 OBM_Cursors[NB_CURSORS];
/* All the colors used in the xpm files must be included in this */
......@@ -299,10 +299,10 @@ static BOOL OBM_InitColorSymbols()
*
* Allocate a GDI bitmap.
*/
static HBITMAP OBM_MakeBitmap( WORD width, WORD height,
WORD bpp, Pixmap pixmap )
static HBITMAP16 OBM_MakeBitmap( WORD width, WORD height,
WORD bpp, Pixmap pixmap )
{
HBITMAP hbitmap;
HBITMAP16 hbitmap;
BITMAPOBJ * bmpObjPtr;
if (!pixmap) return 0;
......@@ -330,8 +330,8 @@ static HBITMAP OBM_MakeBitmap( WORD width, WORD height,
*
* Create the 2 bitmaps from XPM data.
*/
static BOOL OBM_CreateBitmaps( char **data, BOOL color, HBITMAP *hBitmap,
HBITMAP *hBitmapMask, POINT16 *hotspot )
static BOOL OBM_CreateBitmaps( char **data, BOOL color, HBITMAP16 *hBitmap,
HBITMAP16 *hBitmapMask, POINT16 *hotspot )
{
Pixmap pixmap, pixmask;
XpmAttributes *attrs;
......@@ -377,9 +377,9 @@ static BOOL OBM_CreateBitmaps( char **data, BOOL color, HBITMAP *hBitmap,
/***********************************************************************
* OBM_LoadBitmap
*/
HBITMAP OBM_LoadBitmap( WORD id )
HBITMAP16 OBM_LoadBitmap( WORD id )
{
HBITMAP hbitmap;
HBITMAP16 hbitmap;
if ((id < OBM_FIRST) || (id > OBM_LAST)) return 0;
id -= OBM_FIRST;
......@@ -401,12 +401,12 @@ HBITMAP OBM_LoadBitmap( WORD id )
/***********************************************************************
* OBM_LoadCursorIcon
*/
HANDLE OBM_LoadCursorIcon( WORD id, BOOL fCursor )
HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor )
{
HANDLE handle;
HGLOBAL16 handle;
CURSORICONINFO *pInfo;
BITMAPOBJ *bmpXor, *bmpAnd;
HBITMAP hXorBits, hAndBits;
HBITMAP16 hXorBits, hAndBits;
POINT16 hotspot;
int sizeXor, sizeAnd;
......
......@@ -424,6 +424,35 @@ static int REGION_CopyRegion( RGNOBJ *src, RGNOBJ *dest )
}
/***********************************************************************
* REGION_UnionRectWithRgn
*
* Add rectangle to region
*/
BOOL16 REGION_UnionRectWithRgn( HRGN32 hRgn, LPRECT16 rc )
{
RGNOBJ *rgnObj = (RGNOBJ*) GDI_GetObjPtr( hRgn, REGION_MAGIC );
XRectangle rect = { rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top };
BOOL16 ret = 0;
if( rgnObj )
{
if( !rgnObj->xrgn )
{
if (!(rgnObj->xrgn = XCreateRegion()))
{
GDI_FreeObject( hRgn );
return 0;
}
ret = SIMPLEREGION;
}
else
ret = COMPLEXREGION;
XUnionRectWithRegion( &rect, rgnObj->xrgn, rgnObj->xrgn );
}
return ret;
}
/***********************************************************************
* REGION_CreateFrameRgn
*
* Create a region that is a frame around another region
......
......@@ -42,7 +42,7 @@ static const struct resource * const * SYSRES_Resources[] =
*
* Create a global memory block for a system resource.
*/
HANDLE SYSRES_LoadResource( SYSTEM_RESOURCE id )
HGLOBAL16 SYSRES_LoadResource( SYSTEM_RESOURCE id )
{
const struct resource *resPtr;
......@@ -57,7 +57,7 @@ HANDLE SYSRES_LoadResource( SYSTEM_RESOURCE id )
*
* Free a global memory block for a system resource.
*/
void SYSRES_FreeResource( HANDLE handle )
void SYSRES_FreeResource( HGLOBAL16 handle )
{
GLOBAL_FreeBlock( handle );
}
......@@ -13,10 +13,13 @@ ORDINAL equate EXPORTNAME DATA
ORDINAL return EXPORTNAME ARGLENGTH RETVALUE
ORDINAL extern EXPORTNAME SYMBOLNAME
# COMMENT_TEXT
--------------------
General:
========
"name" and "type" fields are mandatory. Specific ordinal
declarations are optional, but the default handler will print an error
......@@ -26,6 +29,7 @@ modules); default is no local heap. Lines whose first character is a
'#' will be ignored as comments.
Variable ordinals:
==================
This type defines data storage at the ordinal specified. You may
store items as bytes, 16-bit words, or 32-bit words.
......@@ -39,6 +43,7 @@ ordinal 2 and containing 4 bytes:
2 byte VariableA(-1 0xff 0 0)
Function ordinals:
==================
This type defines a function entry point. The prototype defined by
"EXPORTNAME ([ARGTYPE [ARGTYPE [...]]])" specifies the name available for
......@@ -79,13 +84,21 @@ call (the ordinal 100 is just an example):
100 pascal GetFocus() WIN_GetFocus()
To declare a function using a variable number of arguments, specify
the function as taking no arguments. In this special case, in Win32
the called function will be passed a pointer to the first arg; in
Win16, the args are available with CURRENT_STACK16->args. See the
wsprintf* functions in user.spec and user32.spec for an example.
Stub ordinals:
==============
This type defines a stub function. It makes the name and ordinal
available for dynamic linking, but will terminate execution with an
error message if the function is ever called.
Equate ordinals:
================
This type defines an ordinal as an absolute value.
"ORDINAL" is replaced by the ordinal number corresponding to the
......@@ -93,6 +106,7 @@ variable. "EXPORTNAME" will be the name available for dynamic linking.
"DATA" can be a decimal number or a hex number preceeded by "0x".
Return ordinals:
================
This type defines a function entry point whose handler should do
nothing but return a value.
......@@ -100,3 +114,11 @@ nothing but return a value.
variable. ARGLENGTH is the number of bytes that need to be removed
from the stack before returning to the caller. RETVALUE is the
return value which will be passed back to the caller.
Extern ordinals:
================
This type defines an entry that simply maps to a Wine symbol
(variable or function); "EXPORTNAME" will point to the symbol
"SYMBOLNAME" that must be defined in C code. This type only works with
Win32.
......@@ -7,7 +7,6 @@
#include <stdio.h>
#include "windows.h"
#include "winerror.h"
#include "kernel32.h"
#include "winnls.h"
#include "stddebug.h"
#include "debug.h"
......
......@@ -7,7 +7,6 @@
#include <stdio.h>
#include "windows.h"
#include "winerror.h"
#include "kernel32.h"
#include "wincon.h"
#include "stddebug.h"
#include "debug.h"
......
......@@ -9,7 +9,6 @@
#include <unistd.h>
#include "windows.h"
#include "winerror.h"
#include "kernel32.h"
#include "module.h"
#include "task.h"
#include "stddebug.h"
......@@ -19,7 +18,7 @@
/***********************************************************************
* GetCommandLineA (KERNEL32.161)
*/
LPSTR GetCommandLineA(void)
LPCSTR GetCommandLine32A(void)
{
static char buffer[256];
char *cp;
......@@ -37,6 +36,17 @@ LPSTR GetCommandLineA(void)
return buffer;
}
/***********************************************************************
* GetCommandLineW (KERNEL32.162)
*/
LPCWSTR GetCommandLine32W(void)
{
static WCHAR buffer[256];
lstrcpynAtoW(buffer,GetCommandLine32A(),256);
return buffer;
}
/***********************************************************************
* GetSystemPowerStatus (KERNEL32.621)
......
......@@ -8,7 +8,6 @@
#include <errno.h>
#include "windows.h"
#include "winerror.h"
#include "kernel32.h"
#include "stddebug.h"
#include "debug.h"
......
......@@ -35,7 +35,6 @@
#include <stdio.h>
#include "windows.h"
#include "winerror.h"
#include "kernel32.h"
#include "stddebug.h"
#include "debug.h"
#include "except.h"
......
......@@ -16,7 +16,6 @@
#include "windows.h"
#include "winbase.h"
#include "winerror.h"
#include "kernel32.h"
#include "handle32.h"
#include "dos_fs.h"
#include "stddebug.h"
......
......@@ -5,50 +5,150 @@
#include "windows.h"
#include "winbase.h"
#include "dos_fs.h"
#include "heap.h"
#include <ctype.h>
HANDLE32 FindFirstFile32A(LPCSTR lpfilename,
LPWIN32_FIND_DATA32A lpFindFileData)
#define PATH_LEN 260
struct FindFileContext32 {
DIR * dir;
char mask[PATH_LEN];
char path[PATH_LEN];
};
typedef struct FindFileContext32 FindFileContext32;
const char *DOSFS_Hash(const char *, int);
/* example D:\*.dbs */
static BOOL32 MatchWildCard(LPCSTR file, LPCSTR mask)
{
char *unixpath = DOSFS_GetUnixFileName(lpfilename, FALSE);
char *p;
char *path;
char *mask;
DIR *dir;
struct dirent *dirent;
int namelen;
char *foundname;
int len;
if (!unixpath) {
/* FIXME: SetLastError(??) */
return INVALID_HANDLE_VALUE;
/* We should check volume information to see if long filenames possible.
*/
len = strlen(file);
while (*file) {
if (*mask == '*') {
if (*(mask+1)) {
while (*file && (toupper(*file) != *(mask+1))) file++;
if (!*file)
return FALSE;
}
else
break;
}
p = strrchr(unixpath, '/');
if (p) {
*p = '\0';
path = unixpath;
mask = p + 1;
} else {
path = ".";
mask = unixpath;
else {
if (*mask != '?' && *mask != toupper(*file)) {
return FALSE;
}
file++;
}
dir = opendir(path);
if (!dir) {
/* FIXME: SetLastError(??) */
return INVALID_HANDLE_VALUE;
mask++;
}
return (TRUE);
}
/*************************************************************************
* FindNextFile32A (KERNEL32.126)
*/
BOOL32 FindNextFile32A(HANDLE32 handle, LPWIN32_FIND_DATA32A data)
{
FindFileContext32 *context;
struct dirent *dirent;
char dosname[14];
memset(data, 0, sizeof(WIN32_FIND_DATA32A));
context = (FindFileContext32 *) handle;
while ((dirent = readdir(context->dir)) != NULL) {
if (strcmp(dirent->d_name, "..") == 0 ||
strcmp(dirent->d_name, ".") == 0)
continue;
strcpy(dosname, DOSFS_Hash(dirent->d_name, FALSE));
if (MatchWildCard(dirent->d_name, context->mask)) {
/* Full file name - is this a long file name?
* If it is, we should probably use the dirent
* instead of the dos hashed name.
*/
strcpy(data->cFileName, dosname);
/* file name expressed in 8.3 format */
strcpy(data->cAlternateFileName, dosname);
return (TRUE);
}
while ((dirent = readdir(dir)) != NULL) {
if (!DOSFS_Match(DOSFS_Hash(dirent->d_name, TRUE)))
continue;
/* FIXME: Ought to fiddle to avoid
returning ./.. in drive root */
namelen = strlen(path) + strlen(dirent->d_name);
foundname = xmalloc(namelen+1);
strcpy(foundname, path);
strcat(foundname, dirent->d_name);
strcpy(lpFindFileData->FileName, DOSFS_GetDosTrueName(foundname, TRUE));
free(foundname);
return dir;
}
return (FALSE);
}
/*************************************************************************
* FindFirstFile32A (KERNEL32.123)
*/
HANDLE32 FindFirstFile32A(LPCSTR lpfilename,
LPWIN32_FIND_DATA32A lpFindFileData)
{
const char *unixpath;
char *slash, *p;
FindFileContext32 *context;
context = HeapAlloc(SystemHeap, 0, sizeof(FindFileContext32));
if (!context)
return (INVALID_HANDLE_VALUE);
slash = strrchr(lpfilename, '\\');
if (slash) {
lstrcpyn32A(context->path, lpfilename, slash - lpfilename + 1);
context->path[slash - lpfilename + 1] = '\0';
unixpath = DOSFS_GetUnixFileName(context->path, FALSE);
if (!unixpath) {
/* FIXME: SetLastError(??) */
HeapFree(SystemHeap, 0, context);
return INVALID_HANDLE_VALUE;
}
lstrcpy32A(context->mask, slash+1);
}
else {
context->path[0] = '\0';
unixpath = ".";
lstrcpy32A(context->mask, lpfilename);
}
context->dir = opendir(unixpath);
if (!context->dir) {
/* FIXME: SetLastError(??) */
HeapFree(SystemHeap, 0, context);
return INVALID_HANDLE_VALUE;
}
strcpy(context->mask, slash+1);
/* uppercase mask in place */
for (p = context->mask ; *p; p++)
*p = toupper(*p);
if (!FindNextFile32A((HANDLE32) context, lpFindFileData))
return (INVALID_HANDLE_VALUE);
return ((HANDLE32) context);
}
/*************************************************************************
* FindClose (KERNEL32.119)
*/
BOOL32 FindClose(HANDLE32 handle)
{
FindFileContext32 *context;
context = (FindFileContext32 *) handle;
if (context->dir)
closedir(context->dir);
HeapFree(SystemHeap, 0, context);
return (TRUE);
}
......@@ -9,7 +9,6 @@
#include <unistd.h>
#include "windows.h"
#include "winerror.h"
#include "kernel32.h"
#include "handle32.h"
#include "except.h"
#include "task.h"
......
......@@ -14,7 +14,6 @@
#include <stdlib.h>
#include "windows.h"
#include "winerror.h"
#include "kernel32.h"
#include "winbase.h"
#include "handle32.h"
#include "stddebug.h"
......
......@@ -10,7 +10,6 @@ at a later date. */
#include <stdio.h>
#include "windows.h"
#include "winerror.h"
#include "kernel32.h"
#include "stddebug.h"
#include "debug.h"
......
......@@ -9,7 +9,6 @@
#include <unistd.h>
#include "windows.h"
#include "winerror.h"
#include "kernel32.h"
#include "handle32.h"
#include "task.h"
#include "stddebug.h"
......
......@@ -10,7 +10,6 @@
#include "windows.h"
#include "winbase.h"
#include "winerror.h"
#include "kernel32.h"
#include "stddebug.h"
#include "debug.h"
#include "xmalloc.h"
......
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