1996-03-14 19:08:34 +01:00
|
|
|
/*
|
|
|
|
* Message queues related functions
|
|
|
|
*
|
|
|
|
* Copyright 1993, 1994 Alexandre Julliard
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "module.h"
|
|
|
|
#include "queue.h"
|
|
|
|
#include "win.h"
|
|
|
|
#include "stddebug.h"
|
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
#define MAX_QUEUE_SIZE 120 /* Max. size of a message queue */
|
|
|
|
|
|
|
|
static HQUEUE hFirstQueue = 0;
|
|
|
|
static HQUEUE hmemSysMsgQueue = 0;
|
|
|
|
static MESSAGEQUEUE *sysMsgQueue = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* QUEUE_DumpQueue
|
|
|
|
*/
|
|
|
|
void QUEUE_DumpQueue( HQUEUE hQueue )
|
|
|
|
{
|
|
|
|
MESSAGEQUEUE *pq;
|
|
|
|
|
|
|
|
if (!(pq = (MESSAGEQUEUE*) GlobalLock( hQueue )) ||
|
|
|
|
GlobalSize(hQueue) < sizeof(MESSAGEQUEUE) + pq->queueSize*sizeof(QMSG))
|
|
|
|
{
|
Release 960324
Sun Mar 24 13:13:11 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [include/win.h] [windows/*.c]
Replaced next, parent, child and owner handles by pointers in WND
structure. This should improve performance, and should be
reasonably safe since Microsoft did the same in Win95.
* [include/wintypes.h] [*/*]
Redefined HANDLE to be UINT instead of a pointer for Winelib. This
allows removing a lot of unnecessary casts and NPFMTs.
* [windows/caret.c]
Create the caret brush upon CreateCaret(); use the bitmap
dimensions for the caret.
Fixed CARET_DisplayCaret() to use PatBlt().
Fri Mar 22 16:00:00 1996 Anand Kumria <akumria@ozemail.com.au>
* [misc/winsocket.c]
More sanity checks, fixup some erroneous return codes.
* [documentation/winsock]
Description of how compatible the winsock is currently.
Fri Mar 22 13:05:34 1996 Ulrich Schmid <uschmid@mail.hh.provi.de>
* [library/winmain.c]
Set `lpszCmdParam' by concatenating arguments.
* [loader/module.c]
WinExec: accept Unix commands, use Wine emulator.
Mon Mar 18 12:16:27 1996 Martin von Loewis <loewis@informatik.hu-berlin.de>
* [if1632/kernel32.spec][win32/thread.c][include/kernel32.h]
DeleteCriticalSection, EnterCriticalSection,
InitializeCriticalSection, LeaveCriticalSection, TlsAlloc,
TlsFree, TlsGetValue, TlsSetValue: new functions.
CRITICAL_SECTION: new structure.
* [if1632/kernel32.spec][win32/code_page.c]
WideCharToMultiByte: new function.
* [if1632/kernel32.spec][win32/file.c]
GetFileAttributesA: new function.
* [if1632/kernel32.spec][misc/main.c]
GetEnvironmentStringsW, FreeEnvironmentStringsA,
FreeEnvironmentStringsW: new functions.
* [if1632/user.spec][win32/cursoricon32.c][win32/Makefile.in]
cursoricon32.c: new file.
LoadCursorA, LoadCursorW: modified implementation from LoadCursor
to WIN32_*.
LoadIconA, LoadIconW: modified implementation from LoadIconA32
to WIN32_*.
* [include/struct32.h]
pragma pack inserted.
CURSORICON32 structures added.
* [include/winnls.h]
Constants CP_* and WC_* added.
* [loader/pe_image.c]
PE_LoadModule: call PE_InitDLL with hModule rather than wpnt.
Sun Mar 17 16:59:12 1996 Albrecht Kleine <kleine@ak.sax.de>
* [misc/commdlg.c]
Introduced hook function handling in file dialog.
Removed an unnecessary ShowWindow call in FILEDLG_WMCommand().
Thu Mar 14 10:50:00 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>
* [if1632/gdi32.spec]
Added GetNearestColor.
* [if1632/kernel32.spec]
Added GlobalAddAtomA.
* [win32/param32.c]
Added stackframe.h to includes.
WIN32_GlobalAddAtomA() - new function.
1996-03-24 17:20:51 +01:00
|
|
|
fprintf( stderr, "%04x is not a queue handle\n", hQueue );
|
1996-03-14 19:08:34 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf( stderr,
|
|
|
|
"next: %12.4x Intertask SendMessage:\n"
|
|
|
|
"hTask: %11.4x ----------------------\n"
|
|
|
|
"msgSize: %9.4x hWnd: %10.4x\n"
|
|
|
|
"msgCount: %8.4x msg: %11.4x\n"
|
|
|
|
"msgNext: %9.4x wParam: %8.4x\n"
|
|
|
|
"msgFree: %9.4x lParam: %8.8x\n"
|
|
|
|
"qSize: %11.4x lRet: %10.8x\n"
|
|
|
|
"wWinVer: %9.4x ISMH: %10.4x\n"
|
|
|
|
"paints: %10.4x hSendTask: %5.4x\n"
|
|
|
|
"timers: %10.4x hPrevSend: %5.4x\n"
|
|
|
|
"wakeBits: %8.4x\n"
|
|
|
|
"wakeMask: %8.4x\n"
|
|
|
|
"hCurHook: %8.4x\n",
|
|
|
|
pq->next, pq->hTask, pq->msgSize, pq->hWnd,
|
|
|
|
pq->msgCount, pq->msg, pq->nextMessage, pq->wParam,
|
|
|
|
pq->nextFreeMessage, (unsigned)pq->lParam, pq->queueSize,
|
|
|
|
(unsigned)pq->SendMessageReturn, pq->wWinVersion, pq->InSendMessageHandle,
|
|
|
|
pq->wPaintCount, pq->hSendingTask, pq->wTimerCount,
|
|
|
|
pq->hPrevSendingTask, pq->status, pq->wakeMask, pq->hCurHook);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* QUEUE_WalkQueues
|
|
|
|
*/
|
|
|
|
void QUEUE_WalkQueues(void)
|
|
|
|
{
|
|
|
|
HQUEUE hQueue = hFirstQueue;
|
|
|
|
|
|
|
|
fprintf( stderr, "Queue Size Msgs Task\n" );
|
|
|
|
while (hQueue)
|
|
|
|
{
|
|
|
|
MESSAGEQUEUE *queue = (MESSAGEQUEUE *)GlobalLock( hQueue );
|
|
|
|
if (!queue)
|
|
|
|
{
|
Release 960324
Sun Mar 24 13:13:11 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [include/win.h] [windows/*.c]
Replaced next, parent, child and owner handles by pointers in WND
structure. This should improve performance, and should be
reasonably safe since Microsoft did the same in Win95.
* [include/wintypes.h] [*/*]
Redefined HANDLE to be UINT instead of a pointer for Winelib. This
allows removing a lot of unnecessary casts and NPFMTs.
* [windows/caret.c]
Create the caret brush upon CreateCaret(); use the bitmap
dimensions for the caret.
Fixed CARET_DisplayCaret() to use PatBlt().
Fri Mar 22 16:00:00 1996 Anand Kumria <akumria@ozemail.com.au>
* [misc/winsocket.c]
More sanity checks, fixup some erroneous return codes.
* [documentation/winsock]
Description of how compatible the winsock is currently.
Fri Mar 22 13:05:34 1996 Ulrich Schmid <uschmid@mail.hh.provi.de>
* [library/winmain.c]
Set `lpszCmdParam' by concatenating arguments.
* [loader/module.c]
WinExec: accept Unix commands, use Wine emulator.
Mon Mar 18 12:16:27 1996 Martin von Loewis <loewis@informatik.hu-berlin.de>
* [if1632/kernel32.spec][win32/thread.c][include/kernel32.h]
DeleteCriticalSection, EnterCriticalSection,
InitializeCriticalSection, LeaveCriticalSection, TlsAlloc,
TlsFree, TlsGetValue, TlsSetValue: new functions.
CRITICAL_SECTION: new structure.
* [if1632/kernel32.spec][win32/code_page.c]
WideCharToMultiByte: new function.
* [if1632/kernel32.spec][win32/file.c]
GetFileAttributesA: new function.
* [if1632/kernel32.spec][misc/main.c]
GetEnvironmentStringsW, FreeEnvironmentStringsA,
FreeEnvironmentStringsW: new functions.
* [if1632/user.spec][win32/cursoricon32.c][win32/Makefile.in]
cursoricon32.c: new file.
LoadCursorA, LoadCursorW: modified implementation from LoadCursor
to WIN32_*.
LoadIconA, LoadIconW: modified implementation from LoadIconA32
to WIN32_*.
* [include/struct32.h]
pragma pack inserted.
CURSORICON32 structures added.
* [include/winnls.h]
Constants CP_* and WC_* added.
* [loader/pe_image.c]
PE_LoadModule: call PE_InitDLL with hModule rather than wpnt.
Sun Mar 17 16:59:12 1996 Albrecht Kleine <kleine@ak.sax.de>
* [misc/commdlg.c]
Introduced hook function handling in file dialog.
Removed an unnecessary ShowWindow call in FILEDLG_WMCommand().
Thu Mar 14 10:50:00 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>
* [if1632/gdi32.spec]
Added GetNearestColor.
* [if1632/kernel32.spec]
Added GlobalAddAtomA.
* [win32/param32.c]
Added stackframe.h to includes.
WIN32_GlobalAddAtomA() - new function.
1996-03-24 17:20:51 +01:00
|
|
|
fprintf( stderr, "*** Bad queue handle %04x\n", hQueue );
|
1996-03-14 19:08:34 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
fprintf( stderr, "%04x %5d %4d %04x %s\n",
|
|
|
|
hQueue, queue->msgSize, queue->msgCount, queue->hTask,
|
|
|
|
MODULE_GetModuleName( GetExePtr(queue->hTask) ) );
|
|
|
|
hQueue = queue->next;
|
|
|
|
}
|
|
|
|
fprintf( stderr, "\n" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* QUEUE_CreateMsgQueue
|
|
|
|
*
|
|
|
|
* Creates a message queue. Doesn't link it into queue list!
|
|
|
|
*/
|
|
|
|
static HQUEUE QUEUE_CreateMsgQueue( int size )
|
|
|
|
{
|
|
|
|
HQUEUE hQueue;
|
|
|
|
MESSAGEQUEUE * msgQueue;
|
|
|
|
int queueSize;
|
|
|
|
|
Release 960428
Sun Apr 28 14:32:43 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [Makefile.in]
Subdir memory is now also compiled for Winelib, in order to get
the Win32 heap functions.
* [if1632/Makefile.in]
Renamed winprocs and winprocs32 to wprocs and wprocs32 to avoid
DLL names > 8 characters.
* [loader/builtin.c] (New file)
Grouped all built-in DLLs code in a single file.
* [memory/global.c]
Use the Win32 heap code instead of malloc() to allocate linear
memory. This will help test the heap code.
* [memory/local.c]
Fixed FreeSelector() to clear DS and ES correctly for huge blocks.
* [tools/build.c] [if1632/relay.c]
Removed 'id' directive in spec files. For relay debugging, the DLL
entry point is now computed from the CS:IP entry point address.
Added 'heap' directive to specifiy a local heap for the DLL. USER
and GDI heap are now created this way.
* [windows/class.c] [include/class.h]
Changed the class structure to use pointers instead of handles.
Changed Get/SetClassWord/Long to use a switch statement; this
allows changing the layout of the CLASS structure.
* [windows/win.c] [include/win.h]
Use a CLASS * instead of a handle for the window class.
Sat Apr 27 18:10:11 Martin von Loewis <loewis@informatik.hu-berlin.de>
* [if1632/kernel32.spec] [memory/global.c]
[win32/memory.c] [win32/process.c]
GetProcessAffinityMask,GlobalLock,IsBadReadPtr,IsBadWritePtr,
LocalLock,SetThreadAffinityMask: new relays.
* [win32/cursoricon32.c]
Return same handle if a cursor is loaded multiple times.
Sat Apr 27 15:13:37 1996 Bang Jun Young <bangjy@nownuri.nowcom.co.kr>
* [resources/sysres_Ko.rc]
Added support for Korean [Ko] language.
Fri Apr 26 00:49:05 1996 Huw D. M. Davies <h.davies1@physics.oxford.ac.uk>
* [objects/dc.c] [objects/font.c]
Fixed problem with SaveDC()/RestoreDC() and font cache 'used' count.
* [objects/metafile.c] [objects/dcvalues.c]
Fixed broken SetTextAlign() on metafiles.
* [objects/metafile.c]
Delete objects in handle table at end of PlayMetaFile().
Wed Apr 24 19:21:01 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [if1632/ver.spec] [misc/ver.c] [include/ver.h] (New files)
VER.DLL (partially) implemented (VerFindFile,VerInstallFile)
[If it doesn't work for you, use -dll -ver and report it to me]
* [if1632/user32.spec] [if1632/kernel32.spec] [if1632/shell.spec]
[if1632/shell32.spec] [misc/ole2nls.c] [windows/message.c]
[windows/graphics.c]
Simple win32 functions, where we can just use the win16 counterpart.
Misc. stubs.
* [misc/lstr.c]
Someone reported a _lstrlen(NULL). NULL is a valid argument. Fixed.
* [misc/registry.c]
Some alloclens were off by 1, one double fclose() fixed.
Requesting value 0 of a key with no values returns an error
(should we always return a made up value NULL? what does win3.1?)
Tue Apr 23 17:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu>
* [misc/shell.c]
Implemented FindEnvironmentString(), DoEnvironmentSubst(),
ExtractIcon(), InternalExtractIcon() and ExtractAssociatedIcon().
* [misc/user.c]
Do extensive cleanup on application exit.
* [windows/hook.c] [windows/win.c] [windows/class.c]
Added miscellaneous cleanup routines.
* [controls/menu.c]
More efficient popup menu window handling.
Mon Apr 22 21:35:22 1996 Albrecht Kleine <kleine@ak.sax.de>
* [include/windows.h][objects/oembitmap.c][include/bitmaps/obm_trtype]
Added "TT-bitmap" for later usage in a ChooseFont() ownerdraw combobox.
1996-04-28 17:09:19 +02:00
|
|
|
dprintf_msg(stddeb,"Creating message queue...\n");
|
|
|
|
|
1996-03-14 19:08:34 +01:00
|
|
|
queueSize = sizeof(MESSAGEQUEUE) + size * sizeof(QMSG);
|
|
|
|
if (!(hQueue = GlobalAlloc( GMEM_FIXED | GMEM_ZEROINIT, queueSize )))
|
|
|
|
return 0;
|
|
|
|
msgQueue = (MESSAGEQUEUE *) GlobalLock( hQueue );
|
|
|
|
msgQueue->msgSize = sizeof(QMSG);
|
|
|
|
msgQueue->queueSize = size;
|
|
|
|
msgQueue->wWinVersion = 0; /* FIXME? */
|
|
|
|
GlobalUnlock( hQueue );
|
|
|
|
return hQueue;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* QUEUE_DeleteMsgQueue
|
|
|
|
*
|
|
|
|
* Unlinks and deletes a message queue.
|
|
|
|
*/
|
|
|
|
BOOL QUEUE_DeleteMsgQueue( HQUEUE hQueue )
|
|
|
|
{
|
|
|
|
MESSAGEQUEUE * msgQueue = (MESSAGEQUEUE*)GlobalLock(hQueue);
|
|
|
|
HQUEUE *pPrev;
|
|
|
|
|
Release 960428
Sun Apr 28 14:32:43 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [Makefile.in]
Subdir memory is now also compiled for Winelib, in order to get
the Win32 heap functions.
* [if1632/Makefile.in]
Renamed winprocs and winprocs32 to wprocs and wprocs32 to avoid
DLL names > 8 characters.
* [loader/builtin.c] (New file)
Grouped all built-in DLLs code in a single file.
* [memory/global.c]
Use the Win32 heap code instead of malloc() to allocate linear
memory. This will help test the heap code.
* [memory/local.c]
Fixed FreeSelector() to clear DS and ES correctly for huge blocks.
* [tools/build.c] [if1632/relay.c]
Removed 'id' directive in spec files. For relay debugging, the DLL
entry point is now computed from the CS:IP entry point address.
Added 'heap' directive to specifiy a local heap for the DLL. USER
and GDI heap are now created this way.
* [windows/class.c] [include/class.h]
Changed the class structure to use pointers instead of handles.
Changed Get/SetClassWord/Long to use a switch statement; this
allows changing the layout of the CLASS structure.
* [windows/win.c] [include/win.h]
Use a CLASS * instead of a handle for the window class.
Sat Apr 27 18:10:11 Martin von Loewis <loewis@informatik.hu-berlin.de>
* [if1632/kernel32.spec] [memory/global.c]
[win32/memory.c] [win32/process.c]
GetProcessAffinityMask,GlobalLock,IsBadReadPtr,IsBadWritePtr,
LocalLock,SetThreadAffinityMask: new relays.
* [win32/cursoricon32.c]
Return same handle if a cursor is loaded multiple times.
Sat Apr 27 15:13:37 1996 Bang Jun Young <bangjy@nownuri.nowcom.co.kr>
* [resources/sysres_Ko.rc]
Added support for Korean [Ko] language.
Fri Apr 26 00:49:05 1996 Huw D. M. Davies <h.davies1@physics.oxford.ac.uk>
* [objects/dc.c] [objects/font.c]
Fixed problem with SaveDC()/RestoreDC() and font cache 'used' count.
* [objects/metafile.c] [objects/dcvalues.c]
Fixed broken SetTextAlign() on metafiles.
* [objects/metafile.c]
Delete objects in handle table at end of PlayMetaFile().
Wed Apr 24 19:21:01 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [if1632/ver.spec] [misc/ver.c] [include/ver.h] (New files)
VER.DLL (partially) implemented (VerFindFile,VerInstallFile)
[If it doesn't work for you, use -dll -ver and report it to me]
* [if1632/user32.spec] [if1632/kernel32.spec] [if1632/shell.spec]
[if1632/shell32.spec] [misc/ole2nls.c] [windows/message.c]
[windows/graphics.c]
Simple win32 functions, where we can just use the win16 counterpart.
Misc. stubs.
* [misc/lstr.c]
Someone reported a _lstrlen(NULL). NULL is a valid argument. Fixed.
* [misc/registry.c]
Some alloclens were off by 1, one double fclose() fixed.
Requesting value 0 of a key with no values returns an error
(should we always return a made up value NULL? what does win3.1?)
Tue Apr 23 17:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu>
* [misc/shell.c]
Implemented FindEnvironmentString(), DoEnvironmentSubst(),
ExtractIcon(), InternalExtractIcon() and ExtractAssociatedIcon().
* [misc/user.c]
Do extensive cleanup on application exit.
* [windows/hook.c] [windows/win.c] [windows/class.c]
Added miscellaneous cleanup routines.
* [controls/menu.c]
More efficient popup menu window handling.
Mon Apr 22 21:35:22 1996 Albrecht Kleine <kleine@ak.sax.de>
* [include/windows.h][objects/oembitmap.c][include/bitmaps/obm_trtype]
Added "TT-bitmap" for later usage in a ChooseFont() ownerdraw combobox.
1996-04-28 17:09:19 +02:00
|
|
|
dprintf_msg(stddeb,"Deleting message queue %04x\n", hQueue);
|
|
|
|
|
1996-03-14 19:08:34 +01:00
|
|
|
if (!hQueue || !msgQueue)
|
|
|
|
{
|
|
|
|
dprintf_msg(stddeb,"DeleteMsgQueue: invalid argument.\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
pPrev = &hFirstQueue;
|
|
|
|
while (*pPrev && (*pPrev != hQueue))
|
|
|
|
{
|
|
|
|
MESSAGEQUEUE *msgQ = (MESSAGEQUEUE*)GlobalLock(*pPrev);
|
|
|
|
pPrev = &msgQ->next;
|
|
|
|
}
|
|
|
|
if (*pPrev) *pPrev = msgQueue->next;
|
|
|
|
GlobalFree( hQueue );
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* QUEUE_CreateSysMsgQueue
|
|
|
|
*
|
|
|
|
* Create the system message queue, and set the double-click speed.
|
|
|
|
* Must be called only once.
|
|
|
|
*/
|
|
|
|
BOOL QUEUE_CreateSysMsgQueue( int size )
|
|
|
|
{
|
|
|
|
if (size > MAX_QUEUE_SIZE) size = MAX_QUEUE_SIZE;
|
|
|
|
else if (size <= 0) size = 1;
|
|
|
|
if (!(hmemSysMsgQueue = QUEUE_CreateMsgQueue( size ))) return FALSE;
|
|
|
|
sysMsgQueue = (MESSAGEQUEUE *) GlobalLock( hmemSysMsgQueue );
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* QUEUE_GetSysQueue
|
|
|
|
*/
|
|
|
|
MESSAGEQUEUE *QUEUE_GetSysQueue(void)
|
|
|
|
{
|
|
|
|
return sysMsgQueue;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* QUEUE_AddMsg
|
|
|
|
*
|
|
|
|
* Add a message to the queue. Return FALSE if queue is full.
|
|
|
|
*/
|
|
|
|
BOOL QUEUE_AddMsg( HQUEUE hQueue, MSG * msg, DWORD extraInfo )
|
|
|
|
{
|
|
|
|
int pos;
|
|
|
|
MESSAGEQUEUE *msgQueue;
|
|
|
|
|
|
|
|
if (!(msgQueue = (MESSAGEQUEUE *)GlobalLock( hQueue ))) return FALSE;
|
|
|
|
pos = msgQueue->nextFreeMessage;
|
|
|
|
|
|
|
|
/* Check if queue is full */
|
|
|
|
if ((pos == msgQueue->nextMessage) && (msgQueue->msgCount > 0))
|
|
|
|
{
|
|
|
|
fprintf(stderr,"MSG_AddMsg // queue is full !\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Store message */
|
|
|
|
msgQueue->messages[pos].msg = *msg;
|
|
|
|
msgQueue->messages[pos].extraInfo = extraInfo;
|
|
|
|
if (pos < msgQueue->queueSize-1) pos++;
|
|
|
|
else pos = 0;
|
|
|
|
msgQueue->nextFreeMessage = pos;
|
|
|
|
msgQueue->msgCount++;
|
|
|
|
msgQueue->status |= QS_POSTMESSAGE;
|
|
|
|
msgQueue->tempStatus |= QS_POSTMESSAGE;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* QUEUE_FindMsg
|
|
|
|
*
|
|
|
|
* Find a message matching the given parameters. Return -1 if none available.
|
|
|
|
*/
|
|
|
|
int QUEUE_FindMsg( MESSAGEQUEUE * msgQueue, HWND hwnd, int first, int last )
|
|
|
|
{
|
|
|
|
int i, pos = msgQueue->nextMessage;
|
|
|
|
|
Release 960324
Sun Mar 24 13:13:11 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [include/win.h] [windows/*.c]
Replaced next, parent, child and owner handles by pointers in WND
structure. This should improve performance, and should be
reasonably safe since Microsoft did the same in Win95.
* [include/wintypes.h] [*/*]
Redefined HANDLE to be UINT instead of a pointer for Winelib. This
allows removing a lot of unnecessary casts and NPFMTs.
* [windows/caret.c]
Create the caret brush upon CreateCaret(); use the bitmap
dimensions for the caret.
Fixed CARET_DisplayCaret() to use PatBlt().
Fri Mar 22 16:00:00 1996 Anand Kumria <akumria@ozemail.com.au>
* [misc/winsocket.c]
More sanity checks, fixup some erroneous return codes.
* [documentation/winsock]
Description of how compatible the winsock is currently.
Fri Mar 22 13:05:34 1996 Ulrich Schmid <uschmid@mail.hh.provi.de>
* [library/winmain.c]
Set `lpszCmdParam' by concatenating arguments.
* [loader/module.c]
WinExec: accept Unix commands, use Wine emulator.
Mon Mar 18 12:16:27 1996 Martin von Loewis <loewis@informatik.hu-berlin.de>
* [if1632/kernel32.spec][win32/thread.c][include/kernel32.h]
DeleteCriticalSection, EnterCriticalSection,
InitializeCriticalSection, LeaveCriticalSection, TlsAlloc,
TlsFree, TlsGetValue, TlsSetValue: new functions.
CRITICAL_SECTION: new structure.
* [if1632/kernel32.spec][win32/code_page.c]
WideCharToMultiByte: new function.
* [if1632/kernel32.spec][win32/file.c]
GetFileAttributesA: new function.
* [if1632/kernel32.spec][misc/main.c]
GetEnvironmentStringsW, FreeEnvironmentStringsA,
FreeEnvironmentStringsW: new functions.
* [if1632/user.spec][win32/cursoricon32.c][win32/Makefile.in]
cursoricon32.c: new file.
LoadCursorA, LoadCursorW: modified implementation from LoadCursor
to WIN32_*.
LoadIconA, LoadIconW: modified implementation from LoadIconA32
to WIN32_*.
* [include/struct32.h]
pragma pack inserted.
CURSORICON32 structures added.
* [include/winnls.h]
Constants CP_* and WC_* added.
* [loader/pe_image.c]
PE_LoadModule: call PE_InitDLL with hModule rather than wpnt.
Sun Mar 17 16:59:12 1996 Albrecht Kleine <kleine@ak.sax.de>
* [misc/commdlg.c]
Introduced hook function handling in file dialog.
Removed an unnecessary ShowWindow call in FILEDLG_WMCommand().
Thu Mar 14 10:50:00 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>
* [if1632/gdi32.spec]
Added GetNearestColor.
* [if1632/kernel32.spec]
Added GlobalAddAtomA.
* [win32/param32.c]
Added stackframe.h to includes.
WIN32_GlobalAddAtomA() - new function.
1996-03-24 17:20:51 +01:00
|
|
|
dprintf_msg(stddeb,"MSG_FindMsg: hwnd=%04x\n\n", hwnd );
|
1996-03-14 19:08:34 +01:00
|
|
|
|
|
|
|
if (!msgQueue->msgCount) return -1;
|
|
|
|
if (!hwnd && !first && !last) return pos;
|
|
|
|
|
|
|
|
for (i = 0; i < msgQueue->msgCount; i++)
|
|
|
|
{
|
|
|
|
MSG * msg = &msgQueue->messages[pos].msg;
|
|
|
|
|
|
|
|
if (!hwnd || (msg->hwnd == hwnd))
|
|
|
|
{
|
|
|
|
if (!first && !last) return pos;
|
|
|
|
if ((msg->message >= first) && (msg->message <= last)) return pos;
|
|
|
|
}
|
|
|
|
if (pos < msgQueue->queueSize-1) pos++;
|
|
|
|
else pos = 0;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* QUEUE_RemoveMsg
|
|
|
|
*
|
|
|
|
* Remove a message from the queue (pos must be a valid position).
|
|
|
|
*/
|
|
|
|
void QUEUE_RemoveMsg( MESSAGEQUEUE * msgQueue, int pos )
|
|
|
|
{
|
|
|
|
if (pos >= msgQueue->nextMessage)
|
|
|
|
{
|
|
|
|
for ( ; pos > msgQueue->nextMessage; pos--)
|
|
|
|
msgQueue->messages[pos] = msgQueue->messages[pos-1];
|
|
|
|
msgQueue->nextMessage++;
|
|
|
|
if (msgQueue->nextMessage >= msgQueue->queueSize)
|
|
|
|
msgQueue->nextMessage = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for ( ; pos < msgQueue->nextFreeMessage; pos++)
|
|
|
|
msgQueue->messages[pos] = msgQueue->messages[pos+1];
|
|
|
|
if (msgQueue->nextFreeMessage) msgQueue->nextFreeMessage--;
|
|
|
|
else msgQueue->nextFreeMessage = msgQueue->queueSize-1;
|
|
|
|
}
|
|
|
|
msgQueue->msgCount--;
|
|
|
|
if (!msgQueue->msgCount) msgQueue->status &= ~QS_POSTMESSAGE;
|
|
|
|
msgQueue->tempStatus = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* hardware_event
|
|
|
|
*
|
|
|
|
* Add an event to the system message queue.
|
|
|
|
* Note: the position is relative to the desktop window.
|
|
|
|
*/
|
|
|
|
void hardware_event( WORD message, WORD wParam, LONG lParam,
|
|
|
|
int xPos, int yPos, DWORD time, DWORD extraInfo )
|
|
|
|
{
|
|
|
|
MSG *msg;
|
|
|
|
int pos;
|
|
|
|
|
|
|
|
if (!sysMsgQueue) return;
|
|
|
|
pos = sysMsgQueue->nextFreeMessage;
|
|
|
|
|
|
|
|
/* Merge with previous event if possible */
|
|
|
|
|
|
|
|
if ((message == WM_MOUSEMOVE) && sysMsgQueue->msgCount)
|
|
|
|
{
|
|
|
|
if (pos > 0) pos--;
|
|
|
|
else pos = sysMsgQueue->queueSize - 1;
|
|
|
|
msg = &sysMsgQueue->messages[pos].msg;
|
|
|
|
if ((msg->message == message) && (msg->wParam == wParam))
|
|
|
|
sysMsgQueue->msgCount--; /* Merge events */
|
|
|
|
else
|
|
|
|
pos = sysMsgQueue->nextFreeMessage; /* Don't merge */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if queue is full */
|
|
|
|
|
|
|
|
if ((pos == sysMsgQueue->nextMessage) && sysMsgQueue->msgCount)
|
|
|
|
{
|
|
|
|
/* Queue is full, beep (but not on every mouse motion...) */
|
|
|
|
if (message != WM_MOUSEMOVE) MessageBeep(0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Store message */
|
|
|
|
|
|
|
|
msg = &sysMsgQueue->messages[pos].msg;
|
|
|
|
msg->hwnd = 0;
|
|
|
|
msg->message = message;
|
|
|
|
msg->wParam = wParam;
|
|
|
|
msg->lParam = lParam;
|
|
|
|
msg->time = time;
|
|
|
|
msg->pt.x = xPos & 0xffff;
|
|
|
|
msg->pt.y = yPos & 0xffff;
|
|
|
|
sysMsgQueue->messages[pos].extraInfo = extraInfo;
|
|
|
|
if (pos < sysMsgQueue->queueSize - 1) pos++;
|
|
|
|
else pos = 0;
|
|
|
|
sysMsgQueue->nextFreeMessage = pos;
|
|
|
|
sysMsgQueue->msgCount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* QUEUE_GetQueueTask
|
|
|
|
*/
|
|
|
|
HTASK QUEUE_GetQueueTask( HQUEUE hQueue )
|
|
|
|
{
|
|
|
|
MESSAGEQUEUE *queue = GlobalLock( hQueue );
|
|
|
|
return (queue) ? queue->hTask : 0 ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* QUEUE_IncPaintCount
|
|
|
|
*/
|
|
|
|
void QUEUE_IncPaintCount( HQUEUE hQueue )
|
|
|
|
{
|
|
|
|
MESSAGEQUEUE *queue;
|
|
|
|
|
|
|
|
if (!(queue = (MESSAGEQUEUE *)GlobalLock( hQueue ))) return;
|
|
|
|
queue->wPaintCount++;
|
|
|
|
queue->status |= QS_PAINT;
|
|
|
|
queue->tempStatus |= QS_PAINT;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* QUEUE_DecPaintCount
|
|
|
|
*/
|
|
|
|
void QUEUE_DecPaintCount( HQUEUE hQueue )
|
|
|
|
{
|
|
|
|
MESSAGEQUEUE *queue;
|
|
|
|
|
|
|
|
if (!(queue = (MESSAGEQUEUE *)GlobalLock( hQueue ))) return;
|
|
|
|
queue->wPaintCount--;
|
|
|
|
if (!queue->wPaintCount) queue->status &= ~QS_PAINT;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* QUEUE_IncTimerCount
|
|
|
|
*/
|
|
|
|
void QUEUE_IncTimerCount( HQUEUE hQueue )
|
|
|
|
{
|
|
|
|
MESSAGEQUEUE *queue;
|
|
|
|
|
|
|
|
if (!(queue = (MESSAGEQUEUE *)GlobalLock( hQueue ))) return;
|
|
|
|
queue->wTimerCount++;
|
|
|
|
queue->status |= QS_TIMER;
|
|
|
|
queue->tempStatus |= QS_TIMER;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* QUEUE_DecTimerCount
|
|
|
|
*/
|
|
|
|
void QUEUE_DecTimerCount( HQUEUE hQueue )
|
|
|
|
{
|
|
|
|
MESSAGEQUEUE *queue;
|
|
|
|
|
|
|
|
if (!(queue = (MESSAGEQUEUE *)GlobalLock( hQueue ))) return;
|
|
|
|
queue->wTimerCount--;
|
|
|
|
if (!queue->wTimerCount) queue->status &= ~QS_TIMER;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PostQuitMessage (USER.6)
|
|
|
|
*/
|
|
|
|
void PostQuitMessage( INT exitCode )
|
|
|
|
{
|
|
|
|
MESSAGEQUEUE *queue;
|
|
|
|
|
|
|
|
if (!(queue = (MESSAGEQUEUE *)GlobalLock( GetTaskQueue(0) ))) return;
|
|
|
|
queue->wPostQMsg = TRUE;
|
|
|
|
queue->wExitCode = (WORD)exitCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetWindowTask (USER.224)
|
|
|
|
*/
|
|
|
|
HTASK GetWindowTask( HWND hwnd )
|
|
|
|
{
|
|
|
|
WND *wndPtr = WIN_FindWndPtr( hwnd );
|
|
|
|
|
|
|
|
if (!wndPtr) return 0;
|
|
|
|
return QUEUE_GetQueueTask( wndPtr->hmemTaskQ );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SetMessageQueue (USER.266)
|
|
|
|
*/
|
|
|
|
BOOL SetMessageQueue( int size )
|
|
|
|
{
|
|
|
|
HQUEUE hQueue, hNewQueue;
|
|
|
|
MESSAGEQUEUE *queuePtr;
|
|
|
|
|
Release 960428
Sun Apr 28 14:32:43 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [Makefile.in]
Subdir memory is now also compiled for Winelib, in order to get
the Win32 heap functions.
* [if1632/Makefile.in]
Renamed winprocs and winprocs32 to wprocs and wprocs32 to avoid
DLL names > 8 characters.
* [loader/builtin.c] (New file)
Grouped all built-in DLLs code in a single file.
* [memory/global.c]
Use the Win32 heap code instead of malloc() to allocate linear
memory. This will help test the heap code.
* [memory/local.c]
Fixed FreeSelector() to clear DS and ES correctly for huge blocks.
* [tools/build.c] [if1632/relay.c]
Removed 'id' directive in spec files. For relay debugging, the DLL
entry point is now computed from the CS:IP entry point address.
Added 'heap' directive to specifiy a local heap for the DLL. USER
and GDI heap are now created this way.
* [windows/class.c] [include/class.h]
Changed the class structure to use pointers instead of handles.
Changed Get/SetClassWord/Long to use a switch statement; this
allows changing the layout of the CLASS structure.
* [windows/win.c] [include/win.h]
Use a CLASS * instead of a handle for the window class.
Sat Apr 27 18:10:11 Martin von Loewis <loewis@informatik.hu-berlin.de>
* [if1632/kernel32.spec] [memory/global.c]
[win32/memory.c] [win32/process.c]
GetProcessAffinityMask,GlobalLock,IsBadReadPtr,IsBadWritePtr,
LocalLock,SetThreadAffinityMask: new relays.
* [win32/cursoricon32.c]
Return same handle if a cursor is loaded multiple times.
Sat Apr 27 15:13:37 1996 Bang Jun Young <bangjy@nownuri.nowcom.co.kr>
* [resources/sysres_Ko.rc]
Added support for Korean [Ko] language.
Fri Apr 26 00:49:05 1996 Huw D. M. Davies <h.davies1@physics.oxford.ac.uk>
* [objects/dc.c] [objects/font.c]
Fixed problem with SaveDC()/RestoreDC() and font cache 'used' count.
* [objects/metafile.c] [objects/dcvalues.c]
Fixed broken SetTextAlign() on metafiles.
* [objects/metafile.c]
Delete objects in handle table at end of PlayMetaFile().
Wed Apr 24 19:21:01 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [if1632/ver.spec] [misc/ver.c] [include/ver.h] (New files)
VER.DLL (partially) implemented (VerFindFile,VerInstallFile)
[If it doesn't work for you, use -dll -ver and report it to me]
* [if1632/user32.spec] [if1632/kernel32.spec] [if1632/shell.spec]
[if1632/shell32.spec] [misc/ole2nls.c] [windows/message.c]
[windows/graphics.c]
Simple win32 functions, where we can just use the win16 counterpart.
Misc. stubs.
* [misc/lstr.c]
Someone reported a _lstrlen(NULL). NULL is a valid argument. Fixed.
* [misc/registry.c]
Some alloclens were off by 1, one double fclose() fixed.
Requesting value 0 of a key with no values returns an error
(should we always return a made up value NULL? what does win3.1?)
Tue Apr 23 17:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu>
* [misc/shell.c]
Implemented FindEnvironmentString(), DoEnvironmentSubst(),
ExtractIcon(), InternalExtractIcon() and ExtractAssociatedIcon().
* [misc/user.c]
Do extensive cleanup on application exit.
* [windows/hook.c] [windows/win.c] [windows/class.c]
Added miscellaneous cleanup routines.
* [controls/menu.c]
More efficient popup menu window handling.
Mon Apr 22 21:35:22 1996 Albrecht Kleine <kleine@ak.sax.de>
* [include/windows.h][objects/oembitmap.c][include/bitmaps/obm_trtype]
Added "TT-bitmap" for later usage in a ChooseFont() ownerdraw combobox.
1996-04-28 17:09:19 +02:00
|
|
|
dprintf_msg(stddeb,"SetMessageQueue: task %04x size %i\n", GetCurrentTask(), size);
|
|
|
|
|
1996-03-14 19:08:34 +01:00
|
|
|
if ((size > MAX_QUEUE_SIZE) || (size <= 0)) return TRUE;
|
|
|
|
|
|
|
|
if( !(hNewQueue = QUEUE_CreateMsgQueue( size )))
|
|
|
|
{
|
|
|
|
dprintf_msg(stddeb,"SetMessageQueue: failed!\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free the old message queue */
|
|
|
|
if ((hQueue = GetTaskQueue(0)) != 0) QUEUE_DeleteMsgQueue( hQueue );
|
|
|
|
|
|
|
|
/* Link new queue into list */
|
|
|
|
queuePtr = (MESSAGEQUEUE *)GlobalLock( hNewQueue );
|
|
|
|
queuePtr->hTask = GetCurrentTask();
|
|
|
|
queuePtr->next = hFirstQueue;
|
|
|
|
hFirstQueue = hNewQueue;
|
|
|
|
|
|
|
|
SetTaskQueue( 0, hNewQueue );
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetQueueStatus (USER.334)
|
|
|
|
*/
|
|
|
|
DWORD GetQueueStatus( UINT flags )
|
|
|
|
{
|
|
|
|
MESSAGEQUEUE *queue;
|
|
|
|
DWORD ret;
|
|
|
|
|
|
|
|
if (!(queue = (MESSAGEQUEUE *)GlobalLock( GetTaskQueue(0) ))) return 0;
|
|
|
|
ret = MAKELONG( queue->tempStatus, queue->status );
|
|
|
|
queue->tempStatus = 0;
|
|
|
|
return ret & MAKELONG( flags, flags );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetInputState (USER.335)
|
|
|
|
*/
|
|
|
|
BOOL GetInputState()
|
|
|
|
{
|
|
|
|
MESSAGEQUEUE *queue;
|
|
|
|
|
|
|
|
if (!(queue = (MESSAGEQUEUE *)GlobalLock( GetTaskQueue(0) ))) return FALSE;
|
|
|
|
return queue->status & (QS_KEY | QS_MOUSEBUTTON);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetMessagePos (USER.119)
|
|
|
|
*/
|
|
|
|
DWORD GetMessagePos(void)
|
|
|
|
{
|
|
|
|
MESSAGEQUEUE *queue;
|
|
|
|
|
|
|
|
if (!(queue = (MESSAGEQUEUE *)GlobalLock( GetTaskQueue(0) ))) return 0;
|
|
|
|
return queue->GetMessagePosVal;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetMessageTime (USER.120)
|
|
|
|
*/
|
|
|
|
LONG GetMessageTime(void)
|
|
|
|
{
|
|
|
|
MESSAGEQUEUE *queue;
|
|
|
|
|
|
|
|
if (!(queue = (MESSAGEQUEUE *)GlobalLock( GetTaskQueue(0) ))) return 0;
|
|
|
|
return queue->GetMessageTimeVal;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetMessageExtraInfo (USER.288)
|
|
|
|
*/
|
|
|
|
LONG GetMessageExtraInfo(void)
|
|
|
|
{
|
|
|
|
MESSAGEQUEUE *queue;
|
|
|
|
|
|
|
|
if (!(queue = (MESSAGEQUEUE *)GlobalLock( GetTaskQueue(0) ))) return 0;
|
|
|
|
return queue->GetMessageExtraInfoVal;
|
|
|
|
}
|