Commit d471965c authored by Alexandre Julliard's avatar Alexandre Julliard

Release 951212

Mon Dec 11 19:08:55 1995 Alexandre Julliard <julliard@sunsite.unc.edu> * [misc/lstr.c] Replaced wine_strncpy() by a 32-bit version of lstrcpyn(), since they do the same job. * [tools/build.c] Fixed __attribute__((stdcall)) to make it compile with gcc versions under 2.7. Doesn't mean it will run OK though... Sat Dec 09 13:22:58 1995 Cameron Heide <heide@ee.ualberta.ca> * [include/kernel32.h] [include/winerror.h] Added file attribute definitions and more error codes. * [win32/error.c] Added some rudimentary errno-to-Win32 error conversion code. * [win32/file.c] Added to GetFileInformationByHandle, filled in some known error codes, and switched to dprintf_win32. * [win32/time.c] Added GetLocalTime. Fri Dec 8 14:37:39 1995 Jim Peterson <jspeter@birch.ee.vt.edu> * [controls/combo.c] Converted functions of the type LONG _(HWND,WORD,LONG) to the type LRESULT _(HWND,WPARAM,LPARAM) where needed. * [include/libres.h] Restructured libres prototypes to closer match the windows API. * [include/windows.h] Changed several API prototypes' parameter types from 'short' to INT, which is #defined as short in the emulator, but is a normal int in WINELIB32. Also changed SEGPTR from DWORD to void* when WINELIB32. (This creates a lot of warnings at library-compile time, but less warnings at app-compile time. I'll remove the warnings soon.) * [loader/resource.c] Fixed parameter mismatch in call to LIBRES_FindResource(). Changed various implementations of the LIBRES_* API functions. * [loader/signal.c] Deleted local 'i' from win_fault(), since it was unused. * [objects/bitblt.c] Mirrored changes to include/windows.h mentioned above. * [toolkit/hello3.c] Changed LoadMenuIndirect() call to LoadMenu() to test the new resource registration technique. * [toolkit/libres.c] Removed definition of 'struct resource' and fixed bugs in the resource implementation. Implemented LIBRES_FindResource. * [windows/graphics.c] Mirrored changes to include/windows.h mentioned above. Thu Dec 7 23:15:56 1995 Martin von Loewis <loewis@informatik.hu-berlin.de> * [controls/edit.c] LOCAL_HeapExists: Changed parameter to HANDLE. For WineLib, return true * [controls/listbox.c] CreateListBoxStruct: Initialize HeapSel to 0 for WineLib * [include/listbox.h] change HeapSel from WORD to HANDLE * [include/resource.h][rc/winerc.c] struct ResourceTable: removed struct resource: moved to header file autoregister resources if supported by compiler * [memory/local.h] LOCAL_GetHeap: expect HANDLE rather than WORD * [toolkit/Makefile.in] Add ALLCFLAGS to make hello3 * [toolkit/heap.c] LocalFree, HEAP_Free: handle 0 parameter gracefully Wed Dec 06 15:34:23 1995 Greg Cooper <cooper@ima-inc.com> * [misc/winsocket.c] Fixed the msgsnd and msgrcv errors that winsock programs get. Wed Dec 06 12:47:23 MET 1995 Sven Verdoolaege <skimo@dns.ufsia.ac.be> * [if1632/kernel.spec] Fixed _hread and _hwrite return type * [if1632/relay32.c] [loader/pe_image.c] Hacked loading of PE-dll's in * [win32/advapi.c] Added stubs for RegCreateKeyEx, RegSetValueEx, RegQueryValueEx * [win32/file.c] Added stubs for OpenFileMapping, CreateFileMapping, MapViewOfFileEx * [win32/process.c] Added stubs for CreateMutexA, ReleaseMutex, CreateEventA, WaitForSingleObject, DuplicateHandle, GetCurrentProcess Mon Dec 04 13:06:37 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [include/wine.h] [misc/lstr.c] Define wine_strncpy(). This function does not pad the buffer with zeroes like GNU strncpy(), which might break some Windows programs that pass bogus size arguments. * [loader/module.c]: GetModuleFileName(), [misc/commdlg.c]: GetFileTitle(), [misc/keyboard.c], [misc/lstr.c]: lstrcpyn(), [misc/ole2nls.c], [misc/profile.c], [multimedia/mcistring.c], [multimedia/mmsystem.c], [objects/font.c]: Use wine_strncpy() where strings are returned to Windows programs. * [objects/metafile.c] PlayMetafile(): Clear the handle table before using it. * [misc/shell.c] [misc/main.c] Rename SHELL_RegCheckForRoot() to SHELL_Init() and call it from main(). * [misc/profile.c] load(): Need to handle comments. * [toolkit/libres.c] Make it compile. * [windows/nonclient.c] Use MAKE_SEGPTR macro in two places where a user heap block used to be allocated instead. Sat Dec 02 16:43:43 1995 Ramon Garcia <ramon@ie3.clubs.etsit.upm.es> * [windows/winpos.c] In function SetWindowPos: do not redraw the parent of a window if the specified window is placed on the top. This avoids that ShowWindow(hwnd,1) hides hwnd instead of showing it. Sat Dec 02 11:00:00 1995 Alex Korobka <alex@phm30.pharm.sunysb.edu> * [windows/scroll.c] Now it can scroll children along with the client region of parent window. Tried to optimize update region calculation. * [windows/mdi.c] ScrollChildren function, more other features added. Basically a rewrite. * [windows/winpos.c] [windows/focus.c] Reimplemented window activation and focus handling. * [windows/nonclient.c] Added new flag WIN_NCACTIVATED. * [windows/message.c] [loader/task.c] Small changes (to maintain linked list of message queues). Wed Nov 29 15:51:48 1995 Daniel Schepler <daniel@shep13.wustl.edu> * [include/options.h] [misc/main.c] [windows/defwnd.c] [windows/event.c] [windows/nonclient.c] [windows/win.c] [Wine.man] Implemented a -managed option to replace the standard Windows frame of top-level windows with the window manager's decorations. If a top-level window makes its own frame, this will still show up, inside the window manager decorations (I believe ctl3dv2.dll would do this, although I can't test this).
parent ade697e8
This is release 951124 of Wine the MS Windows emulator. This is still a This is release 951212 of Wine the MS Windows emulator. This is still a
developer's only release. There are many bugs and many unimplemented API developer's only release. There are many bugs and many unimplemented API
features. Most applications still do not work. features. Most applications still do not work.
Patches should be submitted to "wine-new@amscons.com". Please don't forget Patches should be submitted to "wine-new@amscons.com". Please don't forget
to include a ChangeLog entry. I'll make a new release every other week. to include a ChangeLog entry. I'll make a new release every other week.
WHAT'S NEW with Wine-951124: (see ChangeLog for details) WHAT'S NEW with Wine-951212: (see ChangeLog for details)
- Drag and drop implemented. - Many more Winelib and Win32 fixes.
- Unixware is now fully supported. - Window management and MDI improvements.
- Many Win32 improvements.
- Lots of bug fixes. - Lots of bug fixes.
See the README file in the distribution for installation instructions. See the README file in the distribution for installation instructions.
...@@ -17,11 +16,10 @@ Because of lags created by using mirror, this message may reach you before ...@@ -17,11 +16,10 @@ Because of lags created by using mirror, this message may reach you before
the release is available at the ftp sites. The sources will be available the release is available at the ftp sites. The sources will be available
from the following locations: from the following locations:
sunsite.unc.edu:/pub/Linux/ALPHA/wine/Wine-951124.tar.gz sunsite.unc.edu:/pub/Linux/ALPHA/wine/Wine-951212.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-951124.tar.gz tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-951212.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-951124.tar.gz ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-951212.tar.gz
ftp.funet.fi:/pub/OS/Linux/ALPHA/Wine/Wine-951124.tar.gz aris.com:/pub/linux/ALPHA/Wine/development/Wine-951212.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-951124.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite. It should also be available from any site that mirrors tsx-11 or sunsite.
......
---------------------------------------------------------------------- ----------------------------------------------------------------------
Mon Dec 11 19:08:55 1995 Alexandre Julliard <julliard@sunsite.unc.edu>
* [misc/lstr.c]
Replaced wine_strncpy() by a 32-bit version of lstrcpyn(), since
they do the same job.
* [tools/build.c]
Fixed __attribute__((stdcall)) to make it compile with gcc
versions under 2.7. Doesn't mean it will run OK though...
Sat Dec 09 13:22:58 1995 Cameron Heide <heide@ee.ualberta.ca>
* [include/kernel32.h] [include/winerror.h]
Added file attribute definitions and more error codes.
* [win32/error.c]
Added some rudimentary errno-to-Win32 error conversion
code.
* [win32/file.c]
Added to GetFileInformationByHandle, filled in some known
error codes, and switched to dprintf_win32.
* [win32/time.c]
Added GetLocalTime.
Fri Dec 8 14:37:39 1995 Jim Peterson <jspeter@birch.ee.vt.edu>
* [controls/combo.c]
Converted functions of the type LONG _(HWND,WORD,LONG) to the type
LRESULT _(HWND,WPARAM,LPARAM) where needed.
* [include/libres.h]
Restructured libres prototypes to closer match the windows API.
* [include/windows.h]
Changed several API prototypes' parameter types from 'short' to INT,
which is #defined as short in the emulator, but is a normal int in
WINELIB32. Also changed SEGPTR from DWORD to void* when WINELIB32.
(This creates a lot of warnings at library-compile time, but less
warnings at app-compile time. I'll remove the warnings soon.)
* [loader/resource.c]
Fixed parameter mismatch in call to LIBRES_FindResource(). Changed
various implementations of the LIBRES_* API functions.
* [loader/signal.c]
Deleted local 'i' from win_fault(), since it was unused.
* [objects/bitblt.c]
Mirrored changes to include/windows.h mentioned above.
* [toolkit/hello3.c]
Changed LoadMenuIndirect() call to LoadMenu() to test the new
resource registration technique.
* [toolkit/libres.c]
Removed definition of 'struct resource' and fixed bugs in the resource
implementation. Implemented LIBRES_FindResource.
* [windows/graphics.c]
Mirrored changes to include/windows.h mentioned above.
Thu Dec 7 23:15:56 1995 Martin von Loewis <loewis@informatik.hu-berlin.de>
* [controls/edit.c]
LOCAL_HeapExists: Changed parameter to HANDLE. For WineLib, return true
* [controls/listbox.c]
CreateListBoxStruct: Initialize HeapSel to 0 for WineLib
* [include/listbox.h]
change HeapSel from WORD to HANDLE
* [include/resource.h][rc/winerc.c]
struct ResourceTable: removed
struct resource: moved to header file
autoregister resources if supported by compiler
* [memory/local.h]
LOCAL_GetHeap: expect HANDLE rather than WORD
* [toolkit/Makefile.in]
Add ALLCFLAGS to make hello3
* [toolkit/heap.c]
LocalFree, HEAP_Free: handle 0 parameter gracefully
Wed Dec 06 15:34:23 1995 Greg Cooper <cooper@ima-inc.com>
* [misc/winsocket.c]
Fixed the msgsnd and msgrcv errors that winsock programs get.
Wed Dec 06 12:47:23 MET 1995 Sven Verdoolaege <skimo@dns.ufsia.ac.be>
* [if1632/kernel.spec]
Fixed _hread and _hwrite return type
* [if1632/relay32.c] [loader/pe_image.c]
Hacked loading of PE-dll's in
* [win32/advapi.c]
Added stubs for RegCreateKeyEx, RegSetValueEx, RegQueryValueEx
* [win32/file.c]
Added stubs for OpenFileMapping, CreateFileMapping, MapViewOfFileEx
* [win32/process.c]
Added stubs for CreateMutexA, ReleaseMutex, CreateEventA,
WaitForSingleObject, DuplicateHandle, GetCurrentProcess
Mon Dec 04 13:06:37 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
* [include/wine.h] [misc/lstr.c]
Define wine_strncpy(). This function does not pad the buffer with
zeroes like GNU strncpy(), which might break some Windows programs
that pass bogus size arguments.
* [loader/module.c]: GetModuleFileName(),
[misc/commdlg.c]: GetFileTitle(),
[misc/keyboard.c], [misc/lstr.c]: lstrcpyn(),
[misc/ole2nls.c], [misc/profile.c], [multimedia/mcistring.c],
[multimedia/mmsystem.c], [objects/font.c]:
Use wine_strncpy() where strings are returned to Windows programs.
* [objects/metafile.c]
PlayMetafile(): Clear the handle table before using it.
* [misc/shell.c] [misc/main.c]
Rename SHELL_RegCheckForRoot() to SHELL_Init() and call it from main().
* [misc/profile.c]
load(): Need to handle comments.
* [toolkit/libres.c]
Make it compile.
* [windows/nonclient.c]
Use MAKE_SEGPTR macro in two places where a user heap block used
to be allocated instead.
Sat Dec 02 16:43:43 1995 Ramon Garcia <ramon@ie3.clubs.etsit.upm.es>
* [windows/winpos.c]
In function SetWindowPos: do not redraw the parent of
a window if the specified window is placed on the top.
This avoids that ShowWindow(hwnd,1) hides hwnd instead
of showing it.
Sat Dec 02 11:00:00 1995 Alex Korobka <alex@phm30.pharm.sunysb.edu>
* [windows/scroll.c]
Now it can scroll children along with the client region of parent
window. Tried to optimize update region calculation.
* [windows/mdi.c]
ScrollChildren function, more other features added. Basically
a rewrite.
* [windows/winpos.c] [windows/focus.c]
Reimplemented window activation and focus handling.
* [windows/nonclient.c]
Added new flag WIN_NCACTIVATED.
* [windows/message.c] [loader/task.c]
Small changes (to maintain linked list of message queues).
Wed Nov 29 15:51:48 1995 Daniel Schepler <daniel@shep13.wustl.edu>
* [include/options.h] [misc/main.c] [windows/defwnd.c]
[windows/event.c] [windows/nonclient.c] [windows/win.c] [Wine.man]
Implemented a -managed option to replace the standard Windows
frame of top-level windows with the window manager's decorations.
If a top-level window makes its own frame, this will still show
up, inside the window manager decorations (I believe ctl3dv2.dll
would do this, although I can't test this).
----------------------------------------------------------------------
Tue Nov 21 18:49:10 1995 Alexandre Julliard <julliard@sunsite.unc.edu> Tue Nov 21 18:49:10 1995 Alexandre Julliard <julliard@sunsite.unc.edu>
* [configure.in] [Makefile] [misc/dos_fs.c] * [configure.in] [Makefile] [misc/dos_fs.c]
......
...@@ -67,6 +67,14 @@ Start as an icon ...@@ -67,6 +67,14 @@ Start as an icon
.I -debug .I -debug
Enter the debugger before starting application Enter the debugger before starting application
.TP .TP
.I -language xx
Set the language to
.I xx
(one of En, Es, De, No, Fr, Fi, Da)
.TP
.I -managed
Create each top-level window as a properly managed X window
.TP
.I -name name .I -name name
Set the application name Set the application name
.TP .TP
......
...@@ -2210,10 +2210,13 @@ static void EDIT_WM_Paint(HWND hwnd) ...@@ -2210,10 +2210,13 @@ static void EDIT_WM_Paint(HWND hwnd)
EndPaint(hwnd, &ps); EndPaint(hwnd, &ps);
} }
static BOOL LOCAL_HeapExists(WORD ds) static BOOL LOCAL_HeapExists(HANDLE ds)
{ {
/* There is always a local heap in WineLib */
#ifndef WINELIB
INSTANCEDATA *ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( ds, 0 ); INSTANCEDATA *ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( ds, 0 );
if (!ptr->heap) return 0; if (!ptr->heap) return 0;
#endif
return 1; return 1;
} }
...@@ -2249,7 +2252,7 @@ static long EDIT_WM_NCCreate(HWND hwnd, LONG lParam) ...@@ -2249,7 +2252,7 @@ static long EDIT_WM_NCCreate(HWND hwnd, LONG lParam)
{ {
DWORD globalSize; DWORD globalSize;
globalSize = GlobalSize(ds); globalSize = GlobalSize(ds);
printf("No local heap allocated global size is %d 0x%x\n",globalSize, globalSize); dprintf_edit(stddeb, "No local heap allocated global size is %ld 0x%lx\n",globalSize, globalSize);
/* /*
* I assume the local heap should start at 0 * I assume the local heap should start at 0
*/ */
......
...@@ -111,8 +111,13 @@ void CreateListBoxStruct(HWND hwnd, WORD CtlType, LONG styles, HWND parent) ...@@ -111,8 +111,13 @@ void CreateListBoxStruct(HWND hwnd, WORD CtlType, LONG styles, HWND parent)
HeapBase = GlobalLock(HeapHandle); HeapBase = GlobalLock(HeapHandle);
HEAP_Init(&lphl->Heap, HeapBase, LIST_HEAP_SIZE); HEAP_Init(&lphl->Heap, HeapBase, LIST_HEAP_SIZE);
#endif #endif
/* WINELIBS list boxes do not operate on local heaps */
#ifndef WINELIB
lphl->HeapSel = GlobalAlloc(GMEM_FIXED,LIST_HEAP_SIZE); lphl->HeapSel = GlobalAlloc(GMEM_FIXED,LIST_HEAP_SIZE);
LocalInit( lphl->HeapSel, 0, LIST_HEAP_SIZE-1); LocalInit( lphl->HeapSel, 0, LIST_HEAP_SIZE-1);
#else
lphl->HeapSel = 0;
#endif
} }
void DestroyListBoxStruct(LPHEADLIST lphl) void DestroyListBoxStruct(LPHEADLIST lphl)
...@@ -896,6 +901,8 @@ static LONG LBLButtonDown(HWND hwnd, WORD wParam, LONG lParam) ...@@ -896,6 +901,8 @@ static LONG LBLButtonDown(HWND hwnd, WORD wParam, LONG lParam)
int y; int y;
RECT rectsel; RECT rectsel;
LONG dwStyle = GetWindowLong(lphl->hSelf,GWL_STYLE); LONG dwStyle = GetWindowLong(lphl->hSelf,GWL_STYLE);
POINT tmpPOINT;
tmpPOINT.x = LOWORD(lParam); tmpPOINT.y = HIWORD(lParam);
SetFocus(hwnd); SetFocus(hwnd);
SetCapture(hwnd); SetCapture(hwnd);
...@@ -928,11 +935,11 @@ static LONG LBLButtonDown(HWND hwnd, WORD wParam, LONG lParam) ...@@ -928,11 +935,11 @@ static LONG LBLButtonDown(HWND hwnd, WORD wParam, LONG lParam)
if (dwStyle & LBS_NOTIFY) if (dwStyle & LBS_NOTIFY)
SendMessage(lphl->hParent, WM_LBTRACKPOINT, y, lParam); SendMessage(lphl->hParent, WM_LBTRACKPOINT, y, lParam);
#ifndef WINELIB
if (GetWindowLong(lphl->hSelf,GWL_EXSTYLE) & WS_EX_DRAGDETECT) if (GetWindowLong(lphl->hSelf,GWL_EXSTYLE) & WS_EX_DRAGDETECT)
if( DragDetect(lphl->hSelf,MAKEPOINT(lParam)) ) if( DragDetect(lphl->hSelf,tmpPOINT) )
SendMessage(lphl->hParent, WM_BEGINDRAG,0,0L); SendMessage(lphl->hParent, WM_BEGINDRAG,0,0L);
#endif
return 0; return 0;
} }
......
...@@ -127,11 +127,11 @@ base 1 ...@@ -127,11 +127,11 @@ base 1
0123 stub QueryServiceStatus 0123 stub QueryServiceStatus
0124 stub ReadEventLogA 0124 stub ReadEventLogA
0125 stub ReadEventLogW 0125 stub ReadEventLogW
0126 stub RegCloseKey 0126 stdcall RegCloseKey(long) RegCloseKey
0127 stub RegConnectRegistryA 0127 stub RegConnectRegistryA
0128 stub RegConnectRegistryW 0128 stub RegConnectRegistryW
0129 stub RegCreateKeyA 0129 stub RegCreateKeyA
0130 stub RegCreateKeyExA 0130 stdcall RegCreateKeyExA(long ptr long ptr long long ptr ptr ptr) RegCreateKeyEx
0131 stub RegCreateKeyExW 0131 stub RegCreateKeyExW
0132 stub RegCreateKeyW 0132 stub RegCreateKeyW
0133 stub RegDeleteKeyA 0133 stub RegDeleteKeyA
...@@ -158,7 +158,7 @@ base 1 ...@@ -158,7 +158,7 @@ base 1
0154 stub RegQueryMultipleValuesA 0154 stub RegQueryMultipleValuesA
0155 stub RegQueryMultipleValuesW 0155 stub RegQueryMultipleValuesW
0156 stub RegQueryValueA 0156 stub RegQueryValueA
0157 stub RegQueryValueExA 0157 stdcall RegQueryValueExA(long ptr long long ptr ptr) RegQueryValueEx
0158 stub RegQueryValueExW 0158 stub RegQueryValueExW
0159 stub RegQueryValueW 0159 stub RegQueryValueW
0160 stub RegRemapPreDefKey 0160 stub RegRemapPreDefKey
...@@ -170,7 +170,7 @@ base 1 ...@@ -170,7 +170,7 @@ base 1
0166 stub RegSaveKeyW 0166 stub RegSaveKeyW
0167 stub RegSetKeySecurity 0167 stub RegSetKeySecurity
0168 stub RegSetValueA 0168 stub RegSetValueA
0169 stub RegSetValueExA 0169 stdcall RegSetValueExA(long ptr long long ptr long) RegSetValueEx
0170 stub RegSetValueExW 0170 stub RegSetValueExW
0171 stub RegSetValueW 0171 stub RegSetValueW
0172 stub RegUnLoadKeyA 0172 stub RegUnLoadKeyA
......
...@@ -256,11 +256,11 @@ id 1 ...@@ -256,11 +256,11 @@ id 1
346 pascal16 IsBadHugeReadPtr(segptr long) IsBadHugeReadPtr 346 pascal16 IsBadHugeReadPtr(segptr long) IsBadHugeReadPtr
347 pascal16 IsBadHugeWritePtr(segptr long) IsBadHugeWritePtr 347 pascal16 IsBadHugeWritePtr(segptr long) IsBadHugeWritePtr
348 pascal hmemcpy(ptr ptr long) hmemcpy 348 pascal hmemcpy(ptr ptr long) hmemcpy
349 pascal16 _hread(word ptr long) _hread 349 pascal _hread(word ptr long) _hread
350 pascal16 _hwrite(word ptr long) _hwrite 350 pascal _hwrite(word ptr long) _hwrite
#351 BUNNY_351 #351 BUNNY_351
352 stub lstrcatn 352 stub lstrcatn
353 pascal lstrcpyn(segptr segptr word) lstrcpyn 353 pascal lstrcpyn(segptr segptr word) WIN16_lstrcpyn
354 stub GetAppCompatFlags 354 stub GetAppCompatFlags
355 pascal16 GetWinDebugInfo(ptr word) GetWinDebugInfo 355 pascal16 GetWinDebugInfo(ptr word) GetWinDebugInfo
356 pascal16 SetWinDebugInfo(ptr) SetWinDebugInfo 356 pascal16 SetWinDebugInfo(ptr) SetWinDebugInfo
......
...@@ -44,16 +44,16 @@ base 1 ...@@ -44,16 +44,16 @@ base 1
0040 stub CreateDirectoryExA 0040 stub CreateDirectoryExA
0041 stub CreateDirectoryExW 0041 stub CreateDirectoryExW
0042 stub CreateDirectoryW 0042 stub CreateDirectoryW
0043 stub CreateEventA 0043 stdcall CreateEventA(ptr long long ptr) CreateEventA
0044 stub CreateEventW 0044 stub CreateEventW
0045 stdcall CreateFileA(ptr long long ptr long long long) CreateFileA 0045 stdcall CreateFileA(ptr long long ptr long long long) CreateFileA
0046 stub CreateFileMappingA 0046 stdcall CreateFileMappingA(long ptr long long long ptr) CreateFileMapping
0047 stub CreateFileMappingW 0047 stub CreateFileMappingW
0048 stub CreateFileW 0048 stub CreateFileW
0049 stub CreateIoCompletionPort 0049 stub CreateIoCompletionPort
0050 stub CreateMailslotA 0050 stub CreateMailslotA
0051 stub CreateMailslotW 0051 stub CreateMailslotW
0052 stub CreateMutexA 0052 stdcall CreateMutexA(ptr long ptr) CreateMutexA
0053 stub CreateMutexW 0053 stub CreateMutexW
0054 stub CreateNamedPipeA 0054 stub CreateNamedPipeA
0055 stub CreateNamedPipeW 0055 stub CreateNamedPipeW
...@@ -79,7 +79,7 @@ base 1 ...@@ -79,7 +79,7 @@ base 1
0075 stub DisconnectNamedPipe 0075 stub DisconnectNamedPipe
0076 stub DosDateTimeToFileTime 0076 stub DosDateTimeToFileTime
0077 stub DuplicateConsoleHandle 0077 stub DuplicateConsoleHandle
0078 stub DuplicateHandle 0078 stdcall DuplicateHandle(long long long ptr long long long) DuplicateHandle
0079 stub EndUpdateResourceA 0079 stub EndUpdateResourceA
0080 stub EndUpdateResourceW 0080 stub EndUpdateResourceW
0081 stub EnterCriticalSection 0081 stub EnterCriticalSection
...@@ -199,9 +199,9 @@ base 1 ...@@ -199,9 +199,9 @@ base 1
0195 stub GetCurrentConsoleFont 0195 stub GetCurrentConsoleFont
0196 stub GetCurrentDirectoryA 0196 stub GetCurrentDirectoryA
0197 stub GetCurrentDirectoryW 0197 stub GetCurrentDirectoryW
0198 stub GetCurrentProcess 0198 stdcall GetCurrentProcess() GetCurrentProcess
0199 stdcall GetCurrentProcessId() GetCurrentThreadId 0199 stdcall GetCurrentProcessId() GetCurrentThreadId
0200 stub GetCurrentThread 0200 stdcall GetCurrentThread() GetCurrentThread
0201 stdcall GetCurrentThreadId() GetCurrentThreadId 0201 stdcall GetCurrentThreadId() GetCurrentThreadId
0202 stub GetDateFormatA 0202 stub GetDateFormatA
0203 stub GetDateFormatW 0203 stub GetDateFormatW
...@@ -229,7 +229,7 @@ base 1 ...@@ -229,7 +229,7 @@ base 1
0225 stub GetHandleInformation 0225 stub GetHandleInformation
0226 stub GetLargestConsoleWindowSize 0226 stub GetLargestConsoleWindowSize
0227 stdcall GetLastError() GetLastError 0227 stdcall GetLastError() GetLastError
0228 stub GetLocalTime 0228 stdcall GetLocalTime(ptr) GetLocalTime
0229 stub GetLocaleInfoA 0229 stub GetLocaleInfoA
0230 stub GetLocaleInfoW 0230 stub GetLocaleInfoW
0231 stub GetLogicalDriveStringsA 0231 stub GetLogicalDriveStringsA
...@@ -388,7 +388,7 @@ base 1 ...@@ -388,7 +388,7 @@ base 1
0383 stub LockFileEx 0383 stub LockFileEx
0384 stub LockResource 0384 stub LockResource
0385 stub MapViewOfFile 0385 stub MapViewOfFile
0386 stub MapViewOfFileEx 0386 stdcall MapViewOfFileEx(long long long long long long) MapViewOfFileEx
0387 stub MoveFileA 0387 stub MoveFileA
0388 stub MoveFileExA 0388 stub MoveFileExA
0389 stub MoveFileExW 0389 stub MoveFileExW
...@@ -399,7 +399,7 @@ base 1 ...@@ -399,7 +399,7 @@ base 1
0394 stub OpenEventA 0394 stub OpenEventA
0395 stub OpenEventW 0395 stub OpenEventW
0396 stub OpenFile 0396 stub OpenFile
0397 stub OpenFileMappingA 0397 stdcall OpenFileMappingA(long long ptr) OpenFileMapping
0398 stub OpenFileMappingW 0398 stub OpenFileMappingW
0399 stub OpenMutexA 0399 stub OpenMutexA
0400 stub OpenMutexW 0400 stub OpenMutexW
...@@ -437,11 +437,11 @@ base 1 ...@@ -437,11 +437,11 @@ base 1
0432 stub RegisterWaitForInputIdle 0432 stub RegisterWaitForInputIdle
0433 stub RegisterWowBaseHandlers 0433 stub RegisterWowBaseHandlers
0434 stub RegisterWowExec 0434 stub RegisterWowExec
0435 stub ReleaseMutex 0435 stdcall ReleaseMutex(long) ReleaseMutex
0436 stub ReleaseSemaphore 0436 stub ReleaseSemaphore
0437 stub RemoveDirectoryA 0437 stub RemoveDirectoryA
0438 stub RemoveDirectoryW 0438 stub RemoveDirectoryW
0439 stub ResetEvent 0439 stdcall ResetEvent(long) ResetEvent
0440 stub ResumeThread 0440 stub ResumeThread
0441 stub RtlFillMemory 0441 stub RtlFillMemory
0442 stub RtlMoveMemory 0442 stub RtlMoveMemory
...@@ -489,7 +489,7 @@ base 1 ...@@ -489,7 +489,7 @@ base 1
0484 stdcall SetEnvironmentVariableA(ptr ptr) SetEnvironmentVariableA 0484 stdcall SetEnvironmentVariableA(ptr ptr) SetEnvironmentVariableA
0485 stub SetEnvironmentVariableW 0485 stub SetEnvironmentVariableW
0486 stub SetErrorMode 0486 stub SetErrorMode
0487 stub SetEvent 0487 stdcall SetEvent(long) SetEvent
0488 stub SetFileApisToANSI 0488 stub SetFileApisToANSI
0489 stub SetFileApisToOEM 0489 stub SetFileApisToOEM
0490 stub SetFileAttributesA 0490 stub SetFileAttributesA
...@@ -563,7 +563,7 @@ base 1 ...@@ -563,7 +563,7 @@ base 1
0558 stub WaitForDebugEvent 0558 stub WaitForDebugEvent
0559 stub WaitForMultipleObjects 0559 stub WaitForMultipleObjects
0560 stub WaitForMultipleObjectsEx 0560 stub WaitForMultipleObjectsEx
0561 stub WaitForSingleObject 0561 stdcall WaitForSingleObject(long long) WaitForSingleObject
0562 stub WaitForSingleObjectEx 0562 stub WaitForSingleObjectEx
0563 stub WaitNamedPipeA 0563 stub WaitNamedPipeA
0564 stub WaitNamedPipeW 0564 stub WaitNamedPipeW
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "windows.h" #include "windows.h"
#include "dlls.h" #include "dlls.h"
#include "pe_image.h" #include "pe_image.h"
#include "peexe.h"
#include "relay32.h" #include "relay32.h"
#include "stddebug.h" #include "stddebug.h"
/* #define DEBUG_RELAY */ /* #define DEBUG_RELAY */
...@@ -48,8 +49,12 @@ int RELAY32_Init(void) ...@@ -48,8 +49,12 @@ int RELAY32_Init(void)
WIN32_builtin *RELAY32_GetBuiltinDLL(char *name) WIN32_builtin *RELAY32_GetBuiltinDLL(char *name)
{ {
WIN32_builtin *it; WIN32_builtin *it;
size_t len;
char *cp;
len = (cp=strchr(name,'.')) ? (cp-name) : strlen(name);
for(it=WIN32_builtin_list;it;it=it->next) for(it=WIN32_builtin_list;it;it=it->next)
if(strcasecmp(name,it->name)==0) if(strncasecmp(name,it->name,len)==0)
return it; return it;
return NULL; return NULL;
} }
...@@ -71,10 +76,57 @@ void *RELAY32_GetEntryPoint(char *dll_name, char *item, int hint) ...@@ -71,10 +76,57 @@ void *RELAY32_GetEntryPoint(char *dll_name, char *item, int hint)
{ {
WIN32_builtin *dll; WIN32_builtin *dll;
int i; int i;
u_short * ordinal;
u_long * function;
u_char ** name, *ename;
struct PE_Export_Directory * pe_exports;
unsigned int load_addr;
dprintf_module(stddeb, "Looking for %s in %s, hint %x\n", dprintf_module(stddeb, "Looking for %s in %s, hint %x\n",
item ? item: "(no name)", dll_name, hint); item ? item: "(no name)", dll_name, hint);
dll=RELAY32_GetBuiltinDLL(dll_name); dll=RELAY32_GetBuiltinDLL(dll_name);
if(!dll)return 0; if(!dll) {
if(!wine_files || !wine_files->name ||
strcasecmp(dll_name, wine_files->name)) {
LoadModule(dll_name, (LPVOID) -1);
if(!wine_files || !wine_files->name ||
strcasecmp(dll_name, wine_files->name))
return 0;
}
load_addr = wine_files->load_addr;
pe_exports = wine_files->pe->pe_export;
ordinal = (u_short *) (((char *) load_addr) + (int) pe_exports->Address_Of_Name_Ordinals);
function = (u_long *) (((char *) load_addr) + (int) pe_exports->AddressOfFunctions);
name = (u_char **) (((char *) load_addr) + (int) pe_exports->AddressOfNames);
/* import by ordinal */
if(!item){
return 0;
}
/* hint is correct */
#if 0
if(hint && hint<dll->size &&
dll->functions[hint].name &&
strcmp(item,dll->functions[hint].name)==0)
return dll->functions[hint].definition;
#endif
/* hint is incorrect, search for name */
for(i=0;i<pe_exports->Number_Of_Functions;i++)
if (name[i] && !strcmp(item,name[i]+load_addr))
return function[i]+(char *)load_addr;
/* function at hint has no name (unimplemented) */
#if 0
if(hint && hint<dll->size && !dll->functions[hint].name)
{
dll->functions[hint].name=strdup(item);
dprintf_module(stddeb, "Returning unimplemented function %s.%d\n",
dll_name,hint);
return dll->functions[hint].definition;
}
#endif
printf("Not found\n");
return 0;
}
/* import by ordinal */ /* import by ordinal */
if(!item){ if(!item){
if(hint && hint<dll->size)return dll->functions[hint].definition; if(hint && hint<dll->size)return dll->functions[hint].definition;
......
...@@ -409,7 +409,7 @@ id 2 ...@@ -409,7 +409,7 @@ id 2
460 pascal16 GetInternalWindowPos(word ptr ptr) GetInternalWindowPos 460 pascal16 GetInternalWindowPos(word ptr ptr) GetInternalWindowPos
461 pascal16 SetInternalWindowPos(word word ptr ptr) SetInternalWindowPos 461 pascal16 SetInternalWindowPos(word word ptr ptr) SetInternalWindowPos
462 pascal16 CalcChildScroll(word word) CalcChildScroll 462 pascal16 CalcChildScroll(word word) CalcChildScroll
463 stub ScrollChildren 463 pascal16 ScrollChildren(word word word long) ScrollChildren
464 pascal DragObject(word word word word word word) DragObject 464 pascal DragObject(word word word word word word) DragObject
465 pascal16 DragDetect(word long) DragDetect 465 pascal16 DragDetect(word long) DragDetect
466 pascal16 DrawFocusRect(word ptr) DrawFocusRect 466 pascal16 DrawFocusRect(word ptr) DrawFocusRect
......
...@@ -29,6 +29,7 @@ id 24 ...@@ -29,6 +29,7 @@ id 24
26 register Win32CallToStart() PE_Win32CallToStart 26 register Win32CallToStart() PE_Win32CallToStart
27 pascal EntryAddrProc(word word) MODULE_GetEntryPoint 27 pascal EntryAddrProc(word word) MODULE_GetEntryPoint
28 pascal MyAlloc(word word word) MODULE_AllocateSegment 28 pascal MyAlloc(word word word) MODULE_AllocateSegment
29 pascal16 ActivateAppProc(word long) ACTIVATEAPP_callback
# Interrupt vectors 0-255 are ordinals 100-355 # Interrupt vectors 0-255 are ordinals 100-355
# The 'word' parameter are the flags pushed on the stack by the interrupt # The 'word' parameter are the flags pushed on the stack by the interrupt
......
#ifndef __WINE_ADVAPI32_H
#define __WINE_ADVAPI32_H
#include "shell.h"
#include "kernel32.h"
#define REGSAM long
BOOL WINAPI GetUserNameA (char * lpBuffer, DWORD *nSize);
WINAPI LONG RegCreateKeyEx(HKEY key,
const char *subkey,
long dontuse,
const char *keyclass,
DWORD options,
REGSAM sam,
SECURITY_ATTRIBUTES *atts,
HKEY *res,
DWORD *disp);
WINAPI LONG RegSetValueExA (HKEY key,
const char *name,
DWORD dontuse,
DWORD type,
const void* data,
DWORD len
);
WINAPI LONG RegQueryValueExA(HKEY key,
const char *subkey,
DWORD dontuse,
DWORD *type,
void *ptr,
DWORD *len);
#endif /* __WINE_ADVAPI32_H */
...@@ -12,10 +12,6 @@ ...@@ -12,10 +12,6 @@
#define MAX_NAME_LENGTH 64 #define MAX_NAME_LENGTH 64
#define DLL 0
#define EXE 1
struct dll_table_s struct dll_table_s
{ {
char * name; /* DLL name */ char * name; /* DLL name */
......
...@@ -41,6 +41,13 @@ typedef struct { ...@@ -41,6 +41,13 @@ typedef struct {
} FILE_OBJECT; } FILE_OBJECT;
typedef struct { typedef struct {
KERNEL_OBJECT common;
FILE_OBJECT *file_obj;
int prot;
unsigned long size;
} FILEMAP_OBJECT;
typedef struct {
KERNEL_OBJECT common; KERNEL_OBJECT common;
} SEMAPHORE_OBJECT; } SEMAPHORE_OBJECT;
...@@ -65,6 +72,7 @@ typedef struct { ...@@ -65,6 +72,7 @@ typedef struct {
#define KERNEL_OBJECT_SEMAPHORE (KERNEL_OBJECT_UNUSED + 4) #define KERNEL_OBJECT_SEMAPHORE (KERNEL_OBJECT_UNUSED + 4)
#define KERNEL_OBJECT_EVENT (KERNEL_OBJECT_UNUSED + 5) #define KERNEL_OBJECT_EVENT (KERNEL_OBJECT_UNUSED + 5)
#define KERNEL_OBJECT_REGKEY (KERNEL_OBJECT_UNUSED + 6) #define KERNEL_OBJECT_REGKEY (KERNEL_OBJECT_UNUSED + 6)
#define KERNEL_OBJECT_FILEMAP (KERNEL_OBJECT_UNUSED + 7)
/* Define the invalid handle value /* Define the invalid handle value
*/ */
......
...@@ -106,11 +106,14 @@ typedef struct { ...@@ -106,11 +106,14 @@ typedef struct {
#define STD_OUTPUT_HANDLE ((DWORD) -11) #define STD_OUTPUT_HANDLE ((DWORD) -11)
#define STD_ERROR_HANDLE ((DWORD) -12) #define STD_ERROR_HANDLE ((DWORD) -12)
/* The security attributes structure (not filled in yet) /* The security attributes structure
*/ */
typedef struct { typedef struct {
void *junk; DWORD nLength;
void *lpSecurityDescriptor;
BOOL bInheritHandle;
} SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; } SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
typedef struct typedef struct
{ {
int dwLowDateTime; int dwLowDateTime;
...@@ -131,4 +134,17 @@ typedef struct ...@@ -131,4 +134,17 @@ typedef struct
int nFileIndexLow; int nFileIndexLow;
} BY_HANDLE_FILE_INFORMATION ; } 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
#endif /* __WINE_KERNEL32_H */ #endif /* __WINE_KERNEL32_H */
...@@ -4,16 +4,21 @@ ...@@ -4,16 +4,21 @@
#ifndef __WINE_LIBRES_H #ifndef __WINE_LIBRES_H
#define __WINE_LIBRES_H #define __WINE_LIBRES_H
#ifdef WINELIB
#include "windows.h" #include "windows.h"
#include "resource.h"
#ifdef WINELIB void LIBRES_RegisterResources(struct resource** Res);
HRSRC LIBRES_FindResource( HMODULE hModule, SEGPTR name, SEGPTR type );
HGLOBAL LIBRES_LoadResource( HMODULE hModule, HRSRC hRsrc ); INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC hRsrc );
LPSTR LIBRES_LockResource( HMODULE hModule, HGLOBAL handle ); HGLOBAL LIBRES_AllocResource( HINSTANCE hModule, HRSRC hRsrc, DWORD size );
BOOL LIBRES_FreeResource( HMODULE hModule, HGLOBAL handle ); HRSRC LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type );
INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC hRsrc ); BOOL LIBRES_FreeResource( HGLOBAL handle );
DWORD LIBRES_SizeofResource( HMODULE hModule, HRSRC hRsrc ); HGLOBAL LIBRES_LoadResource( HINSTANCE hModule, HRSRC hRsrc );
HGLOBAL LIBRES_AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size ); LPVOID LIBRES_LockResource( HGLOBAL handle );
#endif DWORD LIBRES_SizeofResource( HINSTANCE hModule, HRSRC hRsrc );
#endif /* WINELIB */
#endif #endif
...@@ -34,7 +34,7 @@ typedef struct { ...@@ -34,7 +34,7 @@ typedef struct {
LPINT TabStops; LPINT TabStops;
HANDLE hDrawItemStruct; HANDLE hDrawItemStruct;
BOOL needMeasure; BOOL needMeasure;
WORD HeapSel; HANDLE HeapSel;
/* MDESC *Heap; */ /* MDESC *Heap; */
} HEADLIST,*LPHEADLIST; } HEADLIST,*LPHEADLIST;
......
/* MDI.H /* MDI.H
* *
* Copyright 1994, Bob Amstadt * Copyright 1994, Bob Amstadt
* 1995 Alex Korobka
* *
* MDI structure definitions. * MDI structure definitions.
*/ */
...@@ -10,29 +11,32 @@ ...@@ -10,29 +11,32 @@
#include "windows.h" #include "windows.h"
#define MDI_MAXLISTLENGTH 64 #define MDI_MAXLISTLENGTH 0x40
#define WM_MDICALCCHILDSCROLL 0x10AC /* this is exactly what Windows uses */
extern LRESULT MDIClientWndProc(HWND hwnd, UINT message, extern LRESULT MDIClientWndProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam); /* mdi.c */ WPARAM wParam, LPARAM lParam); /* mdi.c */
typedef struct tagMDIWCL
typedef struct
{ {
HLOCAL next, prev; HWND hChild;
HWND hwnd; struct tagMDIWCL *prev;
} MDICHILDINFO; } MDIWCL;
typedef struct typedef struct
{ {
HMENU hWindowMenu;
HLOCAL infoActiveChildren;
WORD nActiveChildren; WORD nActiveChildren;
WORD idFirstChild; HWND flagChildMaximized;
HWND hwndActiveChild; HWND hwndActiveChild;
HMENU hWindowMenu;
WORD idFirstChild; /* order is 3.1-like up to this point */
WORD sbStop;
WORD sbRecalc;
HWND hwndHitTest; HWND hwndHitTest;
BOOL flagMenuAltered;
BOOL flagChildMaximized;
RECT rectMaximize; RECT rectMaximize;
RECT rectRestore; RECT rectRestore;
} MDICLIENTINFO; } MDICLIENTINFO;
#endif /* MDI_H */ #endif /* MDI_H */
...@@ -70,6 +70,8 @@ extern void MSG_DecTimerCount( HANDLE hQueue ); ...@@ -70,6 +70,8 @@ extern void MSG_DecTimerCount( HANDLE hQueue );
extern void MSG_Synchronize(); extern void MSG_Synchronize();
extern BOOL MSG_WaitXEvent( LONG maxWait ); extern BOOL MSG_WaitXEvent( LONG maxWait );
extern BOOL MSG_CreateSysMsgQueue( int size ); extern BOOL MSG_CreateSysMsgQueue( int size );
extern BOOL MSG_DeleteMsgQueue( HANDLE hQueue );
extern HTASK MSG_GetQueueTask( HANDLE hQueue );
extern void hardware_event( WORD message, WORD wParam, LONG lParam, extern void hardware_event( WORD message, WORD wParam, LONG lParam,
int xPos, int yPos, DWORD time, DWORD extraInfo ); int xPos, int yPos, DWORD time, DWORD extraInfo );
extern BOOL MSG_GetHardwareMessage( LPMSG msg ); extern BOOL MSG_GetHardwareMessage( LPMSG msg );
......
...@@ -16,7 +16,6 @@ struct dosdirent { ...@@ -16,7 +16,6 @@ struct dosdirent {
char search_attribute; char search_attribute;
long filesize; long filesize;
long filetime; long filetime;
int telldirnum;
short entnum; /* Directory entry number */ short entnum; /* Directory entry number */
struct dosdirent *next; struct dosdirent *next;
}; };
......
...@@ -34,6 +34,7 @@ struct options ...@@ -34,6 +34,7 @@ struct options
int enhanced; /* Start Wine in enhanced mode */ int enhanced; /* Start Wine in enhanced mode */
int ipc; /* Use IPC mechanisms */ int ipc; /* Use IPC mechanisms */
WINE_LANGUAGE language; /* Current language */ WINE_LANGUAGE language; /* Current language */
int managed; /* Managed windows */
}; };
extern struct options Options; extern struct options Options;
......
...@@ -25,6 +25,7 @@ struct w_files ...@@ -25,6 +25,7 @@ struct w_files
struct mz_header_s *mz_header; struct mz_header_s *mz_header;
struct pe_data *pe; struct pe_data *pe;
OFSTRUCT ofs; OFSTRUCT ofs;
unsigned int load_addr;
}; };
...@@ -33,6 +34,7 @@ extern int PE_StartProgram(struct w_files *wpnt); ...@@ -33,6 +34,7 @@ extern int PE_StartProgram(struct w_files *wpnt);
extern void PE_InitDLL(struct w_files *wpnt); extern void PE_InitDLL(struct w_files *wpnt);
extern HINSTANCE PE_LoadImage(struct w_files *wpnt); extern HINSTANCE PE_LoadImage(struct w_files *wpnt);
extern void my_wcstombs(char * result, u_short * source, int len); extern void my_wcstombs(char * result, u_short * source, int len);
extern struct w_files *wine_files;
typedef struct _WIN32_function{ typedef struct _WIN32_function{
char *name; char *name;
......
...@@ -167,6 +167,7 @@ struct PE_Export_Directory ...@@ -167,6 +167,7 @@ struct PE_Export_Directory
u_long * AddressOfFunctions; u_long * AddressOfFunctions;
u_long * AddressOfNames; u_long * AddressOfNames;
u_short * Address_Of_Name_Ordinals; u_short * Address_Of_Name_Ordinals;
u_char ModuleName[1];
}; };
/* /*
......
...@@ -17,12 +17,19 @@ extern SEGPTR NE_LockResource( HMODULE hModule, HGLOBAL handle ); ...@@ -17,12 +17,19 @@ extern SEGPTR NE_LockResource( HMODULE hModule, HGLOBAL handle );
extern HGLOBAL NE_AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size ); extern HGLOBAL NE_AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size );
extern HGLOBAL NE_LoadResource( HMODULE hModule, HRSRC hRsrc ); extern HGLOBAL NE_LoadResource( HMODULE hModule, HRSRC hRsrc );
struct ResourceTable struct resource
{ {
int id,type; int id,type;
char *name; char *name;
unsigned char* value; unsigned char* bytes;
unsigned size; unsigned size;
}; };
#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)
#define WINE_CONSTRUCTOR __attribute__((constructor))
#define HAVE_WINE_CONSTRUCTOR
#else
#define WINE_CONSTRUCTOR
#endif
#endif /* __WINE_RESOURCE_H */ #endif /* __WINE_RESOURCE_H */
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
*/ */
extern INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon); extern INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon);
extern void SHELL_LoadRegistry();
extern void SHELL_SaveRegistry();
extern BOOL SHELL_Init();
#define ERROR_SUCCESS 0L #define ERROR_SUCCESS 0L
#define ERROR_BADDB 1L #define ERROR_BADDB 1L
...@@ -33,15 +36,14 @@ typedef struct tagKEYSTRUCT { ...@@ -33,15 +36,14 @@ typedef struct tagKEYSTRUCT {
struct tagKEYSTRUCT *lpPrevKey; struct tagKEYSTRUCT *lpPrevKey;
struct tagKEYSTRUCT *lpNextKey; struct tagKEYSTRUCT *lpNextKey;
struct tagKEYSTRUCT *lpSubLvl; struct tagKEYSTRUCT *lpSubLvl;
} KEYSTRUCT; } KEYSTRUCT, *LPKEYSTRUCT;
typedef KEYSTRUCT *LPKEYSTRUCT;
typedef struct tagDROPFILESTRUCT { /* structure for dropped files */ typedef struct { /* structure for dropped files */
WORD wSize; WORD wSize;
POINT ptMousePos; POINT ptMousePos;
BOOL fInNonClientArea; BOOL fInNonClientArea;
/* memory block with filenames follows */ /* memory block with filenames follows */
} DROPFILESTRUCT,FAR *LPDROPFILESTRUCT; } DROPFILESTRUCT, *LPDROPFILESTRUCT;
#define SE_ERR_SHARE 26 #define SE_ERR_SHARE 26
#define SE_ERR_ASSOCINCOMPLETE 27 #define SE_ERR_ASSOCINCOMPLETE 27
......
...@@ -43,7 +43,6 @@ typedef struct tagWND ...@@ -43,7 +43,6 @@ typedef struct tagWND
POINT ptMaxPos; /* Maximized window position */ POINT ptMaxPos; /* Maximized window position */
HGLOBAL hmemTaskQ; /* Task queue global memory handle */ HGLOBAL hmemTaskQ; /* Task queue global memory handle */
HRGN hrgnUpdate; /* Update region */ HRGN hrgnUpdate; /* Update region */
HWND hwndPrevActive; /* Previous active top-level window */
HWND hwndLastActive; /* Last active popup hwnd */ HWND hwndLastActive; /* Last active popup hwnd */
WNDPROC lpfnWndProc; /* Window procedure */ WNDPROC lpfnWndProc; /* Window procedure */
DWORD dwStyle; /* Window style (from CreateWindow) */ DWORD dwStyle; /* Window style (from CreateWindow) */
...@@ -68,6 +67,7 @@ typedef struct tagWND ...@@ -68,6 +67,7 @@ typedef struct tagWND
#define WIN_INTERNAL_PAINT 0x10 /* Internal WM_PAINT message pending */ #define WIN_INTERNAL_PAINT 0x10 /* Internal WM_PAINT message pending */
#define WIN_NO_REDRAW 0x20 /* WM_SETREDRAW called for this window */ #define WIN_NO_REDRAW 0x20 /* WM_SETREDRAW called for this window */
#define WIN_GOT_SIZEMSG 0x40 /* WM_SIZE has been sent to the window */ #define WIN_GOT_SIZEMSG 0x40 /* WM_SIZE has been sent to the window */
#define WIN_NCACTIVATED 0x80 /* last WM_NCACTIVATE was positive */
#define WIN_CLASS_INFO(wndPtr) (CLASS_FindClassPtr((wndPtr)->hClass)->wc) #define WIN_CLASS_INFO(wndPtr) (CLASS_FindClassPtr((wndPtr)->hClass)->wc)
#define WIN_CLASS_STYLE(wndPtr) (WIN_CLASS_INFO(wndPtr).style) #define WIN_CLASS_STYLE(wndPtr) (WIN_CLASS_INFO(wndPtr).style)
......
...@@ -7,6 +7,21 @@ extern int WIN32_LastError; ...@@ -7,6 +7,21 @@ extern int WIN32_LastError;
*/ */
#define ERROR_UNKNOWN 99999 #define ERROR_UNKNOWN 99999
#define ERROR_FILE_NOT_FOUND 2
#define ERROR_TOO_MANY_OPEN_FILES 4
#define ERROR_ACCESS_DENIED 5
#define ERROR_INVALID_HANDLE 6 #define ERROR_INVALID_HANDLE 6
#define ERROR_BAD_FORMAT 11
#define ERROR_OUTOFMEMORY 14
#define ERROR_FILE_EXISTS 80
#define ERROR_INVALID_PARAMETER 87 #define ERROR_INVALID_PARAMETER 87
#define ERROR_BROKEN_PIPE 109
#define ERROR_DISK_FULL 112
#define ERROR_CALL_NOT_IMPLEMENTED 120 #define ERROR_CALL_NOT_IMPLEMENTED 120
#define ERROR_SEEK_ON_DEVICE 132
#define ERROR_DIR_NOT_EMPTY 145
#define ERROR_BUSY 170
#define ERROR_FILENAME_EXCED_RANGE 206
#define ERROR_IO_DEVICE 1117
#define ERROR_POSSIBLE_DEADLOCK 1131
#define ERROR_BAD_DEVICE 1200
...@@ -19,8 +19,15 @@ typedef struct ...@@ -19,8 +19,15 @@ typedef struct
WINDOWPOS winPos[1]; WINDOWPOS winPos[1];
} DWP; } DWP;
typedef struct
{
HTASK hWindowTask;
HTASK hTaskSendTo;
BOOL wFlag;
} ACTIVATESTRUCT, *LPACTIVATESTRUCT;
extern void WINPOS_FindIconPos( HWND hwnd ); extern void WINPOS_FindIconPos( HWND hwnd );
extern BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus);
extern HWND WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg ); extern HWND WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg );
extern LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect, extern LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect,
RECT *newWindowRect, RECT *oldWindowRect, RECT *newWindowRect, RECT *oldWindowRect,
......
...@@ -31,6 +31,7 @@ typedef short SHORT; ...@@ -31,6 +31,7 @@ typedef short SHORT;
typedef LONG WPARAM; typedef LONG WPARAM;
typedef void* HANDLE; typedef void* HANDLE;
typedef void* NPVOID; typedef void* NPVOID;
typedef void* SEGPTR;
#define UIFMT "%u" #define UIFMT "%u"
#define NPFMT "%p" #define NPFMT "%p"
#else #else
...@@ -39,13 +40,13 @@ typedef unsigned short UINT; ...@@ -39,13 +40,13 @@ typedef unsigned short UINT;
typedef UINT WPARAM; typedef UINT WPARAM;
typedef WORD HANDLE; typedef WORD HANDLE;
typedef WORD NPVOID; typedef WORD NPVOID;
typedef DWORD SEGPTR;
#define UIFMT "%hu" #define UIFMT "%hu"
#define NPFMT "%04X" #define NPFMT "%04X"
#endif #endif
typedef LONG LPARAM; typedef LONG LPARAM;
typedef LONG LRESULT; typedef LONG LRESULT;
typedef DWORD HHOOK; typedef DWORD HHOOK;
typedef DWORD SEGPTR;
typedef char *LPSTR; typedef char *LPSTR;
typedef const char *LPCSTR; typedef const char *LPCSTR;
typedef char *NPSTR; typedef char *NPSTR;
......
...@@ -1184,8 +1184,7 @@ int GetModuleFileName( HANDLE hModule, LPSTR lpFileName, short nSize ) ...@@ -1184,8 +1184,7 @@ int GetModuleFileName( HANDLE hModule, LPSTR lpFileName, short nSize )
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return 0; if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return 0;
name = ((LOADEDFILEINFO*)((char*)pModule + pModule->fileinfo))->filename; name = ((LOADEDFILEINFO*)((char*)pModule + pModule->fileinfo))->filename;
strncpy( lpFileName, name, nSize ); lstrcpyn( lpFileName, name, nSize );
lpFileName[nSize-1] = '\0';
dprintf_module( stddeb, "GetModuleFilename: %s\n", lpFileName ); dprintf_module( stddeb, "GetModuleFilename: %s\n", lpFileName );
return strlen(lpFileName); return strlen(lpFileName);
} }
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
* based on Eric Youndale's pe-test and: * based on Eric Youndale's pe-test and:
* *
* ftp.microsoft.com:/pub/developer/MSDN/CD8/PEFILE.ZIP * ftp.microsoft.com:/pub/developer/MSDN/CD8/PEFILE.ZIP
* make that:
* ftp.microsoft.com:/developr/MSDN/OctCD/PEFILE.ZIP
*/ */
#include <ctype.h> #include <ctype.h>
...@@ -35,8 +37,6 @@ ...@@ -35,8 +37,6 @@
struct w_files *wine_files = NULL; struct w_files *wine_files = NULL;
unsigned int load_addr;
void my_wcstombs(char * result, u_short * source, int len) void my_wcstombs(char * result, u_short * source, int len)
{ {
while(len--) { while(len--) {
...@@ -76,7 +76,7 @@ char * xmmap(char * vaddr, unsigned int v_size, unsigned int r_size, ...@@ -76,7 +76,7 @@ char * xmmap(char * vaddr, unsigned int v_size, unsigned int r_size,
return vaddr; return vaddr;
}; };
void dump_exports(struct PE_Export_Directory * pe_exports) void dump_exports(struct PE_Export_Directory * pe_exports, unsigned int load_addr)
{ {
char * Module; char * Module;
int i; int i;
...@@ -85,7 +85,7 @@ void dump_exports(struct PE_Export_Directory * pe_exports) ...@@ -85,7 +85,7 @@ void dump_exports(struct PE_Export_Directory * pe_exports)
u_char ** name, *ename; u_char ** name, *ename;
Module = ((char *) load_addr) + pe_exports->Name; Module = ((char *) load_addr) + pe_exports->Name;
printf("\n*******EXPORT DATA*******\nModule name is %s, %ld functions, %ld names\n", dprintf_win32(stddeb,"\n*******EXPORT DATA*******\nModule name is %s, %ld functions, %ld names\n",
Module, Module,
pe_exports->Number_Of_Functions, pe_exports->Number_Of_Functions,
pe_exports->Number_Of_Names); pe_exports->Number_Of_Names);
...@@ -94,15 +94,15 @@ void dump_exports(struct PE_Export_Directory * pe_exports) ...@@ -94,15 +94,15 @@ void dump_exports(struct PE_Export_Directory * pe_exports)
function = (u_long *) (((char *) load_addr) + (int) pe_exports->AddressOfFunctions); function = (u_long *) (((char *) load_addr) + (int) pe_exports->AddressOfFunctions);
name = (u_char **) (((char *) load_addr) + (int) pe_exports->AddressOfNames); name = (u_char **) (((char *) load_addr) + (int) pe_exports->AddressOfNames);
printf("%-32s Ordinal Virt Addr\n", "Function Name"); dprintf_win32(stddeb,"%-32s Ordinal Virt Addr\n", "Function Name");
for(i=0; i< pe_exports->Number_Of_Functions; i++) for(i=0; i< pe_exports->Number_Of_Functions; i++)
{ {
ename = (char *) (((char *) load_addr) + (int) *name++); ename = (char *) (((char *) load_addr) + (int) *name++);
printf("%-32s %4d %8.8lx\n", ename, *ordinal++, *function++); dprintf_win32(stddeb,"%-32s %4d %8.8lx\n", ename, *ordinal++, *function++);
} }
} }
void fixup_imports(struct PE_Import_Directory *pe_imports) void fixup_imports(struct PE_Import_Directory *pe_imports,unsigned int load_addr)
{ {
struct PE_Import_Directory * pe_imp; struct PE_Import_Directory * pe_imp;
int fixup_failed=0; int fixup_failed=0;
...@@ -115,12 +115,16 @@ void fixup_imports(struct PE_Import_Directory *pe_imports) ...@@ -115,12 +115,16 @@ void fixup_imports(struct PE_Import_Directory *pe_imports)
char * Module; char * Module;
struct pe_import_name * pe_name; struct pe_import_name * pe_name;
unsigned int * import_list, *thunk_list; unsigned int * import_list, *thunk_list;
#if 0
char * c; char * c;
#endif
Module = ((char *) load_addr) + pe_imp->ModuleName; Module = ((char *) load_addr) + pe_imp->ModuleName;
dprintf_win32(stddeb, "%s\n", Module); dprintf_win32(stddeb, "%s\n", Module);
#if 0
c = strchr(Module, '.'); c = strchr(Module, '.');
if (c) *c = 0; if (c) *c = 0;
#endif
import_list = (unsigned int *) import_list = (unsigned int *)
(((unsigned int) load_addr) + pe_imp->Import_List); (((unsigned int) load_addr) + pe_imp->Import_List);
...@@ -185,6 +189,7 @@ static void dump_table(struct w_files *wpnt) ...@@ -185,6 +189,7 @@ static void dump_table(struct w_files *wpnt)
HINSTANCE PE_LoadImage(struct w_files *wpnt) HINSTANCE PE_LoadImage(struct w_files *wpnt)
{ {
int i, result; int i, result;
unsigned int load_addr;
wpnt->pe = xmalloc(sizeof(struct pe_data)); wpnt->pe = xmalloc(sizeof(struct pe_data));
memset(wpnt->pe,0,sizeof(struct pe_data)); memset(wpnt->pe,0,sizeof(struct pe_data));
...@@ -239,10 +244,11 @@ HINSTANCE PE_LoadImage(struct w_files *wpnt) ...@@ -239,10 +244,11 @@ HINSTANCE PE_LoadImage(struct w_files *wpnt)
} }
} }
if(wpnt->pe->pe_import) fixup_imports(wpnt->pe->pe_import); if(wpnt->pe->pe_import) fixup_imports(wpnt->pe->pe_import,load_addr);
if(wpnt->pe->pe_export) dump_exports(wpnt->pe->pe_export); if(wpnt->pe->pe_export) dump_exports(wpnt->pe->pe_export,load_addr);
wpnt->hinstance = (HINSTANCE)0x8000; wpnt->hinstance = (HINSTANCE)0x8000;
wpnt->load_addr = load_addr;
return (wpnt->hinstance); return (wpnt->hinstance);
} }
...@@ -264,8 +270,6 @@ HINSTANCE PE_LoadModule(int fd, OFSTRUCT *ofs, LOADPARAMS* params) ...@@ -264,8 +270,6 @@ HINSTANCE PE_LoadModule(int fd, OFSTRUCT *ofs, LOADPARAMS* params)
ALIAS_UseAliases=1; ALIAS_UseAliases=1;
wpnt=xmalloc(sizeof(struct w_files)); wpnt=xmalloc(sizeof(struct w_files));
wpnt->next=wine_files;
wine_files=wpnt;
wpnt->ofs=*ofs; wpnt->ofs=*ofs;
wpnt->fd=fd; wpnt->fd=fd;
wpnt->type=0; wpnt->type=0;
...@@ -295,7 +299,7 @@ HINSTANCE PE_LoadModule(int fd, OFSTRUCT *ofs, LOADPARAMS* params) ...@@ -295,7 +299,7 @@ HINSTANCE PE_LoadModule(int fd, OFSTRUCT *ofs, LOADPARAMS* params)
pModule = (NE_MODULE*)GlobalLock(hModule); pModule = (NE_MODULE*)GlobalLock(hModule);
/* Set all used entries */ /* Set all used entries */
pModule->magic=NE_SIGNATURE; pModule->magic=PE_SIGNATURE;
pModule->count=1; pModule->count=1;
pModule->next=0; pModule->next=0;
pModule->flags=0; pModule->flags=0;
...@@ -353,6 +357,18 @@ HINSTANCE PE_LoadModule(int fd, OFSTRUCT *ofs, LOADPARAMS* params) ...@@ -353,6 +357,18 @@ HINSTANCE PE_LoadModule(int fd, OFSTRUCT *ofs, LOADPARAMS* params)
hInstance=MODULE_CreateInstance(hModule,NULL /* FIX: NULL? really? */); hInstance=MODULE_CreateInstance(hModule,NULL /* FIX: NULL? really? */);
wpnt->hinstance=hInstance; wpnt->hinstance=hInstance;
if (wpnt->pe->pe_export) {
wpnt->name = xmalloc(strlen(wpnt->pe->pe_export->ModuleName)+1);
strcpy(wpnt->name, wpnt->pe->pe_export->ModuleName);
} else {
wpnt->name = xmalloc(strlen(ofs->szPathName)+1);
strcpy(wpnt->name, ofs->szPathName);
}
wpnt->next=wine_files;
wine_files=wpnt;
if (!(wpnt->pe->pe_header->coff.Characteristics & IMAGE_FILE_DLL))
TASK_CreateTask(hModule,hInstance,0, TASK_CreateTask(hModule,hInstance,0,
params->hEnvironment,(LPSTR)PTR_SEG_TO_LIN(params->cmdLine), params->hEnvironment,(LPSTR)PTR_SEG_TO_LIN(params->cmdLine),
*((WORD*)PTR_SEG_TO_LIN(params->showCmd)+1)); *((WORD*)PTR_SEG_TO_LIN(params->showCmd)+1));
...@@ -371,7 +387,7 @@ void PE_Win32CallToStart(struct sigcontext_struct context) ...@@ -371,7 +387,7 @@ void PE_Win32CallToStart(struct sigcontext_struct context)
InitTask(context); InitTask(context);
USER_InitApp(wpnt->hModule); USER_InitApp(wpnt->hModule);
__asm__ __volatile__("movw %w0,%%fs"::"r" (fs)); __asm__ __volatile__("movw %w0,%%fs"::"r" (fs));
((void(*)())(load_addr+wpnt->pe->pe_header->opt_coff.AddressOfEntryPoint))(); ((void(*)())(wpnt->load_addr+wpnt->pe->pe_header->opt_coff.AddressOfEntryPoint))();
} }
int PE_UnloadImage(struct w_files *wpnt) int PE_UnloadImage(struct w_files *wpnt)
......
...@@ -64,7 +64,7 @@ HRSRC FindResource( HMODULE hModule, SEGPTR name, SEGPTR type ) ...@@ -64,7 +64,7 @@ HRSRC FindResource( HMODULE hModule, SEGPTR name, SEGPTR type )
return 0; return 0;
} }
#else #else
return LIBRES_FindResource( hModule, type, name ); return LIBRES_FindResource( hModule, name, type );
#endif #endif
} }
...@@ -103,6 +103,7 @@ HGLOBAL LoadResource( HMODULE hModule, HRSRC hRsrc ) ...@@ -103,6 +103,7 @@ HGLOBAL LoadResource( HMODULE hModule, HRSRC hRsrc )
/* 16-bit version */ /* 16-bit version */
SEGPTR WIN16_LockResource( HGLOBAL handle ) SEGPTR WIN16_LockResource( HGLOBAL handle )
{ {
#ifndef WINELIB
HMODULE hModule; HMODULE hModule;
WORD *pModule; WORD *pModule;
...@@ -110,7 +111,6 @@ SEGPTR WIN16_LockResource( HGLOBAL handle ) ...@@ -110,7 +111,6 @@ SEGPTR WIN16_LockResource( HGLOBAL handle )
if (!handle) return (SEGPTR)0; if (!handle) return (SEGPTR)0;
hModule = GetExePtr( handle ); hModule = GetExePtr( handle );
if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0; if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0;
#ifndef WINELIB
switch(*pModule) switch(*pModule)
{ {
case NE_SIGNATURE: case NE_SIGNATURE:
...@@ -121,13 +121,14 @@ SEGPTR WIN16_LockResource( HGLOBAL handle ) ...@@ -121,13 +121,14 @@ SEGPTR WIN16_LockResource( HGLOBAL handle )
return 0; return 0;
} }
#else #else
return LIBRES_LockResource( hModule, handle ); return LIBRES_LockResource( handle );
#endif #endif
} }
/* 32-bit version */ /* 32-bit version */
LPSTR LockResource( HGLOBAL handle ) LPVOID LockResource( HGLOBAL handle )
{ {
#ifndef WINELIB
HMODULE hModule; HMODULE hModule;
WORD *pModule; WORD *pModule;
...@@ -135,7 +136,6 @@ LPSTR LockResource( HGLOBAL handle ) ...@@ -135,7 +136,6 @@ LPSTR LockResource( HGLOBAL handle )
if (!handle) return NULL; if (!handle) return NULL;
hModule = GetExePtr( handle ); hModule = GetExePtr( handle );
if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0; if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0;
#ifndef WINELIB
switch(*pModule) switch(*pModule)
{ {
case NE_SIGNATURE: case NE_SIGNATURE:
...@@ -146,7 +146,7 @@ LPSTR LockResource( HGLOBAL handle ) ...@@ -146,7 +146,7 @@ LPSTR LockResource( HGLOBAL handle )
return 0; return 0;
} }
#else #else
return LIBRES_LockResource( hModule, handle ); return LIBRES_LockResource( handle );
#endif #endif
} }
...@@ -156,6 +156,7 @@ LPSTR LockResource( HGLOBAL handle ) ...@@ -156,6 +156,7 @@ LPSTR LockResource( HGLOBAL handle )
*/ */
BOOL FreeResource( HGLOBAL handle ) BOOL FreeResource( HGLOBAL handle )
{ {
#ifndef WINELIB
HMODULE hModule; HMODULE hModule;
WORD *pModule; WORD *pModule;
...@@ -163,7 +164,6 @@ BOOL FreeResource( HGLOBAL handle ) ...@@ -163,7 +164,6 @@ BOOL FreeResource( HGLOBAL handle )
if (!handle) return FALSE; if (!handle) return FALSE;
hModule = GetExePtr( handle ); hModule = GetExePtr( handle );
if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0; if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0;
#ifndef WINELIB
switch(*pModule) switch(*pModule)
{ {
case NE_SIGNATURE: case NE_SIGNATURE:
...@@ -174,7 +174,7 @@ BOOL FreeResource( HGLOBAL handle ) ...@@ -174,7 +174,7 @@ BOOL FreeResource( HGLOBAL handle )
return FALSE; return FALSE;
} }
#else #else
return LIBRES_FreeResource( hModule, handle ); return LIBRES_FreeResource( handle );
#endif #endif
} }
......
...@@ -56,8 +56,6 @@ static void win_fault(int signal, void *siginfo, ucontext_t *context) ...@@ -56,8 +56,6 @@ static void win_fault(int signal, void *siginfo, ucontext_t *context)
static void win_fault(int signal, int code, struct sigcontext *context) static void win_fault(int signal, int code, struct sigcontext *context)
{ {
#endif #endif
int i;
if (signal != SIGTRAP) if (signal != SIGTRAP)
{ {
if (CS_reg(context) == WINE_CODE_SELECTOR) if (CS_reg(context) == WINE_CODE_SELECTOR)
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "debugger.h" #include "debugger.h"
#include "global.h" #include "global.h"
#include "instance.h" #include "instance.h"
#include "message.h"
#include "miscemu.h" #include "miscemu.h"
#include "module.h" #include "module.h"
#include "neexe.h" #include "neexe.h"
...@@ -31,6 +32,7 @@ ...@@ -31,6 +32,7 @@
/* Must not be greater than 64k, or MAKE_SEGPTR won't work */ /* Must not be greater than 64k, or MAKE_SEGPTR won't work */
#define STACK32_SIZE 0x10000 #define STACK32_SIZE 0x10000
/* ------ Internal variables ------ */
static HTASK hFirstTask = 0; static HTASK hFirstTask = 0;
static HTASK hCurrentTask = 0; static HTASK hCurrentTask = 0;
...@@ -39,6 +41,8 @@ static HTASK hLockedTask = 0; ...@@ -39,6 +41,8 @@ static HTASK hLockedTask = 0;
static WORD nTaskCount = 0; static WORD nTaskCount = 0;
static HANDLE hDOSEnvironment = 0; static HANDLE hDOSEnvironment = 0;
/* ------ Internal declarations ------ */
/* TASK_Reschedule() 16-bit entry point */ /* TASK_Reschedule() 16-bit entry point */
static FARPROC TASK_RescheduleProc; static FARPROC TASK_RescheduleProc;
...@@ -48,7 +52,6 @@ static FARPROC TASK_RescheduleProc; ...@@ -48,7 +52,6 @@ static FARPROC TASK_RescheduleProc;
#define TASK_SCHEDULE() CallTo16_word_(TASK_RescheduleProc,0) #define TASK_SCHEDULE() CallTo16_word_(TASK_RescheduleProc,0)
#endif #endif
static HANDLE TASK_CreateDOSEnvironment(void); static HANDLE TASK_CreateDOSEnvironment(void);
/*********************************************************************** /***********************************************************************
...@@ -565,6 +568,10 @@ static void TASK_DeleteTask( HTASK hTask ) ...@@ -565,6 +568,10 @@ static void TASK_DeleteTask( HTASK hTask )
GlobalFreeAll( pTask->hPDB ); GlobalFreeAll( pTask->hPDB );
/* Free message queue */
MSG_DeleteMsgQueue( pTask->hQueue );
/* Free the selector aliases */ /* Free the selector aliases */
GLOBAL_FreeBlock( pTask->hCSAlias ); GLOBAL_FreeBlock( pTask->hCSAlias );
...@@ -604,8 +611,12 @@ void TASK_KillCurrentTask( int exitCode ) ...@@ -604,8 +611,12 @@ void TASK_KillCurrentTask( int exitCode )
hTaskToKill = hCurrentTask; hTaskToKill = hCurrentTask;
hLockedTask = 0; hLockedTask = 0;
Yield(); Yield();
/* We never return from Yield() */ /* We should never return from this Yield() */
fprintf(stderr,"It's alive! Alive!!!\n");
exit(1);
} }
......
...@@ -14,12 +14,12 @@ C_SRCS = \ ...@@ -14,12 +14,12 @@ C_SRCS = \
keyboard.c \ keyboard.c \
lstr.c \ lstr.c \
main.c \ main.c \
network.c \
ole2.c \ ole2.c \
ole2disp.c \ ole2disp.c \
ole2nls.c \ ole2nls.c \
olecli.c \ olecli.c \
olesvr.c \ olesvr.c \
network.c \
profile.c \ profile.c \
rect.c \ rect.c \
shell.c \ shell.c \
......
...@@ -858,29 +858,30 @@ DWORD CommDlgExtendError(void) ...@@ -858,29 +858,30 @@ DWORD CommDlgExtendError(void)
*/ */
int GetFileTitle(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf) int GetFileTitle(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf)
{ {
int i, len; int i, len;
printf("GetFileTitle(%p %p %d); \n", lpFile, lpTitle, cbBuf); printf("GetFileTitle(%p %p %d); \n", lpFile, lpTitle, cbBuf);
if (lpFile == NULL || lpTitle == NULL) if (lpFile == NULL || lpTitle == NULL)
return -1; return -1;
len = strlen(lpFile); len = strlen(lpFile);
if (len == 0) if (len == 0)
return -1; return -1;
if (strpbrk(lpFile, "*[]")) if (strpbrk(lpFile, "*[]"))
return -1; return -1;
len--; len--;
if (lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':') if (lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':')
return -1; return -1;
for (i = len; i >= 0; i--) for (i = len; i >= 0; i--)
if (lpFile[i] == '/' || lpFile[i] == '\\' || lpFile[i] == ':') if (lpFile[i] == '/' || lpFile[i] == '\\' || lpFile[i] == ':')
{ {
i++; i++;
break; break;
} }
printf("\n---> '%s' ", &lpFile[i]); printf("\n---> '%s' ", &lpFile[i]);
len = MIN(cbBuf, strlen(&lpFile[i]) + 1);
strncpy(lpTitle, &lpFile[i], len + 1); len = strlen(lpFile+i)+1;
if (len != cbBuf) if (cbBuf < len);
return len; return len;
else
strncpy(lpTitle, &lpFile[i], len);
return 0; return 0;
} }
...@@ -885,12 +885,6 @@ struct dosdirent *DOS_opendir(char *dosdirname) ...@@ -885,12 +885,6 @@ struct dosdirent *DOS_opendir(char *dosdirname)
strcpy(dp->unixpath, dirname); strcpy(dp->unixpath, dirname);
dp->entnum = 0; dp->entnum = 0;
if ((dp->telldirnum=telldir(ds)) == -1)
{
dp->inuse = 0;
closedir(ds);
return NULL;
}
if (closedir(ds) == -1) if (closedir(ds) == -1)
{ {
dp->inuse = 0; dp->inuse = 0;
...@@ -906,11 +900,16 @@ struct dosdirent *DOS_readdir(struct dosdirent *de) ...@@ -906,11 +900,16 @@ struct dosdirent *DOS_readdir(struct dosdirent *de)
struct dirent *d; struct dirent *d;
struct stat st; struct stat st;
DIR *ds; DIR *ds;
int i;
if (!de->inuse) if (!de->inuse)
return NULL; return NULL;
if (!(ds=opendir(de->unixpath))) return NULL; if (!(ds=opendir(de->unixpath))) return NULL;
seekdir(ds,de->telldirnum); /* returns no error value. strange */ /* skip all already read directory entries.
* the dir has hopefully not been modified in the meantime
*/
for (i=de->entnum;i--;)
readdir(ds);
if (de->search_attribute & FA_LABEL) { if (de->search_attribute & FA_LABEL) {
int drive; int drive;
...@@ -927,13 +926,11 @@ struct dosdirent *DOS_readdir(struct dosdirent *de) ...@@ -927,13 +926,11 @@ struct dosdirent *DOS_readdir(struct dosdirent *de)
} }
do { do {
de->entnum++; /* Increment the directory entry number */
if ((d = readdir(ds)) == NULL) { if ((d = readdir(ds)) == NULL) {
de->telldirnum=telldir(ds);
closedir(ds); closedir(ds);
return NULL; return NULL;
} }
de->entnum++; /* Increment the directory entry number */
strcpy(de->filename, d->d_name); strcpy(de->filename, d->d_name);
if (d->d_reclen > 12) if (d->d_reclen > 12)
de->filename[12] = '\0'; de->filename[12] = '\0';
...@@ -954,7 +951,6 @@ struct dosdirent *DOS_readdir(struct dosdirent *de) ...@@ -954,7 +951,6 @@ struct dosdirent *DOS_readdir(struct dosdirent *de)
de->filesize = st.st_size; de->filesize = st.st_size;
de->filetime = st.st_mtime; de->filetime = st.st_mtime;
de->telldirnum = telldir(ds);
closedir(ds); closedir(ds);
return de; return de;
} }
......
...@@ -124,7 +124,7 @@ int GetKeyNameText(LONG lParam, LPSTR lpBuffer, int nSize) ...@@ -124,7 +124,7 @@ int GetKeyNameText(LONG lParam, LPSTR lpBuffer, int nSize)
for (i = 0 ; i != KeyTableSize ; i++) for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].scancode == lParam) { if (KeyTable[i].scancode == lParam) {
strncpy(lpBuffer, KeyTable[i].name, nSize); lstrcpyn(lpBuffer, KeyTable[i].name, nSize);
return strlen(lpBuffer); return strlen(lpBuffer);
} }
......
...@@ -54,7 +54,6 @@ static const BYTE Ansi2Oem[256] = ...@@ -54,7 +54,6 @@ static const BYTE Ansi2Oem[256] =
"\205\240\203\141\204\206\221\207\212\202\210\211\215\241\214\213" "\205\240\203\141\204\206\221\207\212\202\210\211\215\241\214\213"
"\144\244\225\242\223\157\224\366\157\227\243\226\201\171\137\230"; "\144\244\225\242\223\157\224\366\157\227\243\226\201\171\137\230";
/* Funny to divide them between user and kernel. */ /* Funny to divide them between user and kernel. */
/* KERNEL.89 */ /* KERNEL.89 */
...@@ -87,10 +86,20 @@ SEGPTR lstrcpy( SEGPTR target, SEGPTR source ) ...@@ -87,10 +86,20 @@ SEGPTR lstrcpy( SEGPTR target, SEGPTR source )
return target; return target;
} }
/* KERNEL.353 */ /* KERNEL.353 32-bit version*/
SEGPTR lstrcpyn( SEGPTR target, SEGPTR source, WORD n ) char *lstrcpyn(char *dst, char *src, int n)
{
char *tmp = dst;
while(n-- > 1 && *src)
*dst++ = *src++;
*dst = 0;
return tmp;
}
/* KERNEL.353 16-bit version*/
SEGPTR WIN16_lstrcpyn( SEGPTR target, SEGPTR source, WORD n )
{ {
strncpy((char *)PTR_SEG_TO_LIN(target), (char *)PTR_SEG_TO_LIN(source), n); lstrcpyn((char *)PTR_SEG_TO_LIN(target), (char *)PTR_SEG_TO_LIN(source),n);
return target; return target;
} }
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "winsock.h" #include "winsock.h"
#include "options.h" #include "options.h"
#include "desktop.h" #include "desktop.h"
#include "shell.h"
#include "dlls.h" #include "dlls.h"
#define DEBUG_DEFINE_VARIABLES #define DEBUG_DEFINE_VARIABLES
#include "stddebug.h" #include "stddebug.h"
...@@ -89,11 +90,11 @@ struct options Options = ...@@ -89,11 +90,11 @@ struct options Options =
FALSE, /* Enhanced mode */ FALSE, /* Enhanced mode */
FALSE, /* IPC enabled */ FALSE, /* IPC enabled */
#ifdef DEFAULT_LANG #ifdef DEFAULT_LANG
DEFAULT_LANG /* Default language */ DEFAULT_LANG, /* Default language */
#else #else
LANG_En LANG_En,
#endif #endif
FALSE /* Managed windows */
}; };
...@@ -114,7 +115,8 @@ static XrmOptionDescRec optionsTable[] = ...@@ -114,7 +115,8 @@ static XrmOptionDescRec optionsTable[] =
{ "-debugmsg", ".debugmsg", XrmoptionSepArg, (caddr_t)NULL }, { "-debugmsg", ".debugmsg", XrmoptionSepArg, (caddr_t)NULL },
{ "-dll", ".dll", XrmoptionSepArg, (caddr_t)NULL }, { "-dll", ".dll", XrmoptionSepArg, (caddr_t)NULL },
{ "-allowreadonly", ".allowreadonly", XrmoptionNoArg, (caddr_t)"on" }, { "-allowreadonly", ".allowreadonly", XrmoptionNoArg, (caddr_t)"on" },
{ "-enhanced", ".enhanced", XrmoptionNoArg, (caddr_t)"off"} { "-enhanced", ".enhanced", XrmoptionNoArg, (caddr_t)"off"},
{ "-managed", ".managed", XrmoptionNoArg, (caddr_t)"off"}
}; };
#define NB_OPTIONS (sizeof(optionsTable) / sizeof(optionsTable[0])) #define NB_OPTIONS (sizeof(optionsTable) / sizeof(optionsTable[0]))
...@@ -130,6 +132,7 @@ static XrmOptionDescRec optionsTable[] = ...@@ -130,6 +132,7 @@ static XrmOptionDescRec optionsTable[] =
" -ipc Enable IPC facilities\n" \ " -ipc Enable IPC facilities\n" \
" -debug Enter debugger before starting application\n" \ " -debug Enter debugger before starting application\n" \
" -language xx Set the language (one of En,Es,De,No,Fr,Fi,Da)\n" \ " -language xx Set the language (one of En,Es,De,No,Fr,Fi,Da)\n" \
" -managed Allow the window manager to manage created windows\n" \
" -name name Set the application name\n" \ " -name name Set the application name\n" \
" -privatemap Use a private color map\n" \ " -privatemap Use a private color map\n" \
" -fixedmap Use a \"standard\" color map\n" \ " -fixedmap Use a \"standard\" color map\n" \
...@@ -373,6 +376,8 @@ static void MAIN_ParseOptions( int *argc, char *argv[] ) ...@@ -373,6 +376,8 @@ static void MAIN_ParseOptions( int *argc, char *argv[] )
Options.desktopGeometry = value.addr; Options.desktopGeometry = value.addr;
if (MAIN_GetResource( db, ".language", &value)) if (MAIN_GetResource( db, ".language", &value))
MAIN_ParseLanguageOption( (char *)value.addr ); MAIN_ParseLanguageOption( (char *)value.addr );
if (MAIN_GetResource( db, ".managed", &value))
Options.managed = TRUE;
#ifdef DEBUG_RUNTIME #ifdef DEBUG_RUNTIME
if (MAIN_GetResource( db, ".debugoptions", &value)) if (MAIN_GetResource( db, ".debugoptions", &value))
ParseDebugOptions((char*)value.addr); ParseDebugOptions((char*)value.addr);
...@@ -530,7 +535,6 @@ static void malloc_error() ...@@ -530,7 +535,6 @@ static void malloc_error()
static void called_at_exit(void) static void called_at_exit(void)
{ {
extern void sync_profiles(void); extern void sync_profiles(void);
extern void SHELL_SaveRegistry(void);
sync_profiles(); sync_profiles();
MAIN_RestoreSetup(); MAIN_RestoreSetup();
...@@ -548,7 +552,6 @@ int main( int argc, char *argv[] ) ...@@ -548,7 +552,6 @@ int main( int argc, char *argv[] )
int *depth_list; int *depth_list;
extern int _WinMain(int argc, char **argv); extern int _WinMain(int argc, char **argv);
extern void SHELL_LoadRegistry(void);
setbuf(stdout,NULL); setbuf(stdout,NULL);
setbuf(stderr,NULL); setbuf(stderr,NULL);
...@@ -575,6 +578,7 @@ int main( int argc, char *argv[] ) ...@@ -575,6 +578,7 @@ int main( int argc, char *argv[] )
} }
#endif #endif
SHELL_Init();
SHELL_LoadRegistry(); SHELL_LoadRegistry();
screen = DefaultScreenOfDisplay( display ); screen = DefaultScreenOfDisplay( display );
...@@ -652,66 +656,67 @@ LONG GetWinFlags(void) ...@@ -652,66 +656,67 @@ LONG GetWinFlags(void)
*/ */
int SetEnvironment(LPSTR lpPortName, LPSTR lpEnviron, WORD nCount) int SetEnvironment(LPSTR lpPortName, LPSTR lpEnviron, WORD nCount)
{ {
LPENVENTRY lpNewEnv; LPENVENTRY lpNewEnv;
LPENVENTRY lpEnv = lpEnvList; LPENVENTRY lpEnv = lpEnvList;
dprintf_env(stddeb, "SetEnvironnement('%s', '%s', %d) !\n", dprintf_env(stddeb, "SetEnvironment('%s', '%s', %d) !\n",
lpPortName, lpEnviron, nCount); lpPortName, lpEnviron, nCount);
if (lpPortName == NULL) return -1; if (lpPortName == NULL) return -1;
while (lpEnv != NULL) { while (lpEnv != NULL) {
if (lpEnv->Name != NULL && strcmp(lpEnv->Name, lpPortName) == 0) { if (lpEnv->Name != NULL && strcmp(lpEnv->Name, lpPortName) == 0) {
if (nCount == 0 || lpEnviron == NULL) { if (nCount == 0 || lpEnviron == NULL) {
if (lpEnv->Prev != NULL) lpEnv->Prev->Next = lpEnv->Next; if (lpEnv->Prev != NULL) lpEnv->Prev->Next = lpEnv->Next;
if (lpEnv->Next != NULL) lpEnv->Next->Prev = lpEnv->Prev; if (lpEnv->Next != NULL) lpEnv->Next->Prev = lpEnv->Prev;
free(lpEnv->Value); free(lpEnv->Value);
free(lpEnv->Name); free(lpEnv->Name);
free(lpEnv); free(lpEnv);
dprintf_env(stddeb, "SetEnvironnement() // entry deleted !\n"); dprintf_env(stddeb, "SetEnvironment() // entry deleted !\n");
return -1; return -1;
} }
free(lpEnv->Value); free(lpEnv->Value);
lpEnv->Value = malloc(nCount); lpEnv->Value = malloc(nCount);
if (lpEnv->Value == NULL) { if (lpEnv->Value == NULL) {
dprintf_env(stddeb, "SetEnvironment() // Error allocating entry value !\n");
return 0;
}
memcpy(lpEnv->Value, lpEnviron, nCount);
lpEnv->wSize = nCount;
dprintf_env(stddeb, "SetEnvironnement() // entry modified !\n");
return nCount;
}
if (lpEnv->Next == NULL) break;
lpEnv = lpEnv->Next;
}
if (nCount == 0 || lpEnviron == NULL) return -1;
dprintf_env(stddeb, "SetEnvironnement() // new entry !\n");
lpNewEnv = malloc(sizeof(ENVENTRY));
if (lpNewEnv == NULL) {
dprintf_env(stddeb, "SetEnvironment() // Error allocating new entry !\n");
return 0;
}
if (lpEnvList == NULL) {
lpEnvList = lpNewEnv;
lpNewEnv->Prev = NULL;
}
else {
lpEnv->Next = lpNewEnv;
lpNewEnv->Prev = lpEnv;
}
lpNewEnv->Next = NULL;
lpNewEnv->Name = malloc(strlen(lpPortName) + 1);
if (lpNewEnv->Name == NULL) {
dprintf_env(stddeb, "SetEnvironment() // Error allocating entry name !\n");
return 0;
}
strcpy(lpNewEnv->Name, lpPortName);
lpNewEnv->Value = malloc(nCount);
if (lpNewEnv->Value == NULL) {
dprintf_env(stddeb, "SetEnvironment() // Error allocating entry value !\n"); dprintf_env(stddeb, "SetEnvironment() // Error allocating entry value !\n");
return 0; return 0;
} }
memcpy(lpNewEnv->Value, lpEnviron, nCount); memcpy(lpEnv->Value, lpEnviron, nCount);
lpNewEnv->wSize = nCount; lpEnv->wSize = nCount;
return nCount; dprintf_env(stddeb, "SetEnvironment() // entry modified !\n");
return nCount;
}
if (lpEnv->Next == NULL) break;
lpEnv = lpEnv->Next;
}
if (nCount == 0 || lpEnviron == NULL) return -1;
dprintf_env(stddeb, "SetEnvironment() // new entry !\n");
lpNewEnv = malloc(sizeof(ENVENTRY));
if (lpNewEnv == NULL) {
dprintf_env(stddeb, "SetEnvironment() // Error allocating new entry !\n");
return 0;
}
if (lpEnvList == NULL) {
lpEnvList = lpNewEnv;
lpNewEnv->Prev = NULL;
}
else
{
lpEnv->Next = lpNewEnv;
lpNewEnv->Prev = lpEnv;
}
lpNewEnv->Next = NULL;
lpNewEnv->Name = malloc(strlen(lpPortName) + 1);
if (lpNewEnv->Name == NULL) {
dprintf_env(stddeb, "SetEnvironment() // Error allocating entry name !\n");
return 0;
}
strcpy(lpNewEnv->Name, lpPortName);
lpNewEnv->Value = malloc(nCount);
if (lpNewEnv->Value == NULL) {
dprintf_env(stddeb, "SetEnvironment() // Error allocating entry value !\n");
return 0;
}
memcpy(lpNewEnv->Value, lpEnviron, nCount);
lpNewEnv->wSize = nCount;
return nCount;
} }
/*********************************************************************** /***********************************************************************
...@@ -730,21 +735,21 @@ BOOL SetEnvironmentVariableA(LPSTR lpName, LPSTR lpValue) ...@@ -730,21 +735,21 @@ BOOL SetEnvironmentVariableA(LPSTR lpName, LPSTR lpValue)
*/ */
int GetEnvironment(LPSTR lpPortName, LPSTR lpEnviron, WORD nMaxSiz) int GetEnvironment(LPSTR lpPortName, LPSTR lpEnviron, WORD nMaxSiz)
{ {
WORD nCount; WORD nCount;
LPENVENTRY lpEnv = lpEnvList; LPENVENTRY lpEnv = lpEnvList;
dprintf_env(stddeb, "GetEnvironnement('%s', '%s', %d) !\n", dprintf_env(stddeb, "GetEnvironment('%s', '%s', %d) !\n",
lpPortName, lpEnviron, nMaxSiz); lpPortName, lpEnviron, nMaxSiz);
while (lpEnv != NULL) { while (lpEnv != NULL) {
if (lpEnv->Name != NULL && strcmp(lpEnv->Name, lpPortName) == 0) { if (lpEnv->Name != NULL && strcmp(lpEnv->Name, lpPortName) == 0) {
nCount = MIN(nMaxSiz, lpEnv->wSize); nCount = MIN(nMaxSiz, lpEnv->wSize);
memcpy(lpEnviron, lpEnv->Value, nCount); memcpy(lpEnviron, lpEnv->Value, nCount);
dprintf_env(stddeb, "GetEnvironnement() // found '%s' !\n", lpEnviron); dprintf_env(stddeb, "GetEnvironment() // found '%s' !\n", lpEnviron);
return nCount; return nCount;
} }
lpEnv = lpEnv->Next; lpEnv = lpEnv->Next;
} }
dprintf_env(stddeb, "GetEnvironnement() // not found !\n"); dprintf_env(stddeb, "GetEnvironment() // not found !\n");
return 0; return 0;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -432,7 +432,7 @@ LOCVAL(LOCALE_SABBREVMONTHNAME13,"") ...@@ -432,7 +432,7 @@ LOCVAL(LOCALE_SABBREVMONTHNAME13,"")
} }
if(retLen>len)retLen=len; if(retLen>len)retLen=len;
strncpy(buf,retString,len); lstrcpyn(buf,retString,len);
return retLen; return retLen;
} }
......
...@@ -14,9 +14,7 @@ ...@@ -14,9 +14,7 @@
* has a NULL KeyValue returning a list of KeyNames, and a NULL * has a NULL KeyValue returning a list of KeyNames, and a NULL
* AppName undefined. I changed GetSetProfile to match. This makes * AppName undefined. I changed GetSetProfile to match. This makes
* PROGMAN.EXE do the right thing. * PROGMAN.EXE do the right thing.
* */
static char Copyright [] = "Copyright (C) 1993 Miguel de Icaza";
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
...@@ -25,15 +23,12 @@ static char Copyright [] = "Copyright (C) 1993 Miguel de Icaza"; ...@@ -25,15 +23,12 @@ static char Copyright [] = "Copyright (C) 1993 Miguel de Icaza";
#include "wine.h" #include "wine.h"
#include "windows.h" #include "windows.h"
#include "dos_fs.h" #include "dos_fs.h"
#include "module.h"
#include "toolhelp.h" #include "toolhelp.h"
#include "stddebug.h" #include "stddebug.h"
/* #define DEBUG_PROFILE */
#include "debug.h" #include "debug.h"
#include "xmalloc.h" #include "xmalloc.h"
#define STRSIZE 255 #define STRSIZE 255
#define overflow (next == &CharBuffer [STRSIZE-1])
typedef struct TKeys { typedef struct TKeys {
char *KeyName; char *KeyName;
...@@ -143,7 +138,12 @@ static TSecHeader *load (char *filename, char **pfullname) ...@@ -143,7 +138,12 @@ static TSecHeader *load (char *filename, char **pfullname)
if (isspace(c)) if (isspace(c))
continue; continue;
if (c == ';') {
do {
c = fgetc(f);
} while (!(c == EOF || c == '\n'));
if (c == EOF) goto finished;
}
if (c == '[') { if (c == '[') {
TSecHeader *temp = SecHeader; TSecHeader *temp = SecHeader;
...@@ -206,23 +206,26 @@ static TSecHeader *load (char *filename, char **pfullname) ...@@ -206,23 +206,26 @@ static TSecHeader *load (char *filename, char **pfullname)
skipspc = TRUE; skipspc = TRUE;
do { do {
c = fgetc(f); c = fgetc(f);
if (c == EOF) break; if (c == EOF || c == '\n' || c == ';') break;
if (c != '\n') { if (!isspace(c) || !skipspc) {
if (!isspace(c) || !skipspc) { skipspc = FALSE;
skipspc = FALSE; bufsize++;
bufsize++; *bufptr++ = c;
*bufptr++ = c; if (!isspace(c))
if (!isspace(c)) lastnonspc = bufptr;
lastnonspc = bufptr; }
}
} else
break;
} while(bufsize < STRSIZE-1); } while(bufsize < STRSIZE-1);
*lastnonspc = 0; *lastnonspc = 0;
SecHeader->Keys->Value = strdup (CharBuffer); SecHeader->Keys->Value = strdup (CharBuffer);
dprintf_profile (stddeb, "[%s] (%s)=%s\n", SecHeader->AppName, dprintf_profile (stddeb, "[%s] (%s)=%s\n", SecHeader->AppName,
SecHeader->Keys->KeyName, SecHeader->Keys->Value); SecHeader->Keys->KeyName, SecHeader->Keys->Value);
if (c == ';') {
do {
c = fgetc(f);
} while (!(c == EOF || c == '\n'));
if (c == EOF)
goto finished;
}
} }
} }
...@@ -266,6 +269,7 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName, ...@@ -266,6 +269,7 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName,
section = New->Section; section = New->Section;
Current = New; Current = New;
} }
/* Start search */ /* Start search */
for (; section; section = section->link){ for (; section; section = section->link){
if (strcasecmp (section->AppName, AppName)) if (strcasecmp (section->AppName, AppName))
...@@ -280,20 +284,17 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName, ...@@ -280,20 +284,17 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName,
dprintf_profile(stddeb,"GetSetProfile // KeyName == NULL, Enumeration !\n"); dprintf_profile(stddeb,"GetSetProfile // KeyName == NULL, Enumeration !\n");
for (key = section->Keys; key; key = key->link){ for (key = section->Keys; key; key = key->link){
if (left < 1) { if (left < 1) {
dprintf_profile(stddeb,"GetSetProfile // No more storage for enum !\n"); dprintf_profile(stddeb,"GetSetProfile // No more storage for enum !\n");
return (Size - 2); return Size - 2;
} }
slen = MIN(strlen(key->KeyName) + 1, left); slen = MIN(strlen(key->KeyName) + 1, left);
dprintf_profile(stddeb,"GetSetProfile // strncpy(%p, %p, %d);\n", lstrcpyn(p, key->KeyName, slen);
ReturnedString, key->Value, slen);
strncpy (p, key->KeyName, slen);
dprintf_profile(stddeb,"GetSetProfile // enum '%s' !\n", p); dprintf_profile(stddeb,"GetSetProfile // enum '%s' !\n", p);
left -= slen; left -= slen;
p += slen; p += slen;
} }
*p = '\0'; *p = '\0';
dprintf_profile(stddeb,"GetSetProfile // normal end of enum !\n"); return Size - 2 - left;
return (Size - 2 - left);
} }
for (key = section->Keys; key; key = key->link){ for (key = section->Keys; key; key = key->link){
int slen; int slen;
...@@ -305,9 +306,8 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName, ...@@ -305,9 +306,8 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName,
Current->changed=TRUE; Current->changed=TRUE;
return 1; return 1;
} }
slen = MIN(strlen(key->Value), Size - 1); slen = MIN(strlen(key->Value)+1, Size);
ReturnedString[slen] = 0; lstrcpyn(ReturnedString, key->Value, slen);
strncpy (ReturnedString, key->Value, slen);
dprintf_profile(stddeb,"GetSetProfile // Return ``%s''\n", ReturnedString); dprintf_profile(stddeb,"GetSetProfile // Return ``%s''\n", ReturnedString);
return 1; return 1;
} }
...@@ -317,13 +317,13 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName, ...@@ -317,13 +317,13 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName,
if (set) { if (set) {
new_key (section, KeyName, Default); new_key (section, KeyName, Default);
} else { } else {
int slen = MIN(strlen(Default), Size - 1); int slen = MIN(strlen(Default)+1, Size);
ReturnedString[slen] = 0; lstrcpyn(ReturnedString, Default, slen);
strncpy(ReturnedString, Default, slen);
dprintf_profile(stddeb,"GetSetProfile // Key not found\n"); dprintf_profile(stddeb,"GetSetProfile // Key not found\n");
} }
return 1; return 1;
} }
/* Non existent section */ /* Non existent section */
if (set){ if (set){
section = (TSecHeader *) xmalloc (sizeof (TSecHeader)); section = (TSecHeader *) xmalloc (sizeof (TSecHeader));
...@@ -334,9 +334,8 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName, ...@@ -334,9 +334,8 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName,
Current->Section = section; Current->Section = section;
Current->changed = TRUE; Current->changed = TRUE;
} else { } else {
int slen = MIN(strlen(Default), Size - 1); int slen = MIN(strlen(Default)+1, Size);
ReturnedString[slen] = 0; lstrcpyn(ReturnedString, Default, slen);
strncpy(ReturnedString, Default, slen);
dprintf_profile(stddeb,"GetSetProfile // Section not found\n"); dprintf_profile(stddeb,"GetSetProfile // Section not found\n");
} }
return 1; return 1;
......
...@@ -25,48 +25,48 @@ LPKEYSTRUCT lphRootKey = NULL,lphTopKey = NULL; ...@@ -25,48 +25,48 @@ LPKEYSTRUCT lphRootKey = NULL,lphTopKey = NULL;
static char RootKeyName[]=".classes", TopKeyName[] = "[top-null]"; static char RootKeyName[]=".classes", TopKeyName[] = "[top-null]";
/************************************************************************* /*************************************************************************
* SHELL_RegCheckForRoot() internal use only * SHELL_Init()
*/ */
static LONG SHELL_RegCheckForRoot() BOOL SHELL_Init()
{ {
HKEY hNewKey; HKEY hNewKey;
if (lphRootKey == NULL){ hNewKey = GlobalAlloc(GMEM_MOVEABLE,sizeof(KEYSTRUCT));
hNewKey = GlobalAlloc(GMEM_MOVEABLE,sizeof(KEYSTRUCT)); lphRootKey = (LPKEYSTRUCT) GlobalLock(hNewKey);
lphRootKey = (LPKEYSTRUCT) GlobalLock(hNewKey); if (lphRootKey == NULL) {
if (lphRootKey == NULL) {
printf("SHELL_RegCheckForRoot: Couldn't allocate root key!\n"); printf("SHELL_RegCheckForRoot: Couldn't allocate root key!\n");
return ERROR_OUTOFMEMORY; return FALSE;
} }
lphRootKey->hKey = (HKEY)1; lphRootKey->hKey = (HKEY)1;
lphRootKey->lpSubKey = RootKeyName; lphRootKey->lpSubKey = RootKeyName;
lphRootKey->dwType = 0; lphRootKey->dwType = 0;
lphRootKey->lpValue = NULL; lphRootKey->lpValue = NULL;
lphRootKey->lpSubLvl = lphRootKey->lpNextKey = lphRootKey->lpPrevKey = NULL; lphRootKey->lpSubLvl = lphRootKey->lpNextKey = lphRootKey->lpPrevKey = NULL;
hNewKey = GlobalAlloc(GMEM_MOVEABLE,sizeof(KEYSTRUCT)); hNewKey = GlobalAlloc(GMEM_MOVEABLE,sizeof(KEYSTRUCT));
lphTopKey = (LPKEYSTRUCT) GlobalLock(hNewKey); lphTopKey = (LPKEYSTRUCT) GlobalLock(hNewKey);
if (lphTopKey == NULL) { if (lphTopKey == NULL) {
printf("SHELL_RegCheckForRoot: Couldn't allocate top key!\n"); printf("SHELL_RegCheckForRoot: Couldn't allocate top key!\n");
return ERROR_OUTOFMEMORY; return FALSE;
}
lphTopKey->hKey = 0;
lphTopKey->lpSubKey = TopKeyName;
lphTopKey->dwType = 0;
lphTopKey->lpValue = NULL;
lphTopKey->lpSubLvl = lphRootKey;
lphTopKey->lpNextKey = lphTopKey->lpPrevKey = NULL;
dprintf_reg(stddeb,"SHELL_RegCheckForRoot: Root/Top created\n");
} }
return ERROR_SUCCESS; lphTopKey->hKey = 0;
lphTopKey->lpSubKey = TopKeyName;
lphTopKey->dwType = 0;
lphTopKey->lpValue = NULL;
lphTopKey->lpSubLvl = lphRootKey;
lphTopKey->lpNextKey = lphTopKey->lpPrevKey = NULL;
dprintf_reg(stddeb,"SHELL_RegCheckForRoot: Root/Top created\n");
return TRUE;
} }
/* FIXME: the loading and saving of the registry database is rather messy. /* FIXME: the loading and saving of the registry database is rather messy.
* bad input (while reading) may crash wine. * bad input (while reading) may crash wine.
*/ */
void void
_DumpLevel(FILE *f,LPKEYSTRUCT lpTKey,int tabs) { _DumpLevel(FILE *f,LPKEYSTRUCT lpTKey,int tabs)
{
LPKEYSTRUCT lpKey; LPKEYSTRUCT lpKey;
lpKey=lpTKey->lpSubLvl; lpKey=lpTKey->lpSubLvl;
...@@ -86,7 +86,8 @@ _DumpLevel(FILE *f,LPKEYSTRUCT lpTKey,int tabs) { ...@@ -86,7 +86,8 @@ _DumpLevel(FILE *f,LPKEYSTRUCT lpTKey,int tabs) {
} }
static void static void
_SaveKey(HKEY hKey,char *where) { _SaveKey(HKEY hKey,char *where)
{
FILE *f; FILE *f;
LPKEYSTRUCT lpKey; LPKEYSTRUCT lpKey;
...@@ -106,7 +107,8 @@ _SaveKey(HKEY hKey,char *where) { ...@@ -106,7 +107,8 @@ _SaveKey(HKEY hKey,char *where) {
} }
void void
SHELL_SaveRegistry(void) { SHELL_SaveRegistry(void)
{
/* FIXME: /* FIXME:
* -implement win95 additional keytypes here * -implement win95 additional keytypes here
* (HKEY_LOCAL_MACHINE,HKEY_CURRENT_USER or whatever) * (HKEY_LOCAL_MACHINE,HKEY_CURRENT_USER or whatever)
...@@ -117,7 +119,8 @@ SHELL_SaveRegistry(void) { ...@@ -117,7 +119,8 @@ SHELL_SaveRegistry(void) {
#define BUFSIZE 256 #define BUFSIZE 256
void void
_LoadLevel(FILE *f,LPKEYSTRUCT lpKey,int tabsexp,char *buf) { _LoadLevel(FILE *f,LPKEYSTRUCT lpKey,int tabsexp,char *buf)
{
int i; int i;
char *s,*t; char *s,*t;
HKEY hNewKey; HKEY hNewKey;
...@@ -184,7 +187,8 @@ _LoadLevel(FILE *f,LPKEYSTRUCT lpKey,int tabsexp,char *buf) { ...@@ -184,7 +187,8 @@ _LoadLevel(FILE *f,LPKEYSTRUCT lpKey,int tabsexp,char *buf) {
} }
void void
_LoadKey(HKEY hKey,char *from) { _LoadKey(HKEY hKey,char *from)
{
FILE *f; FILE *f;
LPKEYSTRUCT lpKey; LPKEYSTRUCT lpKey;
char buf[BUFSIZE]; /* FIXME: long enough? */ char buf[BUFSIZE]; /* FIXME: long enough? */
...@@ -204,12 +208,8 @@ _LoadKey(HKEY hKey,char *from) { ...@@ -204,12 +208,8 @@ _LoadKey(HKEY hKey,char *from) {
} }
void void
SHELL_LoadRegistry(void) { SHELL_LoadRegistry(void)
DWORD dwRet; {
dwRet=SHELL_RegCheckForRoot();
if (dwRet!=ERROR_SUCCESS)
return;/*very bad magic, if we can't even allocate the rootkeys*/
_LoadKey((HKEY)HKEY_CLASSES_ROOT,"/tmp/winereg"); _LoadKey((HKEY)HKEY_CLASSES_ROOT,"/tmp/winereg");
} }
...@@ -221,10 +221,7 @@ LONG RegOpenKey(HKEY hKey, LPCSTR lpSubKey, HKEY FAR *lphKey) ...@@ -221,10 +221,7 @@ LONG RegOpenKey(HKEY hKey, LPCSTR lpSubKey, HKEY FAR *lphKey)
LPKEYSTRUCT lpKey,lpNextKey; LPKEYSTRUCT lpKey,lpNextKey;
LPCSTR ptr; LPCSTR ptr;
char str[128]; char str[128];
LONG dwRet;
dwRet = SHELL_RegCheckForRoot();
if (dwRet != ERROR_SUCCESS) return dwRet;
dprintf_reg(stddeb, "RegOpenKey(%08lX, %p='%s', %p)\n", dprintf_reg(stddeb, "RegOpenKey(%08lX, %p='%s', %p)\n",
(DWORD)hKey, lpSubKey, lpSubKey, lphKey); (DWORD)hKey, lpSubKey, lpSubKey, lphKey);
if (lphKey == NULL) return ERROR_INVALID_PARAMETER; if (lphKey == NULL) return ERROR_INVALID_PARAMETER;
...@@ -274,12 +271,9 @@ LONG RegCreateKey(HKEY hKey, LPCSTR lpSubKey, HKEY FAR *lphKey) ...@@ -274,12 +271,9 @@ LONG RegCreateKey(HKEY hKey, LPCSTR lpSubKey, HKEY FAR *lphKey)
LPKEYSTRUCT lpNewKey; LPKEYSTRUCT lpNewKey;
LPKEYSTRUCT lpKey; LPKEYSTRUCT lpKey;
LPKEYSTRUCT lpPrevKey; LPKEYSTRUCT lpPrevKey;
LONG dwRet;
LPCSTR ptr; LPCSTR ptr;
char str[128]; char str[128];
dwRet = SHELL_RegCheckForRoot();
if (dwRet != ERROR_SUCCESS) return dwRet;
dprintf_reg(stddeb, "RegCreateKey(%08lX, '%s', %p)\n", (DWORD)hKey, lpSubKey, lphKey); dprintf_reg(stddeb, "RegCreateKey(%08lX, '%s', %p)\n", (DWORD)hKey, lpSubKey, lphKey);
if (lphKey == NULL) return ERROR_INVALID_PARAMETER; if (lphKey == NULL) return ERROR_INVALID_PARAMETER;
switch((DWORD)hKey) { switch((DWORD)hKey) {
...@@ -439,11 +433,8 @@ LONG RegQueryValue(HKEY hKey, LPCSTR lpSubKey, LPSTR lpVal, LONG FAR *lpcb) ...@@ -439,11 +433,8 @@ LONG RegQueryValue(HKEY hKey, LPCSTR lpSubKey, LPSTR lpVal, LONG FAR *lpcb)
LONG RegEnumKey(HKEY hKey, DWORD dwSubKey, LPSTR lpBuf, DWORD dwSize) LONG RegEnumKey(HKEY hKey, DWORD dwSubKey, LPSTR lpBuf, DWORD dwSize)
{ {
LPKEYSTRUCT lpKey; LPKEYSTRUCT lpKey;
LONG dwRet;
LONG len; LONG len;
dwRet = SHELL_RegCheckForRoot();
if (dwRet != ERROR_SUCCESS) return dwRet;
dprintf_reg(stddeb, "RegEnumKey(%08lX, %ld)\n", (DWORD)hKey, dwSubKey); dprintf_reg(stddeb, "RegEnumKey(%08lX, %ld)\n", (DWORD)hKey, dwSubKey);
if (lpBuf == NULL) return ERROR_INVALID_PARAMETER; if (lpBuf == NULL) return ERROR_INVALID_PARAMETER;
switch((DWORD)hKey) { switch((DWORD)hKey) {
...@@ -478,11 +469,12 @@ LONG RegEnumKey(HKEY hKey, DWORD dwSubKey, LPSTR lpBuf, DWORD dwSize) ...@@ -478,11 +469,12 @@ LONG RegEnumKey(HKEY hKey, DWORD dwSubKey, LPSTR lpBuf, DWORD dwSize)
*/ */
void DragAcceptFiles(HWND hWnd, BOOL b) void DragAcceptFiles(HWND hWnd, BOOL b)
{ {
/* flips WS_EX_ACCEPTFILES bit according to the value of b (TRUE or FALSE) */ /* flips WS_EX_ACCEPTFILES bit according to the value of b */
dprintf_reg(stddeb,"DragAcceptFiles("NPFMT", %u) old exStyle %08lx\n",
hWnd,b,GetWindowLong(hWnd,GWL_EXSTYLE));
dprintf_reg(stddeb,"DragAcceptFiles("NPFMT", %u) old exStyle %08lx\n",hWnd,b,GetWindowLong(hWnd,GWL_EXSTYLE)); SetWindowLong(hWnd,GWL_EXSTYLE,
GetWindowLong(hWnd,GWL_EXSTYLE) | b*(LONG)WS_EX_ACCEPTFILES);
SetWindowLong(hWnd,GWL_EXSTYLE,GetWindowLong(hWnd,GWL_EXSTYLE) | b*(LONG)WS_EX_ACCEPTFILES);
} }
...@@ -491,42 +483,42 @@ void DragAcceptFiles(HWND hWnd, BOOL b) ...@@ -491,42 +483,42 @@ void DragAcceptFiles(HWND hWnd, BOOL b)
*/ */
UINT DragQueryFile(HDROP hDrop, WORD wFile, LPSTR lpszFile, WORD wLength) UINT DragQueryFile(HDROP hDrop, WORD wFile, LPSTR lpszFile, WORD wLength)
{ {
/* hDrop is a global memory block allocated with GMEM_SHARE /* hDrop is a global memory block allocated with GMEM_SHARE
with DROPFILESTRUCT as a header and filenames following * with DROPFILESTRUCT as a header and filenames following
it, zero length filename is in the end */ * it, zero length filename is in the end */
LPDROPFILESTRUCT lpDropFileStruct; LPDROPFILESTRUCT lpDropFileStruct;
LPSTR lpCurrent; LPSTR lpCurrent;
WORD i; WORD i;
dprintf_reg(stddeb,"DragQueryFile("NPFMT", %i, %p, %u)\n", dprintf_reg(stddeb,"DragQueryFile("NPFMT", %i, %p, %u)\n",
hDrop,wFile,lpszFile,wLength); hDrop,wFile,lpszFile,wLength);
lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop); lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop);
if(!lpDropFileStruct) if(!lpDropFileStruct)
{ {
dprintf_reg(stddeb,"DragQueryFile: unable to lock handle!\n"); dprintf_reg(stddeb,"DragQueryFile: unable to lock handle!\n");
return 0; return 0;
} }
lpCurrent = (LPSTR) lpDropFileStruct + lpDropFileStruct->wSize; lpCurrent = (LPSTR) lpDropFileStruct + lpDropFileStruct->wSize;
i = 0; i = 0;
while(i++ < wFile) while (i++ < wFile)
{ {
while(*lpCurrent++); /* skip filename */ while (*lpCurrent++); /* skip filename */
if(!*lpCurrent) if (!*lpCurrent)
return (wFile == 0xFFFF)? i : 0; return (wFile == 0xFFFF) ? i : 0;
} }
i = strlen(lpCurrent); i = strlen(lpCurrent);
if(!lpszFile) return i+1; /* needed buffer size */ if (!lpszFile) return i+1; /* needed buffer size */
i = ( wLength > i)? i : wLength-1; i = (wLength > i) ? i : wLength-1;
strncpy(lpszFile,lpCurrent,i); strncpy(lpszFile, lpCurrent, i);
lpszFile[i]='\0'; lpszFile[i] = '\0';
GlobalUnlock(hDrop); GlobalUnlock(hDrop);
return i; return i;
} }
...@@ -535,7 +527,7 @@ UINT DragQueryFile(HDROP hDrop, WORD wFile, LPSTR lpszFile, WORD wLength) ...@@ -535,7 +527,7 @@ UINT DragQueryFile(HDROP hDrop, WORD wFile, LPSTR lpszFile, WORD wLength)
*/ */
void DragFinish(HDROP h) void DragFinish(HDROP h)
{ {
GlobalFree((HGLOBAL)h); GlobalFree((HGLOBAL)h);
} }
...@@ -544,16 +536,16 @@ void DragFinish(HDROP h) ...@@ -544,16 +536,16 @@ void DragFinish(HDROP h)
*/ */
BOOL DragQueryPoint(HDROP hDrop, POINT FAR *p) BOOL DragQueryPoint(HDROP hDrop, POINT FAR *p)
{ {
LPDROPFILESTRUCT lpDropFileStruct; LPDROPFILESTRUCT lpDropFileStruct;
BOOL bRet; BOOL bRet;
lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop); lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop);
memcpy(p,&lpDropFileStruct->ptMousePos,sizeof(POINT)); memcpy(p,&lpDropFileStruct->ptMousePos,sizeof(POINT));
bRet = lpDropFileStruct->fInNonClientArea; bRet = lpDropFileStruct->fInNonClientArea;
GlobalUnlock(hDrop); GlobalUnlock(hDrop);
return bRet; return bRet;
} }
......
...@@ -25,7 +25,7 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] = ...@@ -25,7 +25,7 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
"WM_CREATE", "WM_CREATE",
"WM_DESTROY", "WM_DESTROY",
"WM_MOVE", "WM_MOVE",
"WM_UNUSED0", "WM_SIZEWAIT",
"WM_SIZE", "WM_SIZE",
"WM_ACTIVATE", "WM_ACTIVATE",
"WM_SETFOCUS", "WM_SETFOCUS",
...@@ -62,7 +62,7 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] = ...@@ -62,7 +62,7 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
"WM_PAINTICON", "WM_PAINTICON",
"WM_ICONERASEBKGND", "WM_ICONERASEBKGND",
"WM_NEXTDLGCTL", "WM_NEXTDLGCTL",
"WM_UNUSED4", "WM_ALTTABACTIVE",
"WM_SPOOLERSTATUS", "WM_SPOOLERSTATUS",
"WM_DRAWITEM", "WM_DRAWITEM",
"WM_MEASUREITEM", "WM_MEASUREITEM",
...@@ -70,9 +70,19 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] = ...@@ -70,9 +70,19 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
"WM_VKEYTOITEM", "WM_VKEYTOITEM",
"WM_CHARTOITEM", "WM_CHARTOITEM",
"WM_SETFONT", /* 0x30 */ "WM_SETFONT", /* 0x30 */
"WM_GETFONT", NULL, NULL, NULL, NULL, NULL, "WM_GETFONT",
"WM_QUERYDRAGICON", NULL, "WM_SETHOTKEY",
"WM_COMPAREITEM", NULL, NULL, NULL, NULL, NULL, NULL, "WM_GETHOTKEY",
"WM_FILESYSCHANGE",
"WM_ISACTIVEICON",
"WM_QUERYPARKICON",
"WM_QUERYDRAGICON",
"WM_QUERYSAVESTATE",
"WM_COMPAREITEM",
"WM_TESTING", NULL,
"WM_OTHERWINDOWCREATED",
"WM_OTHERWINDOWDESTROYED",
"WM_ACTIVATESHELLWINDOW", NULL,
NULL, /* 0x40 */ NULL, /* 0x40 */
"WM_COMPACTING", NULL, NULL, "WM_COMPACTING", NULL, NULL,
...@@ -101,7 +111,8 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] = ...@@ -101,7 +111,8 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
"WM_NCPAINT", /* 0x0085 */ "WM_NCPAINT", /* 0x0085 */
"WM_NCACTIVATE", /* 0x0086 */ "WM_NCACTIVATE", /* 0x0086 */
"WM_GETDLGCODE", /* 0x0087 */ "WM_GETDLGCODE", /* 0x0087 */
"WM_SYNCPAINT", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "WM_SYNCPAINT",
"WM_SYNCTASK", NULL, NULL, NULL, NULL, NULL, NULL,
/* 0x0090 */ /* 0x0090 */
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
...@@ -149,7 +160,10 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] = ...@@ -149,7 +160,10 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
"WM_SYSCHAR", /* 0x0106 */ "WM_SYSCHAR", /* 0x0106 */
"WM_SYSDEADCHAR", /* 0x0107 */ "WM_SYSDEADCHAR", /* 0x0107 */
"WM_KEYLAST", /* 0x0108 */ "WM_KEYLAST", /* 0x0108 */
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
"WM_CONVERTREQUEST",
"WM_CONVERTRESULT",
"WM_INTERIM", NULL, NULL, NULL,
"WM_INITDIALOG", /* 0x0110 */ "WM_INITDIALOG", /* 0x0110 */
"WM_COMMAND", /* 0x0111 */ "WM_COMMAND", /* 0x0111 */
...@@ -169,8 +183,7 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] = ...@@ -169,8 +183,7 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/* 0x0130 */ /* 0x0130 */
NULL, NULL, "wm_lbtrackpoint",
"wm_lbtrackpoint",
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
...@@ -237,7 +250,8 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] = ...@@ -237,7 +250,8 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
"WM_PARENTNOTIFY", /* 0x0210 */ "WM_PARENTNOTIFY", /* 0x0210 */
"WM_ENTERMENULOOP", /* 0x0211 */ "WM_ENTERMENULOOP", /* 0x0211 */
"WM_EXITMENULOOP", /* 0x0212 */ "WM_EXITMENULOOP", /* 0x0212 */
NULL, NULL, NULL, NULL, NULL, "WM_NEXTMENU", /* 0x0213 */
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
"WM_MDICREATE", /* 0x0220 */ "WM_MDICREATE", /* 0x0220 */
...@@ -344,10 +358,11 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] = ...@@ -344,10 +358,11 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
/* 0x0380 */ /* 0x0380 */
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
"WM_COALESCE_FIRST", "WM_COALESCE_FIRST",
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
"WM_COALESCE_LAST", "WM_COALESCE_LAST",
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
......
...@@ -35,6 +35,10 @@ static key_t wine_key = 0; ...@@ -35,6 +35,10 @@ static key_t wine_key = 0;
static FARPROC BlockFunction; static FARPROC BlockFunction;
static fd_set fd_in_use; static fd_set fd_in_use;
#ifdef __FreeBSD__
extern int h_errno;
#endif /* __FreeBSD__ */
struct ipc_packet { struct ipc_packet {
long mtype; long mtype;
HANDLE handle; HANDLE handle;
...@@ -48,7 +52,8 @@ struct ipc_packet { ...@@ -48,7 +52,8 @@ struct ipc_packet {
#endif #endif
#define IPC_PACKET_SIZE (sizeof(struct ipc_packet) - sizeof(long)) #define IPC_PACKET_SIZE (sizeof(struct ipc_packet) - sizeof(long))
#define MTYPE 0xb0b0eb05 /*#define MTYPE 0xb0b0eb05*/
#define MTYPE 0x30b0eb05
/* These structures are Win16 only */ /* These structures are Win16 only */
...@@ -831,23 +836,32 @@ static HANDLE AllocWSAHandle(void) ...@@ -831,23 +836,32 @@ static HANDLE AllocWSAHandle(void)
static void recv_message(int sig) static void recv_message(int sig)
{ {
struct ipc_packet message; static struct ipc_packet message;
static int message_is_valid = 0;
BOOL result;
/* FIXME: something about no message of desired type */ signal(SIGUSR1, recv_message);
if (msgrcv(wine_key, (struct msgbuf*)&(message), while (1) {
IPC_PACKET_SIZE, MTYPE, IPC_NOWAIT) == -1)
perror("wine: msgrcv");
fprintf(stderr, if (!message_is_valid) {
"WSA: PostMessage (hwnd "NPFMT", wMsg %d, wParam "NPFMT", lParam %ld)\n", if (msgrcv(wine_key, (struct msgbuf*)&(message),
message.hWnd, IPC_PACKET_SIZE, MTYPE, IPC_NOWAIT) == -1) {
message.wMsg, perror("wine: msgrcv");
message.handle, break;
message.lParam); }
}
PostMessage(message.hWnd, message.wMsg, (WPARAM)message.handle, message.lParam); result = PostMessage(message.hWnd, message.wMsg,
(WPARAM)message.handle, message.lParam);
if (result == FALSE) {
message_is_valid = 1;
break;
}
else
message_is_valid = 0;
}
signal(SIGUSR1, recv_message);
} }
...@@ -861,13 +875,8 @@ static void send_message( HWND hWnd, u_int wMsg, HANDLE handle, long lParam) ...@@ -861,13 +875,8 @@ static void send_message( HWND hWnd, u_int wMsg, HANDLE handle, long lParam)
message.wMsg = wMsg; message.wMsg = wMsg;
message.lParam = lParam; message.lParam = lParam;
fprintf(stderr,
"WSA: send (hwnd "NPFMT", wMsg %d, handle "NPFMT", lParam %ld)\n",
hWnd, wMsg, handle, lParam);
/* FIXME: something about invalid argument */
if (msgsnd(wine_key, (struct msgbuf*)&(message), if (msgsnd(wine_key, (struct msgbuf*)&(message),
IPC_PACKET_SIZE, IPC_NOWAIT) == -1) IPC_PACKET_SIZE, 0/*IPC_NOWAIT*/) == -1)
perror("wine: msgsnd"); perror("wine: msgsnd");
kill(getppid(), SIGUSR1); kill(getppid(), SIGUSR1);
...@@ -1136,12 +1145,14 @@ WSADATA WINSOCK_data = { ...@@ -1136,12 +1145,14 @@ WSADATA WINSOCK_data = {
"WINE Sockets", "WINE Sockets",
#ifdef linux #ifdef linux
"LINUX/i386", "LINUX/i386",
#endif #elif defined(__NetBSD__)
#ifdef __NetBSD__
"NetBSD/i386", "NetBSD/i386",
#endif #elif defined(sunos)
#ifdef sunos
"SunOS", "SunOS",
#elif defined(__FreeBSD__)
"FreeBSD",
#else
"Unknown",
#endif #endif
128, 128,
1024, 1024,
......
...@@ -57,16 +57,10 @@ LONG ANIM_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg, ...@@ -57,16 +57,10 @@ LONG ANIM_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
* for use in mciSendString() * for use in mciSendString()
*/ */
#define _MCI_STR(s) do {\ #define _MCI_STR(s) do {\
int __l__;\
dprintf_mci(stddeb,"->returns \"%s\"",s);\ dprintf_mci(stddeb,"->returns \"%s\"",s);\
if (lpstrReturnString) {\ if (lpstrReturnString) {\
__l__=strlen(s);\ lstrcpyn(lpstrReturnString,s,uReturnLength);\
if(__l__>uReturnLength) {\ dprintf_mci(stddeb,"-->\"%s\"\n",lpstrReturnString);\
strncpy(lpstrReturnString,s,uReturnLength-1);\
lpstrReturnString[uReturnLength-1]='\0';\
} else\
strcpy(lpstrReturnString,s);\
dprintf_mci(stddeb,"-->\"%s\"\n",lpstrReturnString);\
}\ }\
} while(0) } while(0)
......
...@@ -284,7 +284,6 @@ DWORD auxOutMessage(UINT uDeviceID, UINT uMessage, DWORD dw1, DWORD dw2) ...@@ -284,7 +284,6 @@ DWORD auxOutMessage(UINT uDeviceID, UINT uMessage, DWORD dw1, DWORD dw2)
BOOL mciGetErrorString (DWORD wError, LPSTR lpstrBuffer, UINT uLength) BOOL mciGetErrorString (DWORD wError, LPSTR lpstrBuffer, UINT uLength)
{ {
LPSTR msgptr; LPSTR msgptr;
int maxbuf;
dprintf_mmsys(stddeb, "mciGetErrorString(%08lX, %p, %d);\n", wError, lpstrBuffer, uLength); dprintf_mmsys(stddeb, "mciGetErrorString(%08lX, %p, %d);\n", wError, lpstrBuffer, uLength);
if ((lpstrBuffer == NULL) || (uLength < 1)) return(FALSE); if ((lpstrBuffer == NULL) || (uLength < 1)) return(FALSE);
lpstrBuffer[0] = '\0'; lpstrBuffer[0] = '\0';
...@@ -534,10 +533,8 @@ msg# 543 : tmsf ...@@ -534,10 +533,8 @@ msg# 543 : tmsf
msgptr = "Unknown MCI Error !\n"; msgptr = "Unknown MCI Error !\n";
break; break;
} }
maxbuf = MIN(uLength - 1, strlen(msgptr)); lstrcpyn(lpstrBuffer, msgptr, uLength);
if (maxbuf > 0) strncpy(lpstrBuffer, msgptr, maxbuf); return TRUE;
lpstrBuffer[maxbuf + 1] = '\0';
return(TRUE);
} }
...@@ -708,12 +705,10 @@ DWORD mciSysInfo(DWORD dwFlags, LPMCI_SYSINFO_PARMS lpParms) ...@@ -708,12 +705,10 @@ DWORD mciSysInfo(DWORD dwFlags, LPMCI_SYSINFO_PARMS lpParms)
ptr += len; ptr += len;
InstalledListLen += len; InstalledListLen += len;
InstalledCount++; InstalledCount++;
}
}
if (lpParms->dwRetSize < InstalledListLen) {
strncpy(lpstrReturn, lpInstallNames, lpParms->dwRetSize - 2);
lpstrReturn[lpParms->dwRetSize - 1] = '\0';
} }
}
if (lpParms->dwRetSize < InstalledListLen)
lstrcpyn(lpstrReturn, lpInstallNames, lpParms->dwRetSize - 1);
else else
strcpy(lpstrReturn, lpInstallNames); strcpy(lpstrReturn, lpInstallNames);
return 0; return 0;
...@@ -781,7 +776,7 @@ DWORD mciSendCommand(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwParam2) ...@@ -781,7 +776,7 @@ DWORD mciSendCommand(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwParam2)
} }
/************************************************************************** /**************************************************************************
* mciGetDeviceID [MMSYSTEM.703] * mciGetDeviceID [MMSYSTEM.703]
*/ */
UINT mciGetDeviceID (LPCSTR lpstrName) UINT mciGetDeviceID (LPCSTR lpstrName)
{ {
...@@ -860,12 +855,11 @@ UINT midiOutGetErrorText(UINT uError, LPSTR lpText, UINT uSize) ...@@ -860,12 +855,11 @@ UINT midiOutGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
/************************************************************************** /**************************************************************************
* midiGetErrorText [internal] * midiGetErrorText [internal]
*/ */
UINT midiGetErrorText(UINT uError, LPSTR lpText, UINT uSize) UINT midiGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
{ {
LPSTR msgptr; LPSTR msgptr;
int maxbuf;
if ((lpText == NULL) || (uSize < 1)) return(FALSE); if ((lpText == NULL) || (uSize < 1)) return(FALSE);
lpText[0] = '\0'; lpText[0] = '\0';
switch(uError) { switch(uError) {
...@@ -901,17 +895,15 @@ msg# 343 : There are no MIDI devices installed on the system. Use the Drivers op ...@@ -901,17 +895,15 @@ msg# 343 : There are no MIDI devices installed on the system. Use the Drivers op
msgptr = "Unknown MIDI Error !\n"; msgptr = "Unknown MIDI Error !\n";
break; break;
} }
maxbuf = MIN(uSize - 1, strlen(msgptr)); lstrcpyn(lpText, msgptr, uSize);
if (maxbuf > 0) strncpy(lpText, msgptr, maxbuf); return TRUE;
lpText[maxbuf + 1] = '\0';
return(TRUE);
} }
/************************************************************************** /**************************************************************************
* midiOutOpen [MMSYSTEM.204] * midiOutOpen [MMSYSTEM.204]
*/ */
UINT midiOutOpen(HMIDIOUT FAR* lphMidiOut, UINT uDeviceID, UINT midiOutOpen(HMIDIOUT FAR* lphMidiOut, UINT uDeviceID,
DWORD dwCallback, DWORD dwInstance, DWORD dwFlags) DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
{ {
HMIDI hMidiOut; HMIDI hMidiOut;
LPMIDIOPENDESC lpDesc; LPMIDIOPENDESC lpDesc;
...@@ -925,7 +917,7 @@ UINT midiOutOpen(HMIDIOUT FAR* lphMidiOut, UINT uDeviceID, ...@@ -925,7 +917,7 @@ UINT midiOutOpen(HMIDIOUT FAR* lphMidiOut, UINT uDeviceID,
dprintf_mmsys(stddeb, "midiOutOpen // MIDI_MAPPER mode requested !\n"); dprintf_mmsys(stddeb, "midiOutOpen // MIDI_MAPPER mode requested !\n");
bMapperFlg = TRUE; bMapperFlg = TRUE;
uDeviceID = 0; uDeviceID = 0;
} }
hMidiOut = USER_HEAP_ALLOC(sizeof(MIDIOPENDESC)); hMidiOut = USER_HEAP_ALLOC(sizeof(MIDIOPENDESC));
if (lphMidiOut != NULL) *lphMidiOut = hMidiOut; if (lphMidiOut != NULL) *lphMidiOut = hMidiOut;
lp16Desc = (LPMIDIOPENDESC) USER_HEAP_SEG_ADDR(hMidiOut); lp16Desc = (LPMIDIOPENDESC) USER_HEAP_SEG_ADDR(hMidiOut);
...@@ -1300,7 +1292,6 @@ UINT waveOutGetErrorText(UINT uError, LPSTR lpText, UINT uSize) ...@@ -1300,7 +1292,6 @@ UINT waveOutGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
UINT waveGetErrorText(UINT uError, LPSTR lpText, UINT uSize) UINT waveGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
{ {
LPSTR msgptr; LPSTR msgptr;
int maxbuf;
dprintf_mmsys(stddeb, "waveGetErrorText(%04X, %p, %d);\n", uError, lpText, uSize); dprintf_mmsys(stddeb, "waveGetErrorText(%04X, %p, %d);\n", uError, lpText, uSize);
if ((lpText == NULL) || (uSize < 1)) return(FALSE); if ((lpText == NULL) || (uSize < 1)) return(FALSE);
lpText[0] = '\0'; lpText[0] = '\0';
...@@ -1357,10 +1348,8 @@ UINT waveGetErrorText(UINT uError, LPSTR lpText, UINT uSize) ...@@ -1357,10 +1348,8 @@ UINT waveGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
msgptr = "Unknown MMSYSTEM Error !\n"; msgptr = "Unknown MMSYSTEM Error !\n";
break; break;
} }
maxbuf = MIN(uSize - 1, strlen(msgptr)); lstrcpyn(lpText, msgptr, uSize);
if (maxbuf > 0) strncpy(lpText, msgptr, maxbuf); return TRUE;
lpText[maxbuf + 1] = '\0';
return(TRUE);
} }
/************************************************************************** /**************************************************************************
......
...@@ -1249,8 +1249,8 @@ BOOL PatBlt( HDC hdc, short left, short top, ...@@ -1249,8 +1249,8 @@ BOOL PatBlt( HDC hdc, short left, short top,
/*********************************************************************** /***********************************************************************
* BitBlt (GDI.34) * BitBlt (GDI.34)
*/ */
BOOL BitBlt( HDC hdcDst, short xDst, short yDst, short width, short height, BOOL BitBlt( HDC hdcDst, INT xDst, INT yDst, INT width, INT height,
HDC hdcSrc, short xSrc, short ySrc, DWORD rop ) HDC hdcSrc, INT xSrc, INT ySrc, DWORD rop )
{ {
DC *dcDst, *dcSrc; DC *dcDst, *dcSrc;
......
...@@ -484,8 +484,7 @@ INT GetTextFace( HDC hdc, INT count, LPSTR name ) ...@@ -484,8 +484,7 @@ INT GetTextFace( HDC hdc, INT count, LPSTR name )
if (!dc) return 0; if (!dc) return 0;
if (!(font = (FONTOBJ *) GDI_GetObjPtr( dc->w.hFont, FONT_MAGIC ))) if (!(font = (FONTOBJ *) GDI_GetObjPtr( dc->w.hFont, FONT_MAGIC )))
return 0; return 0;
strncpy( name, font->logfont.lfFaceName, count ); lstrcpyn( name, font->logfont.lfFaceName, count );
name[count-1] = '\0';
return strlen(name); return strlen(name);
} }
......
...@@ -417,7 +417,7 @@ int EnumObjects(HDC hDC, int nObjType, FARPROC lpEnumFunc, LPSTR lpData) ...@@ -417,7 +417,7 @@ int EnumObjects(HDC hDC, int nObjType, FARPROC lpEnumFunc, LPSTR lpData)
HANDLE hLog; HANDLE hLog;
int nRet = 0; int nRet = 0;
if (lpEnumFunc == NULL) { if (lpEnumFunc == 0) {
fprintf(stderr,"EnumObjects // Bad EnumProc callback address !\n"); fprintf(stderr,"EnumObjects // Bad EnumProc callback address !\n");
return 0; return 0;
} }
......
...@@ -245,7 +245,8 @@ BOOL PlayMetaFile(HDC hdc, HMETAFILE hmf) ...@@ -245,7 +245,8 @@ BOOL PlayMetaFile(HDC hdc, HMETAFILE hmf)
return FALSE; return FALSE;
/* create the handle table */ /* create the handle table */
hHT = GlobalAlloc(GMEM_MOVEABLE, sizeof(HANDLETABLE) * mh->mtNoObjects); hHT = GlobalAlloc(GMEM_MOVEABLE|GMEM_ZEROINIT,
sizeof(HANDLETABLE) * mh->mtNoObjects);
ht = (HANDLETABLE *)GlobalLock(hHT); ht = (HANDLETABLE *)GlobalLock(hHT);
/* loop through metafile playing records */ /* loop through metafile playing records */
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <windows.h> #include <windows.h>
#include <neexe.h> /* #include <neexe.h> */
#include "parser.h" #include "parser.h"
#include "y.tab.h" #include "y.tab.h"
...@@ -539,16 +539,7 @@ void create_output(gen_res* top) ...@@ -539,16 +539,7 @@ void create_output(gen_res* top)
fprintf( header, "/* %s\n" fprintf( header, "/* %s\n"
" * This file is automatically generated. Do not edit!\n" " * This file is automatically generated. Do not edit!\n"
" */\n\n" " */\n\n"
"#ifndef __RESOURCE_DEFINED__\n" "#include \"resource.h\"\n", hname );
"#define __RESOURCE_DEFINED__\n"
"struct resource\n"
"{\n"
" int id, type;\n"
" char *name;\n"
" unsigned char *bytes;\n"
" unsigned int size;\n"
"};\n"
"#endif\n", hname );
/* Declare the resources */ /* Declare the resources */
...@@ -583,15 +574,15 @@ void create_output(gen_res* top) ...@@ -583,15 +574,15 @@ void create_output(gen_res* top)
int type; int type;
switch(it->type) switch(it->type)
{ {
case acc:type=NE_RSCTYPE_ACCELERATOR;break; case acc:type=RT_ACCELERATOR;break;
case bmp:type=NE_RSCTYPE_BITMAP;break; case bmp:type=RT_BITMAP;break;
case cur:type=NE_RSCTYPE_CURSOR;break; case cur:type=RT_CURSOR;break;
case dlg:type=NE_RSCTYPE_DIALOG;break; case dlg:type=RT_DIALOG;break;
case fnt:type=NE_RSCTYPE_FONT;break; case fnt:type=RT_FONT;break;
case ico:type=NE_RSCTYPE_ICON;break; case ico:type=RT_ICON;break;
case men:type=NE_RSCTYPE_MENU;break; case men:type=RT_MENU;break;
case rdt:type=NE_RSCTYPE_RCDATA;break; case rdt:type=RT_RCDATA;break;
case str:type=NE_RSCTYPE_STRING;break; case str:type=RT_STRING;break;
default:fprintf(stderr,"Unknown restype\n");type=-1;break; default:fprintf(stderr,"Unknown restype\n");type=-1;break;
} }
if(it->n_type) if(it->n_type)
...@@ -610,6 +601,22 @@ void create_output(gen_res* top) ...@@ -610,6 +601,22 @@ void create_output(gen_res* top)
for (it=top;it;it=it->next) for (it=top;it;it=it->next)
fprintf( code, " &%s,\n", get_resource_name(it) ); fprintf( code, " &%s,\n", get_resource_name(it) );
fprintf( code, " 0\n};\n" ); fprintf( code, " 0\n};\n" );
/* Perform autoregistration */
fprintf( code,
"#ifdef WINELIB\n"
"static void DoIt() WINE_CONSTRUCTOR;\n"
"static void DoIt()\n"
"{\n"
"\tLIBRES_RegisterResources(%sTable);\n"
"}\n\n"
"#ifndef HAVE_WINE_CONSTRUCTOR\n"
"void LIBWINE_Register_%s(){\n"
"\tDoIt();\n"
"}\n"
"#endif\n"
"#endif /*WINELIB*/\n"
,prefix,prefix);
} }
gen_res* make_font(gen_res* res) gen_res* make_font(gen_res* res)
......
...@@ -30,7 +30,7 @@ hello3res.o: hello3res.rc ...@@ -30,7 +30,7 @@ hello3res.o: hello3res.rc
echo WINDOWS_H_ENDS_HERE >>hello3res.rct echo WINDOWS_H_ENDS_HERE >>hello3res.rct
cat hello3res.rc >>hello3res.rct cat hello3res.rc >>hello3res.rct
$(CC) $(ALLCFLAGS) -E -x c -P hello3res.rct | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | ../rc/winerc -o hello3res -v -p hello3 $(CC) $(ALLCFLAGS) -E -x c -P hello3res.rct | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | ../rc/winerc -o hello3res -v -p hello3
gcc -c hello3res.c gcc -c $(ALLCFLAGS) hello3res.c
@MAKE_RULES@ @MAKE_RULES@
......
...@@ -108,7 +108,10 @@ WORD LocalFlags (HANDLE hMem) ...@@ -108,7 +108,10 @@ WORD LocalFlags (HANDLE hMem)
HANDLE LocalFree (HANDLE hMem) HANDLE LocalFree (HANDLE hMem)
{ {
void **m = HEAP_FindSlot (hMem); void **m;
if(!hMem)
return 0;
m = HEAP_FindSlot (hMem);
free (*m); free (*m);
*m = 0; *m = 0;
...@@ -232,7 +235,10 @@ HANDLE HEAP_Alloc (WORD flags, DWORD bytes) ...@@ -232,7 +235,10 @@ HANDLE HEAP_Alloc (WORD flags, DWORD bytes)
HANDLE HEAP_Free (HANDLE hMem) HANDLE HEAP_Free (HANDLE hMem)
{ {
HeapData* m=(HeapData*)hMem; HeapData* m;
if(!hMem)
return 0;
m=(HeapData*)hMem;
free(m-1); free(m-1);
return 0; return 0;
} }
...@@ -296,7 +302,6 @@ UINT LocalSize (HANDLE hMem) ...@@ -296,7 +302,6 @@ UINT LocalSize (HANDLE hMem)
return HEAP_Size(hMem); return HEAP_Size(hMem);
} }
BOOL LocalUnlock (HANDLE hMem) BOOL LocalUnlock (HANDLE hMem)
{ {
return 0; return 0;
......
...@@ -87,7 +87,7 @@ int PASCAL WinMain (HANDLE inst, HANDLE prev, LPSTR cmdline, int show) ...@@ -87,7 +87,7 @@ int PASCAL WinMain (HANDLE inst, HANDLE prev, LPSTR cmdline, int show)
wnd = CreateWindow ("class", "Test app", WS_OVERLAPPEDWINDOW, wnd = CreateWindow ("class", "Test app", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
LoadMenuIndirect(hello3_MENU_MAIN.bytes), inst, 0); LoadMenu(inst,"MAIN"), inst, 0);
ShowWindow (wnd, show); ShowWindow (wnd, show);
UpdateWindow (wnd); UpdateWindow (wnd);
......
...@@ -5,19 +5,12 @@ ...@@ -5,19 +5,12 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include "windows.h" #include <stdlib.h>
#include "libres.h"
struct resource /* This needs to coincide with what winerc generates. */
{ /* It should really only appear in one place. */
int id, type;
char *name;
unsigned char *bytes;
unsigned int size;
};
typedef struct RLE typedef struct RLE
{ {
struct resource** Resources /* NULL-terminated array of pointers */ struct resource** Resources; /* NULL-terminated array of pointers */
struct RLE* next; struct RLE* next;
} ResListE; } ResListE;
...@@ -28,11 +21,11 @@ void LIBRES_RegisterResources(struct resource** Res) ...@@ -28,11 +21,11 @@ void LIBRES_RegisterResources(struct resource** Res)
ResListE** Curr; ResListE** Curr;
ResListE* n; ResListE* n;
for(Curr=&ResourceList; *Curr; Curr=&((*Curr)->next)) { } for(Curr=&ResourceList; *Curr; Curr=&((*Curr)->next)) { }
n=malloc(sizeof(ResListE)); n=xmalloc(sizeof(ResListE));
if(n) if(n)
{ {
n.Resources=Res; n->Resources=Res;
n.next=NULL; n->next=NULL;
*Curr=n; *Curr=n;
} }
else else
...@@ -42,9 +35,48 @@ void LIBRES_RegisterResources(struct resource** Res) ...@@ -42,9 +35,48 @@ void LIBRES_RegisterResources(struct resource** Res)
/********************************************************************** /**********************************************************************
* LIBRES_FindResource * LIBRES_FindResource
*/ */
HRSRC LIBRES_FindResource( HMODULE hModule, SEGPTR name, SEGPTR type ) HRSRC LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type )
{ {
WINELIB_UNIMP("LIBRES_FindResource()"); int nameid=0,typeid;
ResListE* ResBlock;
struct resource** Res;
if(HIWORD(name))
{
if(*name=='#')
{
nameid=atoi(name+1);
name=NULL;
}
}
else
{
nameid=LOWORD(name);
name=NULL;
}
if(HIWORD(type))
{
if(*type=='#')
typeid=atoi(type+1);
else
{
WINELIB_UNIMP("LIBRES_FindResource(*,*,type=string)");
return 0;
}
}
else
typeid=LOWORD(type);
for(ResBlock=ResourceList; ResBlock; ResBlock=ResBlock->next)
for(Res=ResBlock->Resources; *Res; Res++)
if(name)
{
if((*Res)->type==typeid && !strcmp((*Res)->name,name))
return (HRSRC)*Res;
}
else
if((*Res)->type==typeid && (*Res)->id==nameid)
return (HRSRC)*Res;
return 0; return 0;
} }
...@@ -52,7 +84,7 @@ HRSRC LIBRES_FindResource( HMODULE hModule, SEGPTR name, SEGPTR type ) ...@@ -52,7 +84,7 @@ HRSRC LIBRES_FindResource( HMODULE hModule, SEGPTR name, SEGPTR type )
/********************************************************************** /**********************************************************************
* LIBRES_LoadResource * LIBRES_LoadResource
*/ */
HGLOBAL LIBRES_LoadResource( HMODULE hModule, HRSRC hRsrc ) HGLOBAL LIBRES_LoadResource( HINSTANCE hModule, HRSRC hRsrc )
{ {
return (HGLOBAL)(((struct resource*)hRsrc)->bytes); return (HGLOBAL)(((struct resource*)hRsrc)->bytes);
} }
...@@ -61,7 +93,7 @@ HGLOBAL LIBRES_LoadResource( HMODULE hModule, HRSRC hRsrc ) ...@@ -61,7 +93,7 @@ HGLOBAL LIBRES_LoadResource( HMODULE hModule, HRSRC hRsrc )
/********************************************************************** /**********************************************************************
* LIBRES_LockResource * LIBRES_LockResource
*/ */
LPVOID LIBRES_LockResource( HMODULE hModule, HGLOBAL handle ) LPVOID LIBRES_LockResource( HGLOBAL handle )
{ {
return handle; return handle;
} }
...@@ -70,9 +102,10 @@ LPVOID LIBRES_LockResource( HMODULE hModule, HGLOBAL handle ) ...@@ -70,9 +102,10 @@ LPVOID LIBRES_LockResource( HMODULE hModule, HGLOBAL handle )
/********************************************************************** /**********************************************************************
* LIBRES_FreeResource * LIBRES_FreeResource
*/ */
BOOL LIBRES_FreeResource( HMODULE hModule, HGLOBAL handle ) BOOL LIBRES_FreeResource( HGLOBAL handle )
{ {
return 0; WINELIB_UNIMP("LIBRES_FreeResource()");
return 0; /* Obsolete in Win32 */
} }
...@@ -82,25 +115,25 @@ BOOL LIBRES_FreeResource( HMODULE hModule, HGLOBAL handle ) ...@@ -82,25 +115,25 @@ BOOL LIBRES_FreeResource( HMODULE hModule, HGLOBAL handle )
INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC hRsrc ) INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC hRsrc )
{ {
WINELIB_UNIMP("LIBRES_AccessResource()"); WINELIB_UNIMP("LIBRES_AccessResource()");
return -1; return -1; /* Obsolete in Win32 */
} }
/********************************************************************** /**********************************************************************
* LIBRES_SizeofResource * LIBRES_SizeofResource
*/ */
DWORD LIBRES_SizeofResource( HMODULE hModule, HRSRC hRsrc ) DWORD LIBRES_SizeofResource( HINSTANCE hModule, HRSRC hRsrc )
{ {
return (HGLOBAL)(((struct resource*)hRsrc)->size); return (DWORD)(((struct resource*)hRsrc)->size);
} }
/********************************************************************** /**********************************************************************
* LIBRES_AllocResource * LIBRES_AllocResource
*/ */
HGLOBAL LIBRES_AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size ) HGLOBAL LIBRES_AllocResource( HINSTANCE hModule, HRSRC hRsrc, DWORD size )
{ {
WINELIB_UNIMP("LIBRES_AllocResource()"); WINELIB_UNIMP("LIBRES_AllocResource()");
return 0; return 0; /* Obsolete in Win32 */
} }
...@@ -789,7 +789,29 @@ static void BuildSpec32Files( char *specname ) ...@@ -789,7 +789,29 @@ static void BuildSpec32Files( char *specname )
case TYPE_CDECL: case TYPE_CDECL:
varargs=0; varargs=0;
argc=strlen(fdp->arg_types); argc=strlen(fdp->arg_types);
printf( "void %s_%d(", UpperDLLName, i); if(odp->type == TYPE_STDCALL)
{
/* Output a function prototype with stdcall attribute */
printf( "void %s_%d(", UpperDLLName, i);
for(argno=0;argno<argc;argno++)
{
switch(fdp->arg_types[argno])
{
case 'p': printf( "void *");break;
case 'l': printf( "int ");break;
case '.': printf( "... ");varargs=argno;break;
default:
fprintf(stderr, "Not supported argument type %c\n",
fdp->arg_types[argno]);
exit(1);
}
if(fdp->arg_types[argno]!='.') putchar( 'a'+argno );
if (argno!=argc-1) putchar( ',' );
}
printf( ") __attribute((stdcall));" );
}
printf( "void %s_%d(", UpperDLLName, i);
for(argno=0;argno<argc;argno++) for(argno=0;argno<argc;argno++)
{ {
switch(fdp->arg_types[argno]) switch(fdp->arg_types[argno])
...@@ -806,7 +828,6 @@ static void BuildSpec32Files( char *specname ) ...@@ -806,7 +828,6 @@ static void BuildSpec32Files( char *specname )
if (argno!=argc-1) putchar( ',' ); if (argno!=argc-1) putchar( ',' );
} }
printf( ")" ); printf( ")" );
if(odp->type == TYPE_STDCALL) printf(" /*__attribute__ ((stdcall))*/");
printf( "\n{\n" ); printf( "\n{\n" );
if (varargs) printf( "\tva_list valist;\n\n\tva_start(valist, %c);", if (varargs) printf( "\tva_list valist;\n\n\tva_start(valist, %c);",
'a'+varargs-1 ); 'a'+varargs-1 );
......
/* /*
* Win32 advapi functions * Win32 advapi functions
* *
* Copyright 1995 Martin von Loewis * Copyright 1995 Sven Verdoolaege
*/ */
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include "windows.h" #include "windows.h"
#include "winerror.h" #include "winerror.h"
/*#include "kernel32.h"*/ #include "advapi32.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* GetUserNameA (ADVAPI32.67) * GetUserNameA (ADVAPI32.67)
*/ */
int GetUserNameA(LPSTR lpszName, LPDWORD lpSize) BOOL WINAPI GetUserNameA(LPSTR lpszName, LPDWORD lpSize)
{ {
size_t len; size_t len;
char *name; char *name;
...@@ -32,3 +32,49 @@ int GetUserNameA(LPSTR lpszName, LPDWORD lpSize) ...@@ -32,3 +32,49 @@ int GetUserNameA(LPSTR lpszName, LPDWORD lpSize)
return 1; return 1;
} }
/***********************************************************************
* RegCreateKeyEx (ADVAPI32.130)
*/
WINAPI LONG RegCreateKeyEx(HKEY key,
const char *subkey,
long dontuse,
const char *keyclass,
DWORD options,
REGSAM sam,
SECURITY_ATTRIBUTES *atts,
HKEY *res,
DWORD *disp)
{
/* ahum */
return RegCreateKey(key, subkey, res);
}
/***********************************************************************
* RegSetValueEx (ADVAPI32.169)
*/
WINAPI LONG RegSetValueEx (HKEY key,
const char *name,
DWORD dontuse,
DWORD type,
const void* data,
DWORD len
)
{
return 0;
}
/***********************************************************************
* RegQueryValueEx (ADVAPI32.157)
*/
WINAPI LONG RegQueryValueEx(HKEY key,
const char *subkey,
DWORD dontuse,
DWORD *type,
void *ptr,
DWORD *len)
{
return 0;
}
...@@ -6,10 +6,12 @@ ...@@ -6,10 +6,12 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include "windows.h" #include "windows.h"
#include "winerror.h" #include "winerror.h"
#include "kernel32.h" #include "kernel32.h"
#include "task.h" #include "task.h"
#include "pe_image.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
...@@ -20,8 +22,13 @@ ...@@ -20,8 +22,13 @@
LPSTR GetCommandLineA(void) LPSTR GetCommandLineA(void)
{ {
static char buffer[256]; static char buffer[256];
char *cp;
PDB *pdb = (PDB *)GlobalLock( GetCurrentPDB() ); PDB *pdb = (PDB *)GlobalLock( GetCurrentPDB() );
memcpy( buffer, &pdb->cmdLine[1], pdb->cmdLine[0] );
strcpy(buffer, wine_files->name);
cp = buffer+strlen(buffer);
*cp++ = ' ';
memcpy( cp, &pdb->cmdLine[1], pdb->cmdLine[0] );
dprintf_win32(stddeb,"CommandLine = %s\n", buffer ); dprintf_win32(stddeb,"CommandLine = %s\n", buffer );
return buffer; return buffer;
} }
......
...@@ -5,14 +5,100 @@ ...@@ -5,14 +5,100 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <errno.h>
#include "windows.h" #include "windows.h"
#include "winerror.h" #include "winerror.h"
#include "kernel32.h" #include "kernel32.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
/* WIN32_LastError contains the last error that occurred in the
* Win32 API. This value should be stored separately for each
* thread, when we eventually get thread support.
*/
static int WIN32_LastError; static int WIN32_LastError;
/* The errno_xlat_table contains the errno-to-Win32 error
* mapping. Since this is a single table, it can't easily
* take into account function-specific differences, so there
* will probably be quite a few points where we don't exactly
* match what NT would return. Then again, neither does
* Windows 95. :-)
*/
typedef struct {
int errno;
DWORD win32err;
} ERRNO_XLAT_TABLE;
/* The table looks pretty ugly due to the preprocessor stuff,
* but I honestly have no idea how many of these values are
* portable. I'm not even sure how many of them are even
* used at all. :-)
*/
static ERRNO_XLAT_TABLE errno_xlat_table[] = {
#if defined(EPERM)
{ EPERM, ERROR_ACCESS_DENIED },
#endif
#if defined(ENOENT)
{ ENOENT, ERROR_FILE_NOT_FOUND },
#endif
#if defined(ESRCH)
{ ESRCH, ERROR_INVALID_PARAMETER },
#endif
#if defined(EIO)
{ EIO, ERROR_IO_DEVICE },
#endif
#if defined(ENOEXEC)
{ ENOEXEC, ERROR_BAD_FORMAT },
#endif
#if defined(EBADF)
{ EBADF, ERROR_INVALID_HANDLE },
#endif
#if defined(ENOMEM)
{ ENOMEM, ERROR_OUTOFMEMORY },
#endif
#if defined(EACCES)
{ EACCES, ERROR_ACCESS_DENIED },
#endif
#if defined(EBUSY)
{ EBUSY, ERROR_BUSY },
#endif
#if defined(EEXIST)
{ EEXIST, ERROR_FILE_EXISTS },
#endif
#if defined(ENODEV)
{ ENODEV, ERROR_BAD_DEVICE },
#endif
#if defined(EINVAL)
{ EINVAL, ERROR_INVALID_PARAMETER },
#endif
#if defined(EMFILE)
{ EMFILE, ERROR_TOO_MANY_OPEN_FILES },
#endif
#if defined(ETXTBSY)
{ ETXTBSY, ERROR_BUSY, },
#endif
#if defined(ENOSPC)
{ ENOSPC, ERROR_DISK_FULL },
#endif
#if defined(ESPIPE)
{ ESPIPE, ERROR_SEEK_ON_DEVICE },
#endif
#if defined(EPIPE)
{ EPIPE, ERROR_BROKEN_PIPE },
#endif
#if defined(EDEADLK)
{ EDEADLK, ERROR_POSSIBLE_DEADLOCK },
#endif
#if defined(ENAMETOOLONG)
{ ENAMETOOLONG, ERROR_FILENAME_EXCED_RANGE },
#endif
#if defined(ENOTEMPTY)
{ ENOTEMPTY, ERROR_DIR_NOT_EMPTY },
#endif
{ -1, 0 }
};
/********************************************************************** /**********************************************************************
* GetLastError (KERNEL32.227) * GetLastError (KERNEL32.227)
*/ */
...@@ -34,5 +120,18 @@ void SetLastError(DWORD error) ...@@ -34,5 +120,18 @@ void SetLastError(DWORD error)
DWORD ErrnoToLastError(int errno_num) DWORD ErrnoToLastError(int errno_num)
{ {
return errno_num; /* Obviously not finished yet. :-) */ DWORD rc = ERROR_UNKNOWN;
int i = 0;
while(errno_xlat_table[i].errno != -1)
{
if(errno_xlat_table[i].errno == errno_num)
{
rc = errno_xlat_table[i].win32err;
break;
}
i++;
}
return rc;
} }
/* /*
* Win32 kernel functions * Win32 kernel functions
* *
* Copyright 1995 Martin von Loewis and Cameron Heide * Copyright 1995 Martin von Loewis, Sven Verdoolaege, and Cameron Heide
*/ */
#include <errno.h> #include <errno.h>
...@@ -9,8 +9,10 @@ ...@@ -9,8 +9,10 @@
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include <time.h>
#include "windows.h" #include "windows.h"
#include "winerror.h" #include "winerror.h"
#include "kernel32.h" #include "kernel32.h"
...@@ -25,31 +27,151 @@ extern FILE_OBJECT *hstdin; ...@@ -25,31 +27,151 @@ extern FILE_OBJECT *hstdin;
extern FILE_OBJECT *hstdout; extern FILE_OBJECT *hstdout;
extern FILE_OBJECT *hstderr; extern FILE_OBJECT *hstderr;
static void UnixTimeToFileTime(time_t unix_time, FILETIME *filetime);
static int TranslateCreationFlags(DWORD create_flags); static int TranslateCreationFlags(DWORD create_flags);
static int TranslateAccessFlags(DWORD access_flags); static int TranslateAccessFlags(DWORD access_flags);
/*********************************************************************** /***********************************************************************
* GetFileInformationByHandle (KERNEL32.219) * OpenFileMappingA (KERNEL32.397)
* *
*/ */
HANDLE WINAPI CreateFileA(const char * filename, DWORD a, DWORD b, void * c, WINAPI HANDLE32 OpenFileMapping(DWORD access, BOOL inherit,const char *fname)
DWORD d, DWORD e, DWORD f)
{ {
dprintf_win32(stderr, "CreateFileA: %s\n", filename); return 0;
return -1; }
/***********************************************************************
* CreateFileMappingA (KERNEL32.46)
*
*/
WINAPI HANDLE32 CreateFileMapping(HANDLE32 h,SECURITY_ATTRIBUTES *ats,
DWORD pot, DWORD sh, DWORD hlow, const char * lpName )
{
FILE_OBJECT *file_obj;
FILEMAP_OBJECT *filemap_obj;
int fd;
if (sh)
{
SetLastError(ErrnoToLastError(errno));
return INVALID_HANDLE_VALUE;
}
fd = open(lpName, O_CREAT, 0666);
#if 0
fd = open(DOS_GetUnixFileName(lpName), 0, 0666);
#endif
if(fd == -1)
{
SetLastError(ErrnoToLastError(errno));
return INVALID_HANDLE_VALUE;
}
file_obj = (FILE_OBJECT *)
CreateKernelObject(sizeof(FILE_OBJECT));
if(file_obj == NULL)
{
SetLastError(ERROR_UNKNOWN);
return 0;
}
filemap_obj = (FILEMAP_OBJECT *)
CreateKernelObject(sizeof(FILEMAP_OBJECT));
if(filemap_obj == NULL)
{
ReleaseKernelObject(file_obj);
SetLastError(ERROR_UNKNOWN);
return 0;
}
file_obj->common.magic = KERNEL_OBJECT_FILE;
file_obj->fd = fd;
file_obj->type = FILE_TYPE_DISK;
filemap_obj->common.magic = KERNEL_OBJECT_FILEMAP;
filemap_obj->file_obj = file_obj;
filemap_obj->prot = TranslateProtectionFlags(pot);
filemap_obj->size = hlow;
return (HANDLE32)filemap_obj;;
}
/***********************************************************************
* MapViewOfFileEx (KERNEL32.386)
*
*/
WINAPI void *MapViewOfFileEx(HANDLE32 handle, DWORD access, DWORD offhi,
DWORD offlo, DWORD size, DWORD st)
{
if (!size) size = ((FILEMAP_OBJECT *)handle)->size;
return mmap (st, size, ((FILEMAP_OBJECT *)handle)->prot,
MAP_ANON|MAP_PRIVATE,
((FILEMAP_OBJECT *)handle)->file_obj->fd,
offlo);
} }
/*********************************************************************** /***********************************************************************
* GetFileInformationByHandle (KERNEL32.219) * GetFileInformationByHandle (KERNEL32.219)
* *
*/ */
DWORD WINAPI GetFileInformationByHandle(HANDLE hFile, DWORD WINAPI GetFileInformationByHandle(FILE_OBJECT *hFile,
BY_HANDLE_FILE_INFORMATION *lpfi) BY_HANDLE_FILE_INFORMATION *lpfi)
{ {
memset(lpfi, 0, sizeof(BY_HANDLE_FILE_INFORMATION)); struct stat file_stat;
int rc;
if(ValidateKernelObject((HANDLE32)hFile) != 0)
{
SetLastError(ERROR_INVALID_HANDLE);
return 0;
}
if(hFile->common.magic != KERNEL_OBJECT_FILE)
{
SetLastError(ERROR_INVALID_HANDLE);
return 0;
}
rc = fstat(hFile->fd, &file_stat);
if(rc == -1)
{
SetLastError(ErrnoToLastError(errno));
return 0;
}
/* Translate the file attributes.
*/
lpfi->dwFileAttributes = 0;
if(file_stat.st_mode & S_IFREG)
lpfi->dwFileAttributes |= FILE_ATTRIBUTE_NORMAL;
if(file_stat.st_mode & S_IFDIR)
lpfi->dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
if(file_stat.st_mode & S_IWRITE == 0)
lpfi->dwFileAttributes |= FILE_ATTRIBUTE_READONLY;
/* Translate the file times. Use the last modification time
* for both the creation time and write time.
*/
UnixTimeToFileTime(file_stat.st_mtime, &(lpfi->ftCreationTime));
UnixTimeToFileTime(file_stat.st_mtime, &(lpfi->ftLastWriteTime));
UnixTimeToFileTime(file_stat.st_atime, &(lpfi->ftLastAccessTime));
lpfi->nFileSizeLow = file_stat.st_size;
lpfi->nNumberOfLinks = file_stat.st_nlink;
lpfi->nFileIndexLow = file_stat.st_ino;
/* Zero out currently unused fields.
*/
lpfi->dwVolumeSerialNumber = 0;
lpfi->nFileSizeHigh = 0;
lpfi->nFileIndexHigh = 0;
return 1; return 1;
} }
static void UnixTimeToFileTime(time_t unix_time, FILETIME *filetime)
{
/* This isn't anywhere close to being correct, but should
* work for now.
*/
filetime->dwLowDateTime = (unix_time & 0x0000FFFF) << 16;
filetime->dwHighDateTime = (unix_time & 0xFFFF0000) >> 16;
}
/*********************************************************************** /***********************************************************************
* GetFileType (KERNEL32.222) * GetFileType (KERNEL32.222)
* *
...@@ -95,7 +217,7 @@ HANDLE32 GetStdHandle(DWORD nStdHandle) ...@@ -95,7 +217,7 @@ HANDLE32 GetStdHandle(DWORD nStdHandle)
default: default:
rc = INVALID_HANDLE_VALUE; rc = INVALID_HANDLE_VALUE;
SetLastError(ERROR_UNKNOWN); SetLastError(ERROR_INVALID_HANDLE);
break; break;
} }
...@@ -115,12 +237,12 @@ DWORD SetFilePointer(FILE_OBJECT *hFile, LONG distance, LONG *highword, ...@@ -115,12 +237,12 @@ DWORD SetFilePointer(FILE_OBJECT *hFile, LONG distance, LONG *highword,
if(ValidateKernelObject((HANDLE32)hFile) != 0) if(ValidateKernelObject((HANDLE32)hFile) != 0)
{ {
SetLastError(ERROR_UNKNOWN); SetLastError(ERROR_INVALID_HANDLE);
return ((DWORD)0xFFFFFFFF); return ((DWORD)0xFFFFFFFF);
} }
if(hFile->common.magic != KERNEL_OBJECT_FILE) if(hFile->common.magic != KERNEL_OBJECT_FILE)
{ {
SetLastError(ERROR_UNKNOWN); SetLastError(ERROR_INVALID_HANDLE);
return ((DWORD)0xFFFFFFFF); return ((DWORD)0xFFFFFFFF);
} }
...@@ -149,12 +271,12 @@ BOOL WriteFile(FILE_OBJECT *hFile, LPVOID lpBuffer, DWORD numberOfBytesToWrite, ...@@ -149,12 +271,12 @@ BOOL WriteFile(FILE_OBJECT *hFile, LPVOID lpBuffer, DWORD numberOfBytesToWrite,
if(ValidateKernelObject((HANDLE32)hFile) != 0) if(ValidateKernelObject((HANDLE32)hFile) != 0)
{ {
SetLastError(ERROR_UNKNOWN); SetLastError(ERROR_INVALID_HANDLE);
return 0; return 0;
} }
if(hFile->common.magic != KERNEL_OBJECT_FILE) if(hFile->common.magic != KERNEL_OBJECT_FILE)
{ {
SetLastError(ERROR_UNKNOWN); SetLastError(ERROR_INVALID_HANDLE);
return 0; return 0;
} }
...@@ -175,12 +297,12 @@ BOOL ReadFile(FILE_OBJECT *hFile, LPVOID lpBuffer, DWORD numtoread, ...@@ -175,12 +297,12 @@ BOOL ReadFile(FILE_OBJECT *hFile, LPVOID lpBuffer, DWORD numtoread,
if(ValidateKernelObject((HANDLE32)hFile) != 0) if(ValidateKernelObject((HANDLE32)hFile) != 0)
{ {
SetLastError(ERROR_UNKNOWN); SetLastError(ERROR_INVALID_HANDLE);
return 0; return 0;
} }
if(hFile->common.magic != KERNEL_OBJECT_FILE) if(hFile->common.magic != KERNEL_OBJECT_FILE)
{ {
SetLastError(ERROR_UNKNOWN); SetLastError(ERROR_INVALID_HANDLE);
return 0; return 0;
} }
...@@ -199,11 +321,12 @@ BOOL ReadFile(FILE_OBJECT *hFile, LPVOID lpBuffer, DWORD numtoread, ...@@ -199,11 +321,12 @@ BOOL ReadFile(FILE_OBJECT *hFile, LPVOID lpBuffer, DWORD numtoread,
/************************************************************************* /*************************************************************************
* CreateFile (KERNEL32.45) * CreateFile (KERNEL32.45)
* *
* Doesn't support character devices or pipes yet. * Doesn't support character devices, pipes, template files, or a
* lot of the 'attributes' flags yet.
*/ */
HANDLE32 CreateFile(LPSTR filename, DWORD access, DWORD sharing, HANDLE32 CreateFileA(LPSTR filename, DWORD access, DWORD sharing,
LPSECURITY_ATTRIBUTES security, DWORD creation, LPSECURITY_ATTRIBUTES security, DWORD creation,
DWORD attributes, HANDLE32 template) DWORD attributes, HANDLE32 template)
{ {
int access_flags, create_flags; int access_flags, create_flags;
int fd; int fd;
...@@ -216,7 +339,7 @@ HANDLE32 CreateFile(LPSTR filename, DWORD access, DWORD sharing, ...@@ -216,7 +339,7 @@ HANDLE32 CreateFile(LPSTR filename, DWORD access, DWORD sharing,
create_flags = TranslateCreationFlags(creation); create_flags = TranslateCreationFlags(creation);
if(template) if(template)
printf("CreateFile: template handles not supported.\n"); dprintf_win32(stddeb, "CreateFile: template handles not supported.\n");
/* If the name starts with '\\?' or '\\.', ignore the first 3 chars. /* If the name starts with '\\?' or '\\.', ignore the first 3 chars.
*/ */
...@@ -227,7 +350,7 @@ HANDLE32 CreateFile(LPSTR filename, DWORD access, DWORD sharing, ...@@ -227,7 +350,7 @@ HANDLE32 CreateFile(LPSTR filename, DWORD access, DWORD sharing,
*/ */
if(!strncmp(filename, "\\\\", 2)) if(!strncmp(filename, "\\\\", 2))
{ {
printf("CreateFile: UNC names not supported.\n"); dprintf_win32(stddeb, "CreateFile: UNC names not supported.\n");
SetLastError(ERROR_CALL_NOT_IMPLEMENTED); SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
} }
...@@ -266,7 +389,7 @@ HANDLE32 CreateFile(LPSTR filename, DWORD access, DWORD sharing, ...@@ -266,7 +389,7 @@ HANDLE32 CreateFile(LPSTR filename, DWORD access, DWORD sharing,
file_obj = (FILE_OBJECT *)CreateKernelObject(sizeof(FILE_OBJECT)); file_obj = (FILE_OBJECT *)CreateKernelObject(sizeof(FILE_OBJECT));
if(file_obj == NULL) if(file_obj == NULL)
{ {
SetLastError(ERROR_UNKNOWN); SetLastError(ERROR_INVALID_HANDLE);
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
} }
file_obj->common.magic = KERNEL_OBJECT_FILE; file_obj->common.magic = KERNEL_OBJECT_FILE;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "kernel32.h" #include "kernel32.h"
#include "handle32.h" #include "handle32.h"
#include "stddebug.h" #include "stddebug.h"
#define DEBUG_WIN32
#include "debug.h" #include "debug.h"
/* The global error value /* The global error value
...@@ -48,7 +49,7 @@ BOOL CloseHandle(HANDLE32 handle) ...@@ -48,7 +49,7 @@ BOOL CloseHandle(HANDLE32 handle)
break; break;
default: default:
printf("CloseHandle: type %ld not implemented yet.\n", dprintf_win32(stddeb, "CloseHandle: type %ld not implemented yet.\n",
handle->magic); handle->magic);
break; break;
} }
......
...@@ -17,6 +17,10 @@ ...@@ -17,6 +17,10 @@
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
#ifndef PROT_NONE /* FreeBSD doesn't define PROT_NONE */
#define PROT_NONE 0
#endif
typedef struct { typedef struct {
caddr_t ptr; caddr_t ptr;
long size; long size;
...@@ -72,33 +76,8 @@ LPVOID VirtualAlloc(LPVOID lpvAddress, DWORD cbSize, ...@@ -72,33 +76,8 @@ LPVOID VirtualAlloc(LPVOID lpvAddress, DWORD cbSize,
ptr = lpvAddress; ptr = lpvAddress;
} }
if (fdwAllocationType & MEM_COMMIT) { if (fdwAllocationType & MEM_COMMIT) {
switch(fdwProtect & ~(PAGE_GUARD | PAGE_NOCACHE)) { prot = TranslateProtectionFlags(fdwProtect &
case PAGE_READONLY: ~(PAGE_GUARD | PAGE_NOCACHE));
prot=PROT_READ;
break;
case PAGE_READWRITE:
prot=PROT_READ|PROT_WRITE;
break;
case PAGE_WRITECOPY:
prot=PROT_WRITE;
break;
case PAGE_EXECUTE:
prot=PROT_EXEC;
break;
case PAGE_EXECUTE_READ:
prot=PROT_EXEC|PROT_READ;
break;
case PAGE_EXECUTE_READWRITE:
prot=PROT_EXEC|PROT_READ|PROT_WRITE;
break;
case PAGE_EXECUTE_WRITECOPY:
prot=PROT_EXEC|PROT_WRITE;
break;
case PAGE_NOACCESS:
default:
prot=PROT_NONE;
break;
}
mprotect(ptr, cbSize, prot); mprotect(ptr, cbSize, prot);
} }
return ptr; return ptr;
...@@ -144,3 +123,36 @@ BOOL VirtualFree(LPVOID lpvAddress, DWORD cbSize, DWORD fdwFreeType) ...@@ -144,3 +123,36 @@ BOOL VirtualFree(LPVOID lpvAddress, DWORD cbSize, DWORD fdwFreeType)
return 1; return 1;
} }
int TranslateProtectionFlags(DWORD protection_flags)
{
int prot;
switch(protection_flags) {
case PAGE_READONLY:
prot=PROT_READ;
break;
case PAGE_READWRITE:
prot=PROT_READ|PROT_WRITE;
break;
case PAGE_WRITECOPY:
prot=PROT_WRITE;
break;
case PAGE_EXECUTE:
prot=PROT_EXEC;
break;
case PAGE_EXECUTE_READ:
prot=PROT_EXEC|PROT_READ;
break;
case PAGE_EXECUTE_READWRITE:
prot=PROT_EXEC|PROT_READ|PROT_WRITE;
break;
case PAGE_EXECUTE_WRITECOPY:
prot=PROT_EXEC|PROT_WRITE;
break;
case PAGE_NOACCESS:
default:
prot=PROT_NONE;
break;
}
return prot;
}
...@@ -14,6 +14,6 @@ ...@@ -14,6 +14,6 @@
int ValidateKernelObject(KERNEL_OBJECT *ptr) int ValidateKernelObject(KERNEL_OBJECT *ptr)
{ {
return 0; return (!ptr || (short int)ptr==-1);
} }
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "windows.h" #include "windows.h"
#include "winerror.h" #include "winerror.h"
#include "kernel32.h" #include "kernel32.h"
#include "handle32.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
...@@ -21,3 +22,63 @@ void ExitProcess(DWORD status) ...@@ -21,3 +22,63 @@ void ExitProcess(DWORD status)
exit(status); exit(status);
} }
/***********************************************************************
* CreateMutexA (KERNEL32.52)
*/
WINAPI HANDLE32 CreateMutexA (SECURITY_ATTRIBUTES *sa, BOOL on, const char *a)
{
return 0;
}
/***********************************************************************
* ReleaseMutex (KERNEL32.435)
*/
WINAPI BOOL ReleaseMutex (HANDLE32 h)
{
return 0;
}
/***********************************************************************
* CreateEventA (KERNEL32.43)
*/
WINAPI HANDLE32 CreateEventA (SECURITY_ATTRIBUTES *sa, BOOL au, BOOL on, const char
*name)
{
return 0;
}
/***********************************************************************
* SetEvent (KERNEL32.487)
*/
WINAPI BOOL SetEvent (HANDLE32 h)
{
return 0;
}
/***********************************************************************
* ResetEvent (KERNEL32.439)
*/
WINAPI BOOL ResetEvent (HANDLE32 h)
{
return 0;
}
/***********************************************************************
* WaitForSingleObject (KERNEL32.561)
*/
DWORD WINAPI WaitForSingleObject(HANDLE32 h, DWORD a)
{
return 0;
}
/***********************************************************************
* DuplicateHandle (KERNEL32.78)
*/
BOOL WINAPI DuplicateHandle(HANDLE32 a, HANDLE32 b, HANDLE32 c, HANDLE32 * d, DWORD e, BOOL f, DWORD g)
{
*d = b;
return 1;
}
/***********************************************************************
* GetCurrentProcess (KERNEL32.198)
*/
HANDLE32 WINAPI GetCurrentProcess(void)
{
return 0;
}
...@@ -28,4 +28,11 @@ BOOL GetThreadContext(HANDLE hThread, void *lpContext) ...@@ -28,4 +28,11 @@ BOOL GetThreadContext(HANDLE hThread, void *lpContext)
{ {
return FALSE; return FALSE;
} }
/***********************************************************************
* GetCurrentThread (KERNEL32.200)
*/
HANDLE WINAPI GetCurrentThread(void)
{
return 0;
}
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include "windows.h" #include "windows.h"
#include "winerror.h" #include "winerror.h"
...@@ -14,6 +15,29 @@ ...@@ -14,6 +15,29 @@
#include "debug.h" #include "debug.h"
/*********************************************************************** /***********************************************************************
* GetLocalTime (KERNEL32.228)
*/
VOID GetLocalTime(LPSYSTEMTIME systime)
{
time_t local_time;
struct tm *local_tm;
struct timeval tv;
time(&local_time);
local_tm = localtime(&local_time);
gettimeofday(&tv, NULL);
systime->wYear = local_tm->tm_year + 1900;
systime->wMonth = local_tm->tm_mon + 1;
systime->wDayOfWeek = local_tm->tm_wday;
systime->wDay = local_tm->tm_mday;
systime->wHour = local_tm->tm_hour;
systime->wMinute = local_tm->tm_min;
systime->wSecond = local_tm->tm_sec;
systime->wMilliseconds = (tv.tv_usec / 1000) % 1000;
}
/***********************************************************************
* GetTimeZoneInformation (KERNEL32.302) * GetTimeZoneInformation (KERNEL32.302)
*/ */
DWORD GetTimeZoneInformation(LPTIME_ZONE_INFORMATION tzinfo) DWORD GetTimeZoneInformation(LPTIME_ZONE_INFORMATION tzinfo)
......
...@@ -184,7 +184,7 @@ static HRGN DCE_ClipWindows( HWND hwndStart, HWND hwndEnd, ...@@ -184,7 +184,7 @@ static HRGN DCE_ClipWindows( HWND hwndStart, HWND hwndEnd,
* clipped by the client area of all ancestors, and then optionally * clipped by the client area of all ancestors, and then optionally
* by siblings and children. * by siblings and children.
*/ */
static HRGN DCE_GetVisRgn( HWND hwnd, WORD flags ) HRGN DCE_GetVisRgn( HWND hwnd, WORD flags )
{ {
RECT rect; RECT rect;
HRGN hrgn; HRGN hrgn;
......
...@@ -39,6 +39,8 @@ void DEFWND_SetText( HWND hwnd, LPSTR text ) ...@@ -39,6 +39,8 @@ void DEFWND_SetText( HWND hwnd, LPSTR text )
wndPtr->hText = USER_HEAP_ALLOC( strlen(text) + 1 ); wndPtr->hText = USER_HEAP_ALLOC( strlen(text) + 1 );
textPtr = (LPSTR) USER_HEAP_LIN_ADDR( wndPtr->hText ); textPtr = (LPSTR) USER_HEAP_LIN_ADDR( wndPtr->hText );
strcpy( textPtr, text ); strcpy( textPtr, text );
if (wndPtr->window)
XStoreName( display, wndPtr->window, text );
} }
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "class.h" #include "class.h"
#include "message.h" #include "message.h"
#include "clipboard.h" #include "clipboard.h"
#include "options.h"
#include "winpos.h" #include "winpos.h"
#include "registers.h" #include "registers.h"
#include "stackframe.h" #include "stackframe.h"
...@@ -137,6 +138,7 @@ static void EVENT_key( XKeyEvent *event ); ...@@ -137,6 +138,7 @@ static void EVENT_key( XKeyEvent *event );
static void EVENT_ButtonPress( XButtonEvent *event ); static void EVENT_ButtonPress( XButtonEvent *event );
static void EVENT_ButtonRelease( XButtonEvent *event ); static void EVENT_ButtonRelease( XButtonEvent *event );
static void EVENT_MotionNotify( XMotionEvent *event ); static void EVENT_MotionNotify( XMotionEvent *event );
static void EVENT_FocusIn( HWND hwnd, XFocusChangeEvent *event );
static void EVENT_FocusOut( HWND hwnd, XFocusChangeEvent *event ); static void EVENT_FocusOut( HWND hwnd, XFocusChangeEvent *event );
static void EVENT_Expose( HWND hwnd, XExposeEvent *event ); static void EVENT_Expose( HWND hwnd, XExposeEvent *event );
static void EVENT_ConfigureNotify( HWND hwnd, XConfigureEvent *event ); static void EVENT_ConfigureNotify( HWND hwnd, XConfigureEvent *event );
...@@ -190,6 +192,10 @@ void EVENT_ProcessEvent( XEvent *event ) ...@@ -190,6 +192,10 @@ void EVENT_ProcessEvent( XEvent *event )
EVENT_MotionNotify( (XMotionEvent*)event ); EVENT_MotionNotify( (XMotionEvent*)event );
break; break;
case FocusIn:
EVENT_FocusIn( hwnd, (XFocusChangeEvent*)event );
break;
case FocusOut: case FocusOut:
EVENT_FocusOut( hwnd, (XFocusChangeEvent*)event ); EVENT_FocusOut( hwnd, (XFocusChangeEvent*)event );
break; break;
...@@ -455,6 +461,17 @@ static void EVENT_ButtonRelease( XButtonEvent *event ) ...@@ -455,6 +461,17 @@ static void EVENT_ButtonRelease( XButtonEvent *event )
/********************************************************************** /**********************************************************************
* EVENT_FocusIn
*/
static void EVENT_FocusIn (HWND hwnd, XFocusChangeEvent *event )
{
if (event->detail == NotifyPointer) return;
if (hwnd != GetActiveWindow()) WINPOS_ChangeActiveWindow( hwnd, FALSE );
if ((hwnd != GetFocus()) && ! IsChild( hwnd, GetFocus())) SetFocus( hwnd );
}
/**********************************************************************
* EVENT_FocusOut * EVENT_FocusOut
* *
* Note: only top-level override-redirect windows get FocusOut events. * Note: only top-level override-redirect windows get FocusOut events.
...@@ -470,12 +487,70 @@ static void EVENT_FocusOut( HWND hwnd, XFocusChangeEvent *event ) ...@@ -470,12 +487,70 @@ static void EVENT_FocusOut( HWND hwnd, XFocusChangeEvent *event )
/********************************************************************** /**********************************************************************
* EVENT_ConfigureNotify * EVENT_ConfigureNotify
* *
* The ConfigureNotify event is only selected on the desktop window. * The ConfigureNotify event is only selected on the desktop window
* and on top-level windows when the -managed flag is used.
*/ */
static void EVENT_ConfigureNotify( HWND hwnd, XConfigureEvent *event ) static void EVENT_ConfigureNotify( HWND hwnd, XConfigureEvent *event )
{ {
desktopX = event->x; if (hwnd == GetDesktopWindow())
desktopY = event->y; {
desktopX = event->x;
desktopY = event->y;
}
else
{
/* A managed window; most of this code is shamelessly
* stolen from SetWindowPos
*/
WND *wndPtr;
WINDOWPOS winpos;
RECT newWindowRect, newClientRect;
if (!(wndPtr = WIN_FindWndPtr( hwnd )))
{
dprintf_event(stddeb, "ConfigureNotify: invalid HWND "NPFMT"\n", hwnd);
return;
}
/* Artificial messages */
SendMessage(hwnd, WM_ENTERSIZEMOVE, 0, 0);
SendMessage(hwnd, WM_EXITSIZEMOVE, 0, 0);
/* Fill WINDOWPOS struct */
winpos.flags = SWP_NOACTIVATE | SWP_NOZORDER;
winpos.hwnd = hwnd;
winpos.x = event->x;
winpos.y = event->y;
winpos.cx = event->width;
winpos.cy = event->height;
/* Check for unchanged attributes */
if(winpos.x == wndPtr->rectWindow.left &&
winpos.y == wndPtr->rectWindow.top)
winpos.flags |= SWP_NOMOVE;
if(winpos.cx == wndPtr->rectWindow.right - wndPtr->rectWindow.left &&
winpos.cy == wndPtr->rectWindow.bottom - wndPtr->rectWindow.top)
winpos.flags |= SWP_NOSIZE;
/* Send WM_WINDOWPOSCHANGING */
SendMessage(hwnd, WM_WINDOWPOSCHANGING, 0, MAKE_SEGPTR(&winpos));
/* Calculate new position and size */
newWindowRect.left = event->x;
newWindowRect.right = event->x + event->width;
newWindowRect.top = event->y;
newWindowRect.bottom = event->y + event->height;
WINPOS_SendNCCalcSize( winpos.hwnd, TRUE, &newWindowRect,
&wndPtr->rectWindow, &wndPtr->rectClient,
&winpos, &newClientRect );
/* Set new size and position */
wndPtr->rectWindow = newWindowRect;
wndPtr->rectClient = newClientRect;
SendMessage(hwnd, WM_WINDOWPOSCHANGED, 0, MAKE_SEGPTR(&winpos));
}
} }
......
...@@ -2,16 +2,18 @@ ...@@ -2,16 +2,18 @@
* Focus functions * Focus functions
* *
* Copyright 1993 David Metcalfe * Copyright 1993 David Metcalfe
* Copyright 1994 Alexandre Julliard * 1994 Alexandre Julliard
* 1995 Alex Korobka
* *
static char Copyright[] = "Copyright David Metcalfe, 1993"; */
static char Copyright2[] = "Copyright Alexandre Julliard, 1994";
*/
#include "win.h" #include "win.h"
#include "winpos.h"
#include "hook.h"
#include "color.h" #include "color.h"
static HWND hWndFocus = 0;
static HWND hwndFocus = 0;
/***************************************************************** /*****************************************************************
* FOCUS_SetXFocus * FOCUS_SetXFocus
...@@ -44,53 +46,67 @@ static void FOCUS_SetXFocus( HWND hwnd ) ...@@ -44,53 +46,67 @@ static void FOCUS_SetXFocus( HWND hwnd )
XInstallColormap( display, COLOR_WinColormap ); XInstallColormap( display, COLOR_WinColormap );
} }
/*****************************************************************
* FOCUS_SwitchFocus
*/
void FOCUS_SwitchFocus(HWND hFocusFrom, HWND hFocusTo)
{
hwndFocus = hFocusTo;
if (hFocusFrom) SendMessage( hFocusFrom, WM_KILLFOCUS, hFocusTo, 0L);
if( !hFocusTo || hFocusTo != hwndFocus )
return;
SendMessage( hFocusTo, WM_SETFOCUS, hFocusFrom, 0L);
FOCUS_SetXFocus( hFocusTo );
}
/***************************************************************** /*****************************************************************
* SetFocus (USER.22) * SetFocus (USER.22)
*/ */
HWND SetFocus(HWND hwnd) HWND SetFocus(HWND hwnd)
{ {
HWND hWndPrevFocus, hwndParent; HWND hWndPrevFocus, hwndTop;
WND *wndPtr; WND *wndPtr = WIN_FindWndPtr( hwndTop = hwnd );
if (hwnd == hWndFocus) return hWndFocus; /* Nothing to do! */
if (hwnd) if (wndPtr)
{ {
/* Check if we can set the focus to this window */ /* Check if we can set the focus to this window */
hwndParent = hwnd; while ( (wndPtr->dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD )
while ((wndPtr = WIN_FindWndPtr( hwndParent )) != NULL)
{ {
if ((wndPtr->dwStyle & WS_MINIMIZE) || if ( wndPtr->dwStyle & ( WS_MINIMIZE | WS_DISABLED) )
(wndPtr->dwStyle & WS_DISABLED)) return 0; return 0;
if (!(wndPtr->dwStyle & WS_CHILD)) break;
hwndParent = wndPtr->hwndParent; hwndTop = wndPtr->hwndParent;
wndPtr = WIN_FindWndPtr( hwndTop );
if ( !wndPtr )
return 0;
} }
/* Now hwndParent is the top-level ancestor. Activate it. */ if( hwnd == hwndFocus ) return hwnd;
if (hwndParent != GetActiveWindow()) /* call hooks */
if( HOOK_CallHooks( WH_CBT, HCBT_SETFOCUS, hwnd, hwndFocus) )
return 0;
/* activate hwndTop if needed. */
if (hwndTop != GetActiveWindow())
{ {
SetWindowPos( hwndParent, HWND_TOP, 0, 0, 0, 0, if (!WINPOS_SetActiveWindow(hwndTop, 0, 0)) return 0;
SWP_NOSIZE | SWP_NOMOVE );
if (!IsWindow( hwnd )) return 0; /* Abort if window destroyed */ if (!IsWindow( hwnd )) return 0; /* Abort if window destroyed */
} }
} }
else if( HOOK_CallHooks( WH_CBT, HCBT_SETFOCUS, 0, hwndFocus ) )
return 0;
/* Change focus and send messages */ /* Change focus and send messages */
hWndPrevFocus = hwndFocus;
FOCUS_SwitchFocus( hwndFocus , hwnd );
hWndPrevFocus = hWndFocus;
hWndFocus = hwnd;
if (hWndPrevFocus) SendMessage( hWndPrevFocus, WM_KILLFOCUS,
(WPARAM)hwnd, 0 );
if (hwnd == hWndFocus) /* Maybe already changed during WM_KILLFOCUS */
{
if (hwnd) SendMessage( hWndFocus, WM_SETFOCUS,
(WPARAM)hWndPrevFocus, 0 );
FOCUS_SetXFocus( hwnd );
}
return hWndPrevFocus; return hWndPrevFocus;
} }
...@@ -98,10 +114,9 @@ HWND SetFocus(HWND hwnd) ...@@ -98,10 +114,9 @@ HWND SetFocus(HWND hwnd)
/***************************************************************** /*****************************************************************
* GetFocus (USER.23) * GetFocus (USER.23)
*/ */
HWND GetFocus(void) HWND GetFocus(void)
{ {
return hWndFocus; return hwndFocus;
} }
...@@ -23,15 +23,6 @@ ...@@ -23,15 +23,6 @@
#include "debug.h" #include "debug.h"
#include "xmalloc.h" #include "xmalloc.h"
static __inline__ void swap_int(int *a, int *b)
{
int c;
c = *a;
*a = *b;
*b = c;
}
/*********************************************************************** /***********************************************************************
* LineTo (GDI.19) * LineTo (GDI.19)
*/ */
...@@ -108,7 +99,7 @@ BOOL MoveToEx( HDC hdc, short x, short y, LPPOINT pt ) ...@@ -108,7 +99,7 @@ BOOL MoveToEx( HDC hdc, short x, short y, LPPOINT pt )
static BOOL GRAPH_DrawArc( HDC hdc, int left, int top, int right, int bottom, static BOOL GRAPH_DrawArc( HDC hdc, int left, int top, int right, int bottom,
int xstart, int ystart, int xend, int yend, int lines ) int xstart, int ystart, int xend, int yend, int lines )
{ {
int xcenter, ycenter, istart_angle, idiff_angle; int xcenter, ycenter, istart_angle, idiff_angle, tmp;
double start_angle, end_angle; double start_angle, end_angle;
XPoint points[3]; XPoint points[3];
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
...@@ -155,8 +146,8 @@ static BOOL GRAPH_DrawArc( HDC hdc, int left, int top, int right, int bottom, ...@@ -155,8 +146,8 @@ static BOOL GRAPH_DrawArc( HDC hdc, int left, int top, int right, int bottom,
istart_angle = (int)(start_angle * 180 * 64 / PI); istart_angle = (int)(start_angle * 180 * 64 / PI);
idiff_angle = (int)((end_angle - start_angle) * 180 * 64 / PI ); idiff_angle = (int)((end_angle - start_angle) * 180 * 64 / PI );
if (idiff_angle <= 0) idiff_angle += 360 * 64; if (idiff_angle <= 0) idiff_angle += 360 * 64;
if (left > right) swap_int( &left, &right ); if (left > right) { tmp=left; left=right; right=tmp; }
if (top > bottom) swap_int( &top, &bottom ); if (top > bottom) { tmp=top; top=bottom; bottom=tmp; }
/* Fill arc with brush if Chord() or Pie() */ /* Fill arc with brush if Chord() or Pie() */
...@@ -195,8 +186,8 @@ static BOOL GRAPH_DrawArc( HDC hdc, int left, int top, int right, int bottom, ...@@ -195,8 +186,8 @@ static BOOL GRAPH_DrawArc( HDC hdc, int left, int top, int right, int bottom,
/*********************************************************************** /***********************************************************************
* Arc (GDI.23) * Arc (GDI.23)
*/ */
BOOL Arc( HDC hdc, int left, int top, int right, int bottom, BOOL Arc( HDC hdc, INT left, INT top, INT right, INT bottom,
int xstart, int ystart, int xend, int yend ) INT xstart, INT ystart, INT xend, INT yend )
{ {
return GRAPH_DrawArc( hdc, left, top, right, bottom, return GRAPH_DrawArc( hdc, left, top, right, bottom,
xstart, ystart, xend, yend, 0 ); xstart, ystart, xend, yend, 0 );
...@@ -206,8 +197,8 @@ BOOL Arc( HDC hdc, int left, int top, int right, int bottom, ...@@ -206,8 +197,8 @@ BOOL Arc( HDC hdc, int left, int top, int right, int bottom,
/*********************************************************************** /***********************************************************************
* Pie (GDI.26) * Pie (GDI.26)
*/ */
BOOL Pie( HDC hdc, int left, int top, int right, int bottom, BOOL Pie( HDC hdc, INT left, INT top, INT right, INT bottom,
int xstart, int ystart, int xend, int yend ) INT xstart, INT ystart, INT xend, INT yend )
{ {
return GRAPH_DrawArc( hdc, left, top, right, bottom, return GRAPH_DrawArc( hdc, left, top, right, bottom,
xstart, ystart, xend, yend, 2 ); xstart, ystart, xend, yend, 2 );
...@@ -217,8 +208,8 @@ BOOL Pie( HDC hdc, int left, int top, int right, int bottom, ...@@ -217,8 +208,8 @@ BOOL Pie( HDC hdc, int left, int top, int right, int bottom,
/*********************************************************************** /***********************************************************************
* Chord (GDI.348) * Chord (GDI.348)
*/ */
BOOL Chord( HDC hdc, int left, int top, int right, int bottom, BOOL Chord( HDC hdc, INT left, INT top, INT right, INT bottom,
int xstart, int ystart, int xend, int yend ) INT xstart, INT ystart, INT xend, INT yend )
{ {
return GRAPH_DrawArc( hdc, left, top, right, bottom, return GRAPH_DrawArc( hdc, left, top, right, bottom,
xstart, ystart, xend, yend, 1 ); xstart, ystart, xend, yend, 1 );
...@@ -228,7 +219,7 @@ BOOL Chord( HDC hdc, int left, int top, int right, int bottom, ...@@ -228,7 +219,7 @@ BOOL Chord( HDC hdc, int left, int top, int right, int bottom,
/*********************************************************************** /***********************************************************************
* Ellipse (GDI.24) * Ellipse (GDI.24)
*/ */
BOOL Ellipse( HDC hdc, int left, int top, int right, int bottom ) BOOL Ellipse( HDC hdc, INT left, INT top, INT right, INT bottom )
{ {
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) if (!dc)
...@@ -245,11 +236,8 @@ BOOL Ellipse( HDC hdc, int left, int top, int right, int bottom ) ...@@ -245,11 +236,8 @@ BOOL Ellipse( HDC hdc, int left, int top, int right, int bottom )
bottom = YLPTODP( dc, bottom ); bottom = YLPTODP( dc, bottom );
if ((left == right) || (top == bottom)) return FALSE; if ((left == right) || (top == bottom)) return FALSE;
if (right < left) if (right < left) { INT tmp = right; right = left; left = tmp; }
swap_int(&right, &left); if (bottom < top) { INT tmp = bottom; bottom = top; top = tmp; }
if (bottom < top)
swap_int(&bottom, &top);
if ((dc->u.x.pen.style == PS_INSIDEFRAME) && if ((dc->u.x.pen.style == PS_INSIDEFRAME) &&
(dc->u.x.pen.width < right-left-1) && (dc->u.x.pen.width < right-left-1) &&
...@@ -276,7 +264,7 @@ BOOL Ellipse( HDC hdc, int left, int top, int right, int bottom ) ...@@ -276,7 +264,7 @@ BOOL Ellipse( HDC hdc, int left, int top, int right, int bottom )
/*********************************************************************** /***********************************************************************
* Rectangle (GDI.27) * Rectangle (GDI.27)
*/ */
BOOL Rectangle( HDC hdc, int left, int top, int right, int bottom ) BOOL Rectangle( HDC hdc, INT left, INT top, INT right, INT bottom )
{ {
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) if (!dc)
...@@ -291,11 +279,8 @@ BOOL Rectangle( HDC hdc, int left, int top, int right, int bottom ) ...@@ -291,11 +279,8 @@ BOOL Rectangle( HDC hdc, int left, int top, int right, int bottom )
right = XLPTODP( dc, right ); right = XLPTODP( dc, right );
bottom = YLPTODP( dc, bottom ); bottom = YLPTODP( dc, bottom );
if (right < left) if (right < left) { INT tmp = right; right = left; left = tmp; }
swap_int(&right, &left); if (bottom < top) { INT tmp = bottom; bottom = top; top = tmp; }
if (bottom < top)
swap_int(&bottom, &top);
if ((left == right) || (top == bottom)) if ((left == right) || (top == bottom))
{ {
...@@ -333,8 +318,8 @@ BOOL Rectangle( HDC hdc, int left, int top, int right, int bottom ) ...@@ -333,8 +318,8 @@ BOOL Rectangle( HDC hdc, int left, int top, int right, int bottom )
/*********************************************************************** /***********************************************************************
* RoundRect (GDI.28) * RoundRect (GDI.28)
*/ */
BOOL RoundRect( HDC hDC, short left, short top, short right, short bottom, BOOL RoundRect( HDC hDC, INT left, INT top, INT right, INT bottom,
short ell_width, short ell_height ) INT ell_width, INT ell_height )
{ {
DC * dc = (DC *) GDI_GetObjPtr(hDC, DC_MAGIC); DC * dc = (DC *) GDI_GetObjPtr(hDC, DC_MAGIC);
if (!dc) if (!dc)
...@@ -357,8 +342,8 @@ BOOL RoundRect( HDC hDC, short left, short top, short right, short bottom, ...@@ -357,8 +342,8 @@ BOOL RoundRect( HDC hDC, short left, short top, short right, short bottom,
/* Fix the coordinates */ /* Fix the coordinates */
if (left > right) { short t = left; left = right; right = t; } if (right < left) { INT tmp = right; right = left; left = tmp; }
if (top > bottom) { short t = top; top = bottom; bottom = t; } if (bottom < top) { INT tmp = bottom; bottom = top; top = tmp; }
if (ell_width > right - left) ell_width = right - left; if (ell_width > right - left) ell_width = right - left;
if (ell_height > bottom - top) ell_height = bottom - top; if (ell_height > bottom - top) ell_height = bottom - top;
......
...@@ -17,16 +17,16 @@ extern BYTE AsyncKeyStateTable[256]; ...@@ -17,16 +17,16 @@ extern BYTE AsyncKeyStateTable[256];
*/ */
int GetKeyState(int keycode) int GetKeyState(int keycode)
{ {
switch(keycode) { switch(keycode) {
case VK_LBUTTON: case VK_LBUTTON:
return MouseButtonsStates[0]; return MouseButtonsStates[0];
case VK_MBUTTON: case VK_MBUTTON:
return MouseButtonsStates[1]; return MouseButtonsStates[1];
case VK_RBUTTON: case VK_RBUTTON:
return MouseButtonsStates[2]; return MouseButtonsStates[2];
default: default:
return KeyStateTable[keycode]; return KeyStateTable[keycode];
} }
} }
/********************************************************************** /**********************************************************************
...@@ -47,13 +47,14 @@ void GetKeyboardState(BYTE FAR *lpKeyState) ...@@ -47,13 +47,14 @@ void GetKeyboardState(BYTE FAR *lpKeyState)
*/ */
void SetKeyboardState(BYTE FAR *lpKeyState) void SetKeyboardState(BYTE FAR *lpKeyState)
{ {
if (lpKeyState != NULL) { if (lpKeyState != NULL) {
memcpy(KeyStateTable, lpKeyState, 256); memcpy(KeyStateTable, lpKeyState, 256);
MouseButtonsStates[0] = KeyStateTable[VK_LBUTTON]; MouseButtonsStates[0] = KeyStateTable[VK_LBUTTON];
MouseButtonsStates[1] = KeyStateTable[VK_MBUTTON]; MouseButtonsStates[1] = KeyStateTable[VK_MBUTTON];
MouseButtonsStates[2] = KeyStateTable[VK_RBUTTON]; MouseButtonsStates[2] = KeyStateTable[VK_RBUTTON];
} }
} }
/********************************************************************** /**********************************************************************
* GetAsyncKeyState (USER.249) * GetAsyncKeyState (USER.249)
* *
...@@ -69,31 +70,30 @@ void SetKeyboardState(BYTE FAR *lpKeyState) ...@@ -69,31 +70,30 @@ void SetKeyboardState(BYTE FAR *lpKeyState)
*/ */
int GetAsyncKeyState(int nKey) int GetAsyncKeyState(int nKey)
{ {
short retval; short retval;
switch (nKey) {
case VK_LBUTTON: switch (nKey) {
retval = AsyncMouseButtonsStates[0] | case VK_LBUTTON:
(MouseButtonsStates[0] << 8); retval = AsyncMouseButtonsStates[0] |
break; (MouseButtonsStates[0] << 8);
case VK_MBUTTON: break;
retval = AsyncMouseButtonsStates[1] | case VK_MBUTTON:
(MouseButtonsStates[1] << 8); retval = AsyncMouseButtonsStates[1] |
break; (MouseButtonsStates[1] << 8);
case VK_RBUTTON: break;
retval = AsyncMouseButtonsStates[2] | case VK_RBUTTON:
(MouseButtonsStates[2] << 8); retval = AsyncMouseButtonsStates[2] |
break; (MouseButtonsStates[2] << 8);
default: break;
retval = AsyncKeyStateTable[nKey] | default:
(KeyStateTable[nKey] << 8); retval = AsyncKeyStateTable[nKey] |
break; (KeyStateTable[nKey] << 8);
} break;
}
bzero(AsyncMouseButtonsStates, 3); /* all states to false */ bzero(AsyncMouseButtonsStates, 3); /* all states to false */
bzero(AsyncKeyStateTable, 256); bzero(AsyncKeyStateTable, 256);
return retval; return retval;
} }
...@@ -23,20 +23,22 @@ ...@@ -23,20 +23,22 @@
/* #define DEBUG_MSG */ /* #define DEBUG_MSG */
#include "debug.h" #include "debug.h"
#define HWND_BROADCAST ((HWND)0xffff) #define HWND_BROADCAST ((HWND)0xffff)
#define MAX_QUEUE_SIZE 120 /* Max. size of a message queue */ #define MAX_QUEUE_SIZE 120 /* Max. size of a message queue */
extern BOOL TIMER_CheckTimer( LONG *next, MSG *msg, extern BOOL TIMER_CheckTimer( LONG *next, MSG *msg,
HWND hwnd, BOOL remove ); /* timer.c */ HWND hwnd, BOOL remove ); /* timer.c */
/* System message queue (for hardware events) */ /* ------- Internal Queues ------ */
static HANDLE hmemSysMsgQueue = 0; static HANDLE hmemSysMsgQueue = 0;
static MESSAGEQUEUE * sysMsgQueue = NULL; static MESSAGEQUEUE *sysMsgQueue = NULL;
/* Double-click time */ HANDLE hActiveQ_G = 0;
static HANDLE hFirstQueue = 0;
/* ------- Miscellaneous ------ */
static int doubleClickSpeed = 452; static int doubleClickSpeed = 452;
...@@ -62,6 +64,43 @@ static HANDLE MSG_CreateMsgQueue( int size ) ...@@ -62,6 +64,43 @@ static HANDLE MSG_CreateMsgQueue( int size )
return hQueue; return hQueue;
} }
/***********************************************************************
* MSG_DeleteMsgQueue
*/
BOOL MSG_DeleteMsgQueue( HANDLE hQueue )
{
MESSAGEQUEUE * msgQueue = (MESSAGEQUEUE*)GlobalLock(hQueue);
if( !hQueue )
{
dprintf_msg(stddeb,"DeleteMsgQueue: invalid argument.\n");
return 0;
}
if( !msgQueue ) return 0;
if( hQueue == hFirstQueue )
hFirstQueue = msgQueue->next;
else if( hFirstQueue )
{
MESSAGEQUEUE *msgQ = (MESSAGEQUEUE*)GlobalLock(hFirstQueue);
/* walk up queue list and relink if needed */
while( msgQ->next )
{
if( msgQ->next == hQueue )
msgQ->next = msgQueue->next;
/* should check for intertask sendmessages here */
msgQ = (MESSAGEQUEUE*)GlobalLock(msgQ->next);
}
}
GlobalFree( hQueue );
return 1;
}
/*********************************************************************** /***********************************************************************
* MSG_CreateSysMsgQueue * MSG_CreateSysMsgQueue
...@@ -169,6 +208,15 @@ static void MSG_RemoveMsg( MESSAGEQUEUE * msgQueue, int pos ) ...@@ -169,6 +208,15 @@ static void MSG_RemoveMsg( MESSAGEQUEUE * msgQueue, int pos )
msgQueue->tempStatus = 0; msgQueue->tempStatus = 0;
} }
/***********************************************************************
* MSG_GetQueueTask
*/
HTASK MSG_GetQueueTask( HANDLE hQueue )
{
MESSAGEQUEUE *msgQ = GlobalLock( hQueue );
return (msgQ) ? msgQ->hTask : 0 ;
}
/*********************************************************************** /***********************************************************************
* MSG_GetWindowForEvent * MSG_GetWindowForEvent
...@@ -624,7 +672,9 @@ BOOL MSG_GetHardwareMessage( LPMSG msg ) ...@@ -624,7 +672,9 @@ BOOL MSG_GetHardwareMessage( LPMSG msg )
*/ */
BOOL SetMessageQueue( int size ) BOOL SetMessageQueue( int size )
{ {
HGLOBAL hQueue; HGLOBAL hQueue = 0;
HGLOBAL hNextQueue= hFirstQueue;
MESSAGEQUEUE *queuePrev = NULL;
MESSAGEQUEUE *queuePtr; MESSAGEQUEUE *queuePtr;
if ((size > MAX_QUEUE_SIZE) || (size <= 0)) return TRUE; if ((size > MAX_QUEUE_SIZE) || (size <= 0)) return TRUE;
...@@ -632,13 +682,47 @@ BOOL SetMessageQueue( int size ) ...@@ -632,13 +682,47 @@ BOOL SetMessageQueue( int size )
/* Free the old message queue */ /* Free the old message queue */
if ((hQueue = GetTaskQueue(0)) != 0) if ((hQueue = GetTaskQueue(0)) != 0)
{ {
GlobalUnlock( hQueue ); MESSAGEQUEUE *queuePtr = (MESSAGEQUEUE *)GlobalLock( hQueue );
GlobalFree( hQueue );
if( queuePtr )
{
MESSAGEQUEUE *msgQ = (MESSAGEQUEUE*)GlobalLock(hFirstQueue);
hNextQueue = queuePtr->next;
if( msgQ )
if( hQueue != hFirstQueue )
while( msgQ->next )
{
if( msgQ->next == hQueue )
{
queuePrev = msgQ;
break;
}
msgQ = (MESSAGEQUEUE*)GlobalLock(msgQ->next);
}
GlobalUnlock( hQueue );
MSG_DeleteMsgQueue( hQueue );
}
}
if( !(hQueue = MSG_CreateMsgQueue( size )))
{
if(queuePrev)
/* it did have a queue */
queuePrev->next = hNextQueue;
return FALSE;
} }
if (!(hQueue = MSG_CreateMsgQueue( size ))) return FALSE;
queuePtr = (MESSAGEQUEUE *)GlobalLock( hQueue ); queuePtr = (MESSAGEQUEUE *)GlobalLock( hQueue );
queuePtr->hTask = GetCurrentTask(); queuePtr->hTask = GetCurrentTask();
queuePtr->next = hNextQueue;
if( !queuePrev )
hFirstQueue = hQueue;
else
queuePrev->next = hQueue;
SetTaskQueue( 0, hQueue ); SetTaskQueue( 0, hQueue );
return TRUE; return TRUE;
} }
......
...@@ -19,9 +19,11 @@ ...@@ -19,9 +19,11 @@
#include "nonclient.h" #include "nonclient.h"
#include "graphics.h" #include "graphics.h"
#include "selectors.h" #include "selectors.h"
#include "stackframe.h"
#include "stddebug.h" #include "stddebug.h"
/* #define DEBUG_NONCLIENT */ /* #define DEBUG_NONCLIENT */
#include "debug.h" #include "debug.h"
#include "options.h"
static HBITMAP hbitmapClose = 0; static HBITMAP hbitmapClose = 0;
...@@ -35,12 +37,17 @@ static HBITMAP hbitmapRestoreD = 0; ...@@ -35,12 +37,17 @@ static HBITMAP hbitmapRestoreD = 0;
#define SC_ABOUTWINE (SC_SCREENSAVE+1) #define SC_ABOUTWINE (SC_SCREENSAVE+1)
/* Some useful macros */ /* Some useful macros */
#define IS_MANAGED(style) \
(Options.managed && !((style) & WS_CHILD))
#define HAS_DLGFRAME(style,exStyle) \ #define HAS_DLGFRAME(style,exStyle) \
(((exStyle) & WS_EX_DLGMODALFRAME) || \ (!(IS_MANAGED(style)) && \
(((style) & WS_DLGFRAME) && !((style) & WS_BORDER))) (((exStyle) & WS_EX_DLGMODALFRAME) || \
(((style) & WS_DLGFRAME) && !((style) & WS_BORDER))))
#define HAS_THICKFRAME(style) \ #define HAS_THICKFRAME(style) \
(((style) & WS_THICKFRAME) && \ (!(IS_MANAGED(style)) && \
((style) & WS_THICKFRAME) && \
!(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME)) !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
#define HAS_MENU(w) (!((w)->dwStyle & WS_CHILD) && ((w)->wIDmenu != 0)) #define HAS_MENU(w) (!((w)->dwStyle & WS_CHILD) && ((w)->wIDmenu != 0))
...@@ -63,6 +70,7 @@ static HBITMAP hbitmapRestoreD = 0; ...@@ -63,6 +70,7 @@ static HBITMAP hbitmapRestoreD = 0;
static void NC_AdjustRect( LPRECT rect, DWORD style, BOOL menu, DWORD exStyle ) static void NC_AdjustRect( LPRECT rect, DWORD style, BOOL menu, DWORD exStyle )
{ {
if (style & WS_ICONIC) return; /* Nothing to change for an icon */ if (style & WS_ICONIC) return; /* Nothing to change for an icon */
if (IS_MANAGED(style)) return;
if (HAS_DLGFRAME( style, exStyle )) if (HAS_DLGFRAME( style, exStyle ))
InflateRect( rect, SYSMETRICS_CXDLGFRAME, SYSMETRICS_CYDLGFRAME ); InflateRect( rect, SYSMETRICS_CXDLGFRAME, SYSMETRICS_CYDLGFRAME );
else else
...@@ -118,8 +126,7 @@ void AdjustWindowRectEx( LPRECT rect, DWORD style, BOOL menu, DWORD exStyle ) ...@@ -118,8 +126,7 @@ void AdjustWindowRectEx( LPRECT rect, DWORD style, BOOL menu, DWORD exStyle )
void NC_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, void NC_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos,
POINT *minTrack, POINT *maxTrack ) POINT *minTrack, POINT *maxTrack )
{ {
HANDLE minmaxHandle; MINMAXINFO MinMax;
MINMAXINFO MinMax, *pMinMax;
short xinc, yinc; short xinc, yinc;
WND *wndPtr = WIN_FindWndPtr( hwnd ); WND *wndPtr = WIN_FindWndPtr( hwnd );
...@@ -132,7 +139,9 @@ void NC_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, ...@@ -132,7 +139,9 @@ void NC_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos,
MinMax.ptMaxTrackSize.x = SYSMETRICS_CXSCREEN; MinMax.ptMaxTrackSize.x = SYSMETRICS_CXSCREEN;
MinMax.ptMaxTrackSize.y = SYSMETRICS_CYSCREEN; MinMax.ptMaxTrackSize.y = SYSMETRICS_CYSCREEN;
if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) if (IS_MANAGED(wndPtr->dwStyle))
xinc = yinc = 0;
else if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
{ {
xinc = SYSMETRICS_CXDLGFRAME; xinc = SYSMETRICS_CXDLGFRAME;
yinc = SYSMETRICS_CYDLGFRAME; yinc = SYSMETRICS_CYDLGFRAME;
...@@ -165,28 +174,25 @@ void NC_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, ...@@ -165,28 +174,25 @@ void NC_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos,
MinMax.ptMaxPosition.y = -yinc; MinMax.ptMaxPosition.y = -yinc;
} }
minmaxHandle = USER_HEAP_ALLOC( sizeof(MINMAXINFO) ); SendMessage( hwnd, WM_GETMINMAXINFO, 0, MAKE_SEGPTR(&MinMax) );
if (minmaxHandle)
{
pMinMax = (MINMAXINFO *) USER_HEAP_LIN_ADDR( minmaxHandle );
memcpy( pMinMax, &MinMax, sizeof(MinMax) );
SendMessage( hwnd, WM_GETMINMAXINFO, 0,
(LPARAM)USER_HEAP_SEG_ADDR(minmaxHandle) );
}
else pMinMax = &MinMax;
/* Some sanity checks */ /* Some sanity checks */
pMinMax->ptMaxTrackSize.x = MAX( pMinMax->ptMaxTrackSize.x, dprintf_nonclient(stddeb,
pMinMax->ptMinTrackSize.x ); "NC_GetMinMaxInfo: %d %d / %d %d / %d %d / %d %d\n",
pMinMax->ptMaxTrackSize.y = MAX( pMinMax->ptMaxTrackSize.y, MinMax.ptMaxSize.x,MinMax.ptMaxSize.y,
pMinMax->ptMinTrackSize.y ); MinMax.ptMaxPosition.x,MinMax.ptMaxPosition.y,
MinMax.ptMaxTrackSize.x,MinMax.ptMaxTrackSize.y,
MinMax.ptMinTrackSize.x,MinMax.ptMinTrackSize.y);
MinMax.ptMaxTrackSize.x = MAX( MinMax.ptMaxTrackSize.x,
MinMax.ptMinTrackSize.x );
MinMax.ptMaxTrackSize.y = MAX( MinMax.ptMaxTrackSize.y,
MinMax.ptMinTrackSize.y );
if (maxSize) *maxSize = pMinMax->ptMaxSize; if (maxSize) *maxSize = MinMax.ptMaxSize;
if (maxPos) *maxPos = pMinMax->ptMaxPosition; if (maxPos) *maxPos = MinMax.ptMaxPosition;
if (minTrack) *minTrack = pMinMax->ptMinTrackSize; if (minTrack) *minTrack = MinMax.ptMinTrackSize;
if (maxTrack) *maxTrack = pMinMax->ptMaxTrackSize; if (maxTrack) *maxTrack = MinMax.ptMaxTrackSize;
if (minmaxHandle) USER_HEAP_FREE( minmaxHandle );
} }
...@@ -233,6 +239,7 @@ void NC_GetInsideRect( HWND hwnd, RECT *rect ) ...@@ -233,6 +239,7 @@ void NC_GetInsideRect( HWND hwnd, RECT *rect )
rect->bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top; rect->bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
if (wndPtr->dwStyle & WS_ICONIC) return; /* No border to remove */ if (wndPtr->dwStyle & WS_ICONIC) return; /* No border to remove */
if (IS_MANAGED(wndPtr->dwStyle)) return;
/* Remove frame from rectangle */ /* Remove frame from rectangle */
if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
...@@ -319,14 +326,16 @@ LONG NC_HandleNCHitTest( HWND hwnd, POINT pt ) ...@@ -319,14 +326,16 @@ LONG NC_HandleNCHitTest( HWND hwnd, POINT pt )
{ {
if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
InflateRect(&rect, -SYSMETRICS_CXDLGFRAME, -SYSMETRICS_CYDLGFRAME); InflateRect(&rect, -SYSMETRICS_CXDLGFRAME, -SYSMETRICS_CYDLGFRAME);
else if (wndPtr->dwStyle & WS_BORDER) else if (!(IS_MANAGED(wndPtr->dwStyle)) &&
(wndPtr->dwStyle & WS_BORDER))
InflateRect(&rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER); InflateRect(&rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER);
if (!PtInRect( &rect, pt )) return HTBORDER; if (!PtInRect( &rect, pt )) return HTBORDER;
} }
/* Check caption */ /* Check caption */
if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION) if (!(IS_MANAGED(wndPtr->dwStyle)) &&
((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION))
{ {
rect.top += SYSMETRICS_CYCAPTION - 1; rect.top += SYSMETRICS_CYCAPTION - 1;
if (!PtInRect( &rect, pt )) if (!PtInRect( &rect, pt ))
...@@ -663,8 +672,9 @@ void NC_DoNCPaint( HWND hwnd, BOOL active, BOOL suppress_menupaint ) ...@@ -663,8 +672,9 @@ void NC_DoNCPaint( HWND hwnd, BOOL active, BOOL suppress_menupaint )
SelectObject( hdc, sysColorObjects.hpenWindowFrame ); SelectObject( hdc, sysColorObjects.hpenWindowFrame );
if ((wndPtr->dwStyle & WS_BORDER) || (wndPtr->dwStyle & WS_DLGFRAME) || if (((wndPtr->dwStyle & WS_BORDER) || (wndPtr->dwStyle & WS_DLGFRAME) ||
(wndPtr->dwExStyle & WS_EX_DLGMODALFRAME)) (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME)) &&
!(IS_MANAGED(wndPtr->dwStyle)))
{ {
MoveTo( hdc, 0, 0 ); MoveTo( hdc, 0, 0 );
LineTo( hdc, rect.right-1, 0 ); LineTo( hdc, rect.right-1, 0 );
...@@ -676,10 +686,12 @@ void NC_DoNCPaint( HWND hwnd, BOOL active, BOOL suppress_menupaint ) ...@@ -676,10 +686,12 @@ void NC_DoNCPaint( HWND hwnd, BOOL active, BOOL suppress_menupaint )
if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
NC_DrawFrame( hdc, &rect, TRUE, active ); NC_DrawFrame( hdc, &rect, TRUE, active );
else if (wndPtr->dwStyle & WS_THICKFRAME) else if ((wndPtr->dwStyle & WS_THICKFRAME) &&
!(IS_MANAGED(wndPtr->dwStyle)))
NC_DrawFrame(hdc, &rect, FALSE, active ); NC_DrawFrame(hdc, &rect, FALSE, active );
if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION) if (((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION) &&
!(IS_MANAGED(wndPtr->dwStyle)))
{ {
RECT r = rect; RECT r = rect;
r.bottom = rect.top + SYSMETRICS_CYSIZE; r.bottom = rect.top + SYSMETRICS_CYSIZE;
...@@ -721,7 +733,9 @@ void NC_DoNCPaint( HWND hwnd, BOOL active, BOOL suppress_menupaint ) ...@@ -721,7 +733,9 @@ void NC_DoNCPaint( HWND hwnd, BOOL active, BOOL suppress_menupaint )
*/ */
LONG NC_HandleNCPaint( HWND hwnd ) LONG NC_HandleNCPaint( HWND hwnd )
{ {
NC_DoNCPaint( hwnd, hwnd == GetActiveWindow(), FALSE ); WND *wndPtr = WIN_FindWndPtr(hwnd);
NC_DoNCPaint( hwnd, wndPtr->flags & WIN_NCACTIVATED, FALSE );
return 0; return 0;
} }
...@@ -733,6 +747,11 @@ LONG NC_HandleNCPaint( HWND hwnd ) ...@@ -733,6 +747,11 @@ LONG NC_HandleNCPaint( HWND hwnd )
*/ */
LONG NC_HandleNCActivate( HWND hwnd, WPARAM wParam ) LONG NC_HandleNCActivate( HWND hwnd, WPARAM wParam )
{ {
WND *wndPtr = WIN_FindWndPtr(hwnd);
if (wParam != 0) wndPtr->flags |= WIN_NCACTIVATED;
else wndPtr->flags &= ~WIN_NCACTIVATED;
NC_DoNCPaint( hwnd, (wParam != 0), FALSE ); NC_DoNCPaint( hwnd, (wParam != 0), FALSE );
return TRUE; return TRUE;
} }
...@@ -1026,6 +1045,7 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam, POINT pt ) ...@@ -1026,6 +1045,7 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam, POINT pt )
if (rootWindow == DefaultRootWindow(display)) XUngrabServer( display ); if (rootWindow == DefaultRootWindow(display)) XUngrabServer( display );
} }
SendMessage( hwnd, WM_EXITSIZEMOVE, 0, 0 ); SendMessage( hwnd, WM_EXITSIZEMOVE, 0, 0 );
SendMessage( hwnd, WM_SETVISIBLE, !IsIconic(hwnd), 0L);
/* If Esc key, don't move the window */ /* If Esc key, don't move the window */
if ((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) return; if ((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) return;
...@@ -1090,8 +1110,7 @@ static void NC_TrackMinMaxBox( HWND hwnd, WORD wParam ) ...@@ -1090,8 +1110,7 @@ static void NC_TrackMinMaxBox( HWND hwnd, WORD wParam )
*/ */
static void NC_TrackScrollBar( HWND hwnd, WORD wParam, POINT pt ) static void NC_TrackScrollBar( HWND hwnd, WORD wParam, POINT pt )
{ {
MSG *msg; MSG msg;
HLOCAL hMsg;
WORD scrollbar; WORD scrollbar;
WND *wndPtr = WIN_FindWndPtr( hwnd ); WND *wndPtr = WIN_FindWndPtr( hwnd );
...@@ -1106,8 +1125,6 @@ static void NC_TrackScrollBar( HWND hwnd, WORD wParam, POINT pt ) ...@@ -1106,8 +1125,6 @@ static void NC_TrackScrollBar( HWND hwnd, WORD wParam, POINT pt )
scrollbar = SB_VERT; scrollbar = SB_VERT;
} }
hMsg = USER_HEAP_ALLOC( sizeof(MSG) );
msg = (MSG *) USER_HEAP_LIN_ADDR( hMsg );
pt.x -= wndPtr->rectWindow.left; pt.x -= wndPtr->rectWindow.left;
pt.y -= wndPtr->rectWindow.top; pt.y -= wndPtr->rectWindow.top;
SetCapture( hwnd ); SetCapture( hwnd );
...@@ -1115,21 +1132,21 @@ static void NC_TrackScrollBar( HWND hwnd, WORD wParam, POINT pt ) ...@@ -1115,21 +1132,21 @@ static void NC_TrackScrollBar( HWND hwnd, WORD wParam, POINT pt )
do do
{ {
GetMessage( (SEGPTR)USER_HEAP_SEG_ADDR(hMsg), 0, 0, 0 ); GetMessage( MAKE_SEGPTR(&msg), 0, 0, 0 );
switch(msg->message) switch(msg.message)
{ {
case WM_LBUTTONUP: case WM_LBUTTONUP:
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
case WM_SYSTIMER: case WM_SYSTIMER:
pt.x = LOWORD(msg->lParam) + wndPtr->rectClient.left - pt.x = LOWORD(msg.lParam) + wndPtr->rectClient.left -
wndPtr->rectWindow.left; wndPtr->rectWindow.left;
pt.y = HIWORD(msg->lParam) + wndPtr->rectClient.top - pt.y = HIWORD(msg.lParam) + wndPtr->rectClient.top -
wndPtr->rectWindow.top; wndPtr->rectWindow.top;
SCROLL_HandleScrollEvent( hwnd, scrollbar, msg->message, pt ); SCROLL_HandleScrollEvent( hwnd, scrollbar, msg.message, pt );
break; break;
default: default:
TranslateMessage( msg ); TranslateMessage( &msg );
DispatchMessage( msg ); DispatchMessage( &msg );
break; break;
} }
if (!IsWindow( hwnd )) if (!IsWindow( hwnd ))
...@@ -1137,8 +1154,7 @@ static void NC_TrackScrollBar( HWND hwnd, WORD wParam, POINT pt ) ...@@ -1137,8 +1154,7 @@ static void NC_TrackScrollBar( HWND hwnd, WORD wParam, POINT pt )
ReleaseCapture(); ReleaseCapture();
break; break;
} }
} while (msg->message != WM_LBUTTONUP); } while (msg.message != WM_LBUTTONUP);
USER_HEAP_FREE( hMsg );
} }
/*********************************************************************** /***********************************************************************
......
...@@ -2,40 +2,157 @@ ...@@ -2,40 +2,157 @@
* Scroll windows and DCs * Scroll windows and DCs
* *
* Copyright David W. Metcalfe, 1993 * Copyright David W. Metcalfe, 1993
* Alex Korobka 1995
*
* *
*/ */
#include <stdlib.h> #include <stdlib.h>
#include "windows.h" #include "wintypes.h"
#include "class.h"
#include "win.h"
#include "gdi.h" #include "gdi.h"
#include "scroll.h" #include "sysmetrics.h"
#include "stddebug.h" #include "stddebug.h"
/* #define DEBUG_SCROLL */ /* #define DEBUG_SCROLL */
#include "debug.h" #include "debug.h"
extern DCE_GetVisRgn(HWND, WORD);
static int RgnType; static int RgnType;
/* -----------------------------------------------------------------------
* SCROLL_TraceChildren
*
* Returns a region invalidated by children, siblings, and/or ansectors
* in the window rectangle or client rectangle
*
* dcx can have DCX_WINDOW, DCX_CLIPCHILDREN, DCX_CLIPSIBLINGS set
*/
HRGN SCROLL_TraceChildren( HWND hScroll, short dx, short dy, WORD dcx)
{
WND *wndScroll = WIN_FindWndPtr( hScroll );
HRGN hRgnWnd;
HRGN hUpdateRgn,hCombineRgn;
if( !wndScroll || ( !dx && !dy) ) return 0;
if( dcx & DCX_WINDOW )
hRgnWnd = CreateRectRgnIndirect(&wndScroll->rectWindow);
else
{
RECT rect;
GetClientRect(hScroll,&rect);
hRgnWnd = CreateRectRgnIndirect(&rect);
}
hUpdateRgn = DCE_GetVisRgn( hScroll, dcx );
hCombineRgn = CreateRectRgn(0,0,0,0);
if( !hUpdateRgn || !hCombineRgn )
{
DeleteObject( hUpdateRgn? hUpdateRgn : hCombineRgn);
DeleteObject(hRgnWnd);
return 0;
}
OffsetRgn( hUpdateRgn, dx, dy);
CombineRgn(hCombineRgn, hRgnWnd, hUpdateRgn, RGN_DIFF);
DeleteObject(hRgnWnd);
DeleteObject(hUpdateRgn);
return hCombineRgn;
}
/* ----------------------------------------------------------------------
* SCROLL_ScrollChildren
*/
BOOL SCROLL_ScrollChildren( HWND hScroll, short dx, short dy)
{
WND *wndPtr = WIN_FindWndPtr(hScroll);
HWND hWnd = wndPtr->hwndChild;
HRGN hUpdateRgn;
BOOL b = 0;
if( !wndPtr || ( !dx && !dy )) return 0;
dprintf_scroll(stddeb,"SCROLL_ScrollChildren: hwnd "NPFMT" dx=%i dy=%i\n",hScroll,dx,dy);
/* get a region in client rect invalidated by siblings and ansectors */
hUpdateRgn = SCROLL_TraceChildren(hScroll, dx , dy, DCX_CLIPSIBLINGS);
/* update children coordinates */
while( hWnd )
{
wndPtr = WIN_FindWndPtr( hWnd );
/* we can check if window intersects with clipRect parameter
* and do not move it if not - just a thought. - AK
*/
SetWindowPos(hWnd,0,wndPtr->rectWindow.left + dx,
wndPtr->rectWindow.top + dy, 0,0, SWP_NOZORDER |
SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOREDRAW |
SWP_DEFERERASE );
hWnd = wndPtr->hwndNext;
}
/* invalidate uncovered region and paint frames */
b = RedrawWindow( hScroll, NULL, hUpdateRgn, RDW_INVALIDATE | RDW_FRAME | RDW_ERASE |
RDW_ERASENOW | RDW_ALLCHILDREN );
DeleteObject( hUpdateRgn);
return b;
}
/************************************************************************* /*************************************************************************
* ScrollWindow (USER.61) * ScrollWindow (USER.61)
*
* FIXME: a bit broken
*/ */
void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect) void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect)
{ {
HDC hdc; HDC hdc;
HRGN hrgnUpdate; HRGN hrgnUpdate,hrgnClip;
RECT rc, cliprc; RECT rc, cliprc;
dprintf_scroll(stddeb,"ScrollWindow: dx=%d, dy=%d, rect=%ld,%ld,%ld,%ld\n", dprintf_scroll(stddeb,"ScrollWindow: dx=%d, dy=%d, lpRect =%08lx clipRect=%i,%i,%i,%i\n",
dx, dy, (LONG)rect->left, (LONG)rect->top, (LONG)rect->right, (LONG)rect->bottom); dx, dy, (LONG)rect, (clipRect)?clipRect->left:0,
(clipRect)?clipRect->top:0,
(clipRect)?clipRect->right:0,
(clipRect)?clipRect->bottom:0);
hdc = GetDC(hwnd); /* if rect is NULL children have to be moved */
if ( !rect )
if (rect == NULL) {
GetClientRect(hwnd, &rc); GetClientRect(hwnd, &rc);
hrgnClip = CreateRectRgnIndirect( &rc );
/* children will be Blt'ed too */
hdc = GetDCEx(hwnd, hrgnClip, DCX_CACHE | DCX_CLIPSIBLINGS);
DeleteObject(hrgnClip);
}
else else
{
GetClientRect(hwnd,&rc);
dprintf_scroll(stddeb,"\trect=%i %i %i %i client=%i %i %i %i\n",
rect->left,rect->top,rect->right,rect->bottom,rc.left,rc.top,
rc.right,rc.bottom);
CopyRect(&rc, rect); CopyRect(&rc, rect);
hdc = GetDC(hwnd);
}
if (clipRect == NULL) if (clipRect == NULL)
GetClientRect(hwnd, &cliprc); GetClientRect(hwnd, &cliprc);
else else
...@@ -43,13 +160,41 @@ void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect) ...@@ -43,13 +160,41 @@ void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect)
hrgnUpdate = CreateRectRgn(0, 0, 0, 0); hrgnUpdate = CreateRectRgn(0, 0, 0, 0);
ScrollDC(hdc, dx, dy, &rc, &cliprc, hrgnUpdate, NULL); ScrollDC(hdc, dx, dy, &rc, &cliprc, hrgnUpdate, NULL);
InvalidateRgn(hwnd, hrgnUpdate, TRUE);
ReleaseDC(hwnd, hdc); ReleaseDC(hwnd, hdc);
if( !rect )
{
/* FIXME: this doesn't take into account hrgnUpdate */
if( !SCROLL_ScrollChildren(hwnd,dx,dy) )
InvalidateRgn(hwnd, hrgnUpdate, TRUE);
}
else
{
HRGN hrgnInv = SCROLL_TraceChildren(hwnd,dx,dy,DCX_CLIPCHILDREN |
DCX_CLIPSIBLINGS );
if( hrgnInv )
{
HRGN hrgnCombine = CreateRectRgn(0,0,0,0);
CombineRgn(hrgnCombine,hrgnInv,hrgnUpdate,RGN_OR);
dprintf_scroll(stddeb,"ScrollWindow: hrgnComb="NPFMT" hrgnInv="NPFMT" hrgnUpd="NPFMT"\n",
hrgnCombine,hrgnInv,hrgnUpdate);
DeleteObject(hrgnUpdate); DeleteObject(hrgnInv);
hrgnUpdate = hrgnCombine;
}
RedrawWindow( hwnd, NULL, hrgnUpdate, RDW_INVALIDATE | RDW_ERASE | RDW_ERASENOW);
}
DeleteObject(hrgnUpdate);
} }
/************************************************************************* /*************************************************************************
* ScrollDC (USER.221) * ScrollDC (USER.221)
*
* FIXME: half-broken
*/ */
BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT rc, LPRECT cliprc, BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT rc, LPRECT cliprc,
...@@ -60,8 +205,11 @@ BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT rc, LPRECT cliprc, ...@@ -60,8 +205,11 @@ BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT rc, LPRECT cliprc,
short width, height; short width, height;
DC *dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC); DC *dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC);
dprintf_scroll(stddeb, "ScrollDC: dx=%d, dy=%d, rc=%ld,%ld,%ld,%ld\n", dx, dy, dprintf_scroll(stddeb,"ScrollDC: dx=%d dy=%d, hrgnUpdate="NPFMT" rc=%i %i %i %i\n",
(LONG)rc->left, (LONG)rc->top, (LONG)rc->right, (LONG)rc->bottom); dx,dy,hrgnUpdate,(rc)?rc->left:0,
(rc)?rc->top:0,
(rc)?rc->right:0,
(rc)?rc->bottom:0);
if (rc == NULL) if (rc == NULL)
return FALSE; return FALSE;
...@@ -128,6 +276,10 @@ BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT rc, LPRECT cliprc, ...@@ -128,6 +276,10 @@ BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT rc, LPRECT cliprc,
/************************************************************************* /*************************************************************************
* ScrollWindowEx (USER.319) * ScrollWindowEx (USER.319)
*
* FIXME: broken
*
* SCROLL_TraceChildren can help
*/ */
int ScrollWindowEx(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect, int ScrollWindowEx(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect,
...@@ -136,9 +288,7 @@ int ScrollWindowEx(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect, ...@@ -136,9 +288,7 @@ int ScrollWindowEx(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect,
HDC hdc; HDC hdc;
RECT rc, cliprc; RECT rc, cliprc;
dprintf_scroll(stddeb,"ScrollWindowEx: dx=%d, dy=%d, rect=%ld,%ld,%ld,%ld\n", dprintf_scroll(stddeb,"ScrollWindowEx: dx=%d, dy=%d, wFlags="NPFMT"\n",dx, dy, flags);
dx, dy, (LONG)rect->left, (LONG)rect->top, (LONG)rect->right,
(LONG)rect->bottom);
hdc = GetDC(hwnd); hdc = GetDC(hwnd);
......
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