mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-02 13:27:35 +00:00
7cc9c0cefe
Tue Jun 14 08:09:14 1994 Bob Amstadt (bob@pooh) * loader/selector.c (GetCurrentPDB): Added trivial function GetCurrentPDB() which returns the program segment prefix selector. * memory/heap.c (HEAP_Free): If free list is empty, make the freed block the free list. Fri Jun 10 07:56:49 1994 Bob Amstadt (bob@pooh) * controls/edit.c (EDIT_SetTextMsg): Do not append a newline at the end of the last line. * windows/event.c (SetCapture): Set winHasCursor if mouse capture succeeds. Jun 13, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [controls/listbox.c] Fix bug in listbox : InsertString should call AddString if -1. * [controls/menu.c] New function GetMenuState(). * [controls/scroll.c] [windows/nonclient.c] Try to make ShowScrollBar() recalc NC_ regions. Not finished ! * [objects/text.c] Add Stub for TabbedTextOut(), which temporarely call Textout(). * [windows/keyboard.c] [windows/event.c] New function GetKeyBoardState() with an KeyStateTable array & associated handling in function EVENT_key(). Mon Jun 13 16:45:24 MET DST 1994 (erik@hacktic.nl) * [controls/menu.c] IsMenu() added. * [loader/library.c] ModuleFirst(), ModuleNext(), ModuleFindName(), ModuleFindHandle() added. * [object/gdiobj.c] IsGDIObject() added. * [miscemu/int2[56].c] bugfix: both didn't leave flags pushed on 16bit-stack. (winfile gets a bit further) * [miscemu/int16.c] Added (empty). Sat Jun 11 22:56:48 1994 Jon Tombs (jon@esix2.us.es) * windows/event.c: Added code to drop redundant motion Events in the XEvent queue. Thu Jun 9 10:55:55 MET DST 1994 Jochen Hein ( Hein@Student.TU-Clausthal.de ) * [misc/main.c misc/message.c include/texts.h] Removed the text-constants from message.c into variables which may be changed from X-resources. * [misc/main.c misc/message.c] added <locale.h> and setlocale() to main.c, used toupper() in message.c Mon, 13 Jun 94 09:41:16 -0500 Paul Bramel <paulbr@comm.mot.com> * controls/button.c ( [CR]B_LButton* ) left rc.right at full window width so click on label also activates the control (MSWin behavior) Sat Jun 11 19:05:40 1994 Olaf Flebbe (flebbe@tat.physik.uni-tuebingen.de) * include/windows.h: functions pointers can not be packed. (annoying warnings with forthcomming gcc-2.6.x) * loader/main.c (InitDLL): Fixed a printf statement. (for control.exe) (InitializeLoadedDLLs): deleted shadow definition of *wpnt. (Breaks many programs, because now COMMDLG will be initialized :-( * windows/win.c (SetWindowText): added missing breaks; (PENSATE starts) * windows/graphics.c (FloodFill): Proper boundarys. (BANGBANG starts) FloodFile_rec should be rewritten. * objects/font.c (FONT_GetMetrics): TYPO: use font->perchar only if it is defined. (WRITE starts) Sun June 12, Peter Broadhurst (pbr@ua.nwl.ac.uk) controls/scroll.c: Fixes for improved behaviour when dragging thumb; Added SB_THUMBPOSITION message when thumb is released.
248 lines
6.1 KiB
C
248 lines
6.1 KiB
C
/*
|
|
* Tasks functions
|
|
*/
|
|
static char Copyright[] = "Copyright Martin Ayotte, 1994";
|
|
|
|
/*
|
|
#define DEBUG_TASK
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include "windows.h"
|
|
#include "wine.h"
|
|
#include "task.h"
|
|
|
|
static LPWINETASKENTRY lpTaskList = NULL;
|
|
static int nTaskCount = 0;
|
|
|
|
|
|
/**********************************************************************
|
|
* GetCurrentTask [KERNEL.36]
|
|
*/
|
|
HTASK GetCurrentTask()
|
|
{
|
|
LPWINETASKENTRY lpTask = lpTaskList;
|
|
int pid = getpid();
|
|
#ifdef DEBUG_TASK
|
|
printf("GetCurrentTask() // unix_pid=%08X !\n", pid);
|
|
#endif
|
|
if (lpTask == NULL) return 0;
|
|
while (TRUE) {
|
|
if (lpTask->unix_pid == pid) break;
|
|
if (lpTask->lpNextTask == NULL) return 0;
|
|
lpTask = lpTask->lpNextTask;
|
|
}
|
|
#ifdef DEBUG_TASK
|
|
printf("GetCurrentTask() returned hTask=%04X !\n", lpTask->te.hTask);
|
|
#endif
|
|
return lpTask->te.hTask;
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* GetNumTasks [KERNEL.152]
|
|
*/
|
|
WORD GetNumTasks()
|
|
{
|
|
printf("GetNumTasks() returned %d !\n", nTaskCount);
|
|
return nTaskCount;
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* GetWindowTask [USER.224]
|
|
*/
|
|
HTASK GetWindowTask(HWND hWnd)
|
|
{
|
|
HWND *wptr;
|
|
int count;
|
|
LPWINETASKENTRY lpTask = lpTaskList;
|
|
printf("GetWindowTask(%04X) !\n", hWnd);
|
|
while (lpTask != NULL) {
|
|
wptr = lpTask->lpWndList;
|
|
if (wptr != NULL) {
|
|
count = 0;
|
|
while (++count < MAXWIN_PER_TASK) {
|
|
printf("GetWindowTask // searching %04X %04X !\n",
|
|
lpTask->te.hTask, *(wptr));
|
|
if (*(wptr) == hWnd) {
|
|
printf("GetWindowTask(%04X) found hTask=%04X !\n",
|
|
hWnd, lpTask->te.hTask);
|
|
return lpTask->te.hTask;
|
|
}
|
|
wptr++;
|
|
}
|
|
}
|
|
lpTask = lpTask->lpNextTask;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* EnumTaskWindows [USER.225]
|
|
*/
|
|
BOOL EnumTaskWindows(HANDLE hTask, FARPROC lpEnumFunc, LONG lParam)
|
|
{
|
|
HWND *wptr, hWnd;
|
|
BOOL bRet;
|
|
int count = 0;
|
|
LPWINETASKENTRY lpTask = lpTaskList;
|
|
printf("EnumTaskWindows(%04X, %08X, %08X) !\n", hTask, lpEnumFunc, lParam);
|
|
while (TRUE) {
|
|
if (lpTask->te.hTask == hTask) break;
|
|
if (lpTask == NULL) {
|
|
printf("EnumTaskWindows // hTask=%04X not found !\n", hTask);
|
|
return FALSE;
|
|
}
|
|
lpTask = lpTask->lpNextTask;
|
|
}
|
|
printf("EnumTaskWindows // found hTask=%04X !\n", hTask);
|
|
wptr = lpTask->lpWndList;
|
|
if (wptr == NULL) return FALSE;
|
|
if (lpEnumFunc == NULL) return FALSE;
|
|
while ((hWnd = *(wptr++)) != 0) {
|
|
if (++count >= MAXWIN_PER_TASK) return FALSE;
|
|
printf("EnumTaskWindows // hWnd=%04X count=%d !\n", hWnd, count);
|
|
#ifdef WINELIB
|
|
bRet = (*lpEnumFunc)(hWnd, lParam);
|
|
#else
|
|
bRet = CallBack16(lpEnumFunc, 2, 0, (int)hWnd, 2, (int)lParam);
|
|
#endif
|
|
if (bRet == 0) break;
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* CreateNewTask [internal]
|
|
*/
|
|
HANDLE CreateNewTask(HINSTANCE hInst, HTASK hTaskParent)
|
|
{
|
|
HANDLE hTask;
|
|
LPWINETASKENTRY lpTask = lpTaskList;
|
|
LPWINETASKENTRY lpNewTask;
|
|
if (lpTask != NULL) {
|
|
while (TRUE) {
|
|
if (lpTask->lpNextTask == NULL) break;
|
|
lpTask = lpTask->lpNextTask;
|
|
}
|
|
}
|
|
hTask = GlobalAlloc(GMEM_MOVEABLE, sizeof(WINETASKENTRY));
|
|
lpNewTask = (LPWINETASKENTRY) GlobalLock(hTask);
|
|
#ifdef DEBUG_TASK
|
|
printf("CreateNewTask entry allocated %08X\n", lpNewTask);
|
|
#endif
|
|
if (lpNewTask == NULL) return 0;
|
|
if (lpTaskList == NULL) {
|
|
lpTaskList = lpNewTask;
|
|
lpNewTask->lpPrevTask = NULL;
|
|
}
|
|
else {
|
|
lpTask->lpNextTask = lpNewTask;
|
|
lpTask->te.hNext = lpNewTask->te.hTask;
|
|
lpNewTask->lpPrevTask = lpTask;
|
|
}
|
|
lpNewTask->lpNextTask = NULL;
|
|
lpNewTask->hIcon = 0;
|
|
lpNewTask->te.dwSize = sizeof(TASKENTRY);
|
|
lpNewTask->te.hModule = 0;
|
|
lpNewTask->te.hInst = hInst;
|
|
lpNewTask->te.hTask = hTask;
|
|
lpNewTask->te.hTaskParent = hTaskParent;
|
|
lpNewTask->te.wSS = 0;
|
|
lpNewTask->te.wSP = 0;
|
|
lpNewTask->te.wStackTop = 0;
|
|
lpNewTask->te.wStackMinimum = 0;
|
|
lpNewTask->te.wStackBottom = 0;
|
|
lpNewTask->te.wcEvents = 0;
|
|
lpNewTask->te.hQueue = 0;
|
|
sprintf(lpNewTask->te.szModule, "TASK%04X", hInst);
|
|
lpNewTask->te.wPSPOffset = 0;
|
|
lpNewTask->unix_pid = getpid();
|
|
lpNewTask->lpWndList = (HWND *) malloc(MAXWIN_PER_TASK * sizeof(HWND));
|
|
if (lpNewTask->lpWndList != NULL)
|
|
memset((LPSTR)lpNewTask->lpWndList, 0, MAXWIN_PER_TASK * sizeof(HWND));
|
|
#ifdef DEBUG_TASK
|
|
printf("CreateNewTask // unix_pid=%08X return hTask=%04X\n",
|
|
lpNewTask->unix_pid, hTask);
|
|
#endif
|
|
GlobalUnlock(hTask);
|
|
nTaskCount++;
|
|
return hTask;
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* AddWindowToTask [internal]
|
|
*/
|
|
BOOL AddWindowToTask(HTASK hTask, HWND hWnd)
|
|
{
|
|
HWND *wptr;
|
|
int count = 0;
|
|
LPWINETASKENTRY lpTask = lpTaskList;
|
|
#ifdef DEBUG_TASK
|
|
printf("AddWindowToTask(%04X, %04X); !\n", hTask, hWnd);
|
|
#endif
|
|
while (TRUE) {
|
|
if (lpTask->te.hTask == hTask) break;
|
|
if (lpTask == NULL) {
|
|
printf("AddWindowToTask // hTask=%04X not found !\n", hTask);
|
|
return FALSE;
|
|
}
|
|
lpTask = lpTask->lpNextTask;
|
|
}
|
|
wptr = lpTask->lpWndList;
|
|
if (wptr == NULL) return FALSE;
|
|
while (*(wptr) != 0) {
|
|
if (++count >= MAXWIN_PER_TASK) return FALSE;
|
|
wptr++;
|
|
}
|
|
*wptr = hWnd;
|
|
#ifdef DEBUG_TASK
|
|
printf("AddWindowToTask // window added, count=%d !\n", count);
|
|
#endif
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* RemoveWindowFromTask [internal]
|
|
*/
|
|
BOOL RemoveWindowFromTask(HTASK hTask, HWND hWnd)
|
|
{
|
|
HWND *wptr;
|
|
int count = 0;
|
|
LPWINETASKENTRY lpTask = lpTaskList;
|
|
#ifdef DEBUG_TASK
|
|
printf("RemoveWindowToTask(%04X, %04X); !\n", hTask, hWnd);
|
|
#endif
|
|
while (TRUE) {
|
|
if (lpTask->te.hTask == hTask) break;
|
|
if (lpTask == NULL) {
|
|
printf("RemoveWindowFromTask // hTask=%04X not found !\n", hTask);
|
|
return FALSE;
|
|
}
|
|
lpTask = lpTask->lpNextTask;
|
|
}
|
|
wptr = lpTask->lpWndList;
|
|
if (wptr == NULL) return FALSE;
|
|
while (*(wptr) != hWnd) {
|
|
if (++count >= MAXWIN_PER_TASK) return FALSE;
|
|
wptr++;
|
|
}
|
|
while (*(wptr) != 0) {
|
|
*(wptr) = *(wptr + 1);
|
|
if (++count >= MAXWIN_PER_TASK) return FALSE;
|
|
wptr++;
|
|
}
|
|
#ifdef DEBUG_TASK
|
|
printf("RemoveWindowFromTask // window removed, count=%d !\n", --count);
|
|
#endif
|
|
return TRUE;
|
|
}
|
|
|
|
|