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

Release 940804

Thu Aug 4 07:18:02 1994 Michael Patra <micky@marie.physik.tu-berlin.de> * [windows/message.c] Implemented WaitMessage() (USER.112). * [if1632/user.spec] Added WaitMessage. * [windows/defwnd.c] WM_ERASEBKGND: Added support for hbrBackground=COLOR_xxx. * [miscemu/int{13,21,2a}.c] * [miscemu/Imakefile] * [signal/loader.c] Added a few basic disk information and diagnostic functions to prevent programs using this function from crashing. All drives are claimed to be remote ones, so direct I/O isn't allowed. * [controls/edit.c] EDIT_WriteText(): Added code to correctly erase the remaining space of the edit-control if the size of the control has changed sinced it's creation. Tue Jul 26 22:05:54 MET DST 1994 Erik Bos <erik@hacktic.nl> * [if1632/mouse.spec] Added mouse.dll entry, no functions. * [loader/resource.c] Bug fix in AccessResource(). * [misc/keyboard.c], added [include/keyboard.h] Changed functions to return more useful values. * [windows/dialog.c] Hacked DIALOG_GetControl() to support resources which have 0xff00 - 0xffff as id. ** Needs to be done properly by someone who knows the NE fileformat ** Jul 29, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [windows/event.c] Add new stub for EnableHGardwareInput() function. * [windows/message.c] Add coding for HWND_BROADCAST in PostMessage(). * [misc/file.c] Add coding for OpenFile() also search in WindowPaths. * [misc/mmsystem.c] * [misc/audio.c] * [misc/mmaux.c] * [misc/mcicda.c] Change #include "linux/soundcard.h" by #include "sys/soundcard.h" Add coding in MMIO functions. Now, mmioDescend() can find WAV chunks. SndPlaySound & MCI_ELEMENT now use MMIO and adjust to proper formats.
parent f7207259
----------------------------------------------------------------------
Thu Aug 4 07:18:02 1994 Michael Patra <micky@marie.physik.tu-berlin.de>
* [windows/message.c]
Implemented WaitMessage() (USER.112).
* [if1632/user.spec]
Added WaitMessage.
* [windows/defwnd.c]
WM_ERASEBKGND: Added support for hbrBackground=COLOR_xxx.
* [miscemu/int{13,21,2a}.c]
* [miscemu/Imakefile]
* [signal/loader.c]
Added a few basic disk information and diagnostic functions to
prevent programs using this function from crashing. All drives
are claimed to be remote ones, so direct I/O isn't allowed.
* [controls/edit.c]
EDIT_WriteText(): Added code to correctly erase the remaining space
of the edit-control if the size of the control has changed sinced it's
creation.
Tue Jul 26 22:05:54 MET DST 1994 Erik Bos <erik@hacktic.nl>
* [if1632/mouse.spec]
Added mouse.dll entry, no functions.
* [loader/resource.c]
Bug fix in AccessResource().
* [misc/keyboard.c], added [include/keyboard.h]
Changed functions to return more useful values.
* [windows/dialog.c]
Hacked DIALOG_GetControl() to support resources which
have 0xff00 - 0xffff as id. ** Needs to be done properly by
someone who knows the NE fileformat **
Jul 29, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [windows/event.c]
Add new stub for EnableHGardwareInput() function.
* [windows/message.c]
Add coding for HWND_BROADCAST in PostMessage().
* [misc/file.c]
Add coding for OpenFile() also search in WindowPaths.
* [misc/mmsystem.c]
* [misc/audio.c]
* [misc/mmaux.c]
* [misc/mcicda.c]
Change #include "linux/soundcard.h" by #include "sys/soundcard.h"
Add coding in MMIO functions. Now, mmioDescend() can find WAV chunks.
SndPlaySound & MCI_ELEMENT now use MMIO and adjust to proper formats.
----------------------------------------------------------------------
Mon Jul 18 23:55:13 MET DST 1994
* [if1632/call.S]
......
......@@ -1026,6 +1026,14 @@ void EDIT_WriteText(HWND hwnd, char *lp, int off, int len, int row,
SetTextColor(hdc, oldBkgdColor);
}
if (strlen(blanks) < (ClientWidth(wndPtr) / charWidths[32]) + 2)
{
es->hBlankLine = EDIT_HeapReAlloc(hwnd, es->hBlankLine,
(ClientWidth(wndPtr) / charWidths[32]) + 2);
blanks = EDIT_HeapAddr(hwnd, es->hBlankLine);
memset(blanks, ' ', (ClientWidth(wndPtr) / charWidths[32]) + 2);
}
if (!(cp = strchr(str, VK_TAB)))
TextOut(hdc, col - diff, row * es->txtht, str, strlen(str));
else
......
......@@ -292,7 +292,7 @@ static LONG PaintIconfn(HWND hwnd)
GetClientRect(hwnd, &rc);
FillRect(hdc, &rc, GetStockObject(WHITE_BRUSH));
textPtr = (LPSTR)USER_HEAP_ADDR(wndPtr->hText);
printf("SS_ICON : textPtr='%s' / left=%d top=%d right=%d bottom=%d \n",
printf("SS_ICON : textPtr='%8x' / left=%d top=%d right=%d bottom=%d \n",
textPtr, rc.left, rc.top, rc.right, rc.bottom);
/*
SetWindowPos(hwnd, (HWND)NULL, 0, 0, 32, 32,
......
......@@ -147,11 +147,11 @@ static int loaded_symbols = 0;
void
wine_debug(int signal, int * regs)
{
static int dummy_regs[32];
int i;
#ifdef YYDEBUG
yydebug = 0;
#endif
static int dummy_regs[32];
yyin = stdin;
regval = regs ? regs : dummy_regs;
......
......@@ -19,6 +19,7 @@ DLLOBJS = \
dll_kernel.o \
dll_keyboard.o \
dll_mmsystem.o \
dll_mouse.o \
dll_shell.o \
dll_sound.o \
dll_stress.o \
......@@ -49,6 +50,7 @@ MakeDllFromSpec(kernel,$(TOP)/$(MODULE))
MakeDllFromSpec(keyboard,$(TOP)/$(MODULE))
MakeDllFromSpec(shell,$(TOP)/$(MODULE))
MakeDllFromSpec(mmsystem,$(TOP)/$(MODULE))
MakeDllFromSpec(mouse,$(TOP)/$(MODULE))
MakeDllFromSpec(sound,$(TOP)/$(MODULE))
MakeDllFromSpec(stress,$(TOP)/$(MODULE))
MakeDllFromSpec(system,$(TOP)/$(MODULE))
......
name mouse
id 14
length 8
#1 pascal INQUIRE
#2 pascal ENABLE
#3 pascal DISABLE
#4 pascal MOUSEGETINTVECT
#5 pascal GETSETMOUSEDATA
#6 pascal CPLAPPLET
#7 pascal POWEREVENTPROC
......@@ -45,6 +45,7 @@ struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] =
{ "MMSYSTEM",WineLibSkip(MMSYSTEM_table),1226,11},
{ "SYSTEM", WineLibSkip(SYSTEM_table), 20 ,12},
{ "TOOLHELP",WineLibSkip(TOOLHELP_table), 83, 13},
{ "MOUSE", WineLibSkip(MOUSE_table), 8, 14},
};
/* don't forget to increase N_BUILTINS in dll.h if you add a dll */
......
......@@ -115,7 +115,7 @@ length 540
109 pascal PeekMessage(ptr word word word word) PeekMessage(1 2 3 4 5)
110 pascal PostMessage(word word word long) PostMessage(1 2 3 4)
111 pascal SendMessage(word word word long) SendMessage(1 2 3 4)
#112 WAITMESSAGE
112 pascal WaitMessage() WaitMessage()
113 pascal TranslateMessage(ptr) TranslateMessage(1)
114 pascal DispatchMessage(ptr) DispatchMessage(1)
#115 REPLYMESSAGE
......@@ -261,13 +261,13 @@ length 540
248 pascal GetOpenClipboardWindow() GetOpenClipboardWindow()
249 pascal GetAsyncKeyState(word) GetAsyncKeyState(1)
250 pascal GetMenuState(word word word) GetMenuState(1 2 3)
#251 SENDDRIVERMESSAGE
#252 OPENDRIVER
#253 CLOSEDRIVER
#254 GETDRIVERMODULEHANDLE
#255 DEFDRIVERPROC
#256 GETDRIVERINFO
#257 GETNEXTDRIVER
251 pascal SendDriverMessage(word word long long) SendDriverMessage(1 2 3 4)
252 pascal OpenDriver(ptr ptr long) OpenDriver(1 2 3)
253 pascal CloseDriver(word word long) CloseDriver(1 2 3)
254 pascal GetDriverModuleHandle(word) GetDriverModuleHandle(1)
255 pascal DefDriverProc(long word word long long) DefDriverProc(1 2 3 4 5)
256 pascal GetDriverInfo(word ptr) GetDriverInfo(1 2)
257 pascal GetNextDriver(word long) GetNextDriver(1 2)
258 pascal MapWindowPoints(word word ptr word) MapWindowPoints(1 2 3 4)
#259 BEGINDEFERWINDOWPOS
#260 DEFERWINDOWPOS
......@@ -319,7 +319,7 @@ length 540
324 pascal FillWindow(word word word word) FillWindow(1 2 3 4)
325 pascal PaintRect(word word word word ptr) PaintRect(1 2 3 4 5)
#326 GETCONTROLBRUSH
#331 ENABLEHARDWAREINPUT
331 pascal EnableHardwareInput(word) EnableHardwareInput(1)
332 return UserYield 0 0
#333 ISUSERIDLE
334 pascal GetQueueStatus(word) GetQueueStatus(1)
......
......@@ -96,7 +96,8 @@ extern struct dll_table_entry_s WINSOCK_table[];
extern struct dll_table_entry_s STRESS_table[];
extern struct dll_table_entry_s SYSTEM_table[];
extern struct dll_table_entry_s TOOLHELP_table[];
extern struct dll_table_entry_s MOUSE_table[];
#define N_BUILTINS 13
#define N_BUILTINS 14
#endif /* DLLS_H */
#ifndef __WINE_KEYBOARD_H
#define __WINE_KEYBOARD_H
struct KeyTableEntry {
int virtualkey;
int ASCII;
int scancode;
char *name;
};
struct KeyTableEntry KeyTable[] = {
{ 0x3, 0x3, 0x0, "" },
{ 0x8, 0x8, 0xe, "Backspace" },
{ 0x9, 0x9, 0xf, "Tab" },
{ 0xc, 0x0, 0x4c, "Num 5" },
{ 0xd, 0xd, 0x1c, "Enter" },
{ 0x10, 0x0, 0x2a, "Shift" },
{ 0x11, 0x0, 0x1d, "Ctrl" },
{ 0x12, 0x0, 0x38, "Alt" },
{ 0x14, 0x0, 0x3a, "Caps Lock" },
{ 0x1b, 0x1b, 0x1, "Esc" },
{ 0x20, 0x20, 0x39, "Space" },
{ 0x21, 0x0, 0x49, "Num 9" },
{ 0x22, 0x0, 0x51, "Num 3" },
{ 0x23, 0x0, 0x4f, "Num 1" },
{ 0x24, 0x0, 0x47, "Num 7" },
{ 0x25, 0x0, 0x4b, "Num 4" },
{ 0x26, 0x0, 0x48, "Num 8" },
{ 0x27, 0x0, 0x4d, "Num 6" },
{ 0x28, 0x0, 0x50, "Num 2" },
{ 0x2d, 0x0, 0x52, "Num 0" },
{ 0x2e, 0x0, 0x53, "Num Del" },
{ 0x30, 0x30, 0xb, "0" },
{ 0x31, 0x31, 0x2, "1" },
{ 0x32, 0x32, 0x3, "2" },
{ 0x33, 0x33, 0x4, "3" },
{ 0x34, 0x34, 0x5, "4" },
{ 0x35, 0x35, 0x6, "5" },
{ 0x36, 0x36, 0x7, "6" },
{ 0x37, 0x37, 0x8, "7" },
{ 0x38, 0x38, 0x9, "8" },
{ 0x39, 0x39, 0xa, "9" },
{ 0x41, 0x41, 0x1e, "A" },
{ 0x42, 0x42, 0x30, "B" },
{ 0x43, 0x43, 0x2e, "C" },
{ 0x44, 0x44, 0x20, "D" },
{ 0x45, 0x45, 0x12, "E" },
{ 0x46, 0x46, 0x21, "F" },
{ 0x47, 0x47, 0x22, "G" },
{ 0x48, 0x48, 0x23, "H" },
{ 0x49, 0x49, 0x17, "I" },
{ 0x4a, 0x4a, 0x24, "J" },
{ 0x4b, 0x4b, 0x25, "K" },
{ 0x4c, 0x4c, 0x26, "L" },
{ 0x4d, 0x4d, 0x32, "M" },
{ 0x4e, 0x4e, 0x31, "N" },
{ 0x4f, 0x4f, 0x18, "O" },
{ 0x50, 0x50, 0x19, "P" },
{ 0x51, 0x51, 0x10, "Q" },
{ 0x52, 0x52, 0x13, "R" },
{ 0x53, 0x53, 0x1f, "S" },
{ 0x54, 0x54, 0x14, "T" },
{ 0x55, 0x55, 0x16, "U" },
{ 0x56, 0x56, 0x2f, "V" },
{ 0x57, 0x57, 0x11, "W" },
{ 0x58, 0x58, 0x2d, "X" },
{ 0x59, 0x59, 0x15, "Y" },
{ 0x5a, 0x5a, 0x2c, "Z" },
{ 0x60, 0x0, 0x52, "Num 0" },
{ 0x61, 0x0, 0x4f, "Num 1" },
{ 0x62, 0x0, 0x50, "Num 2" },
{ 0x63, 0x0, 0x51, "Num 3" },
{ 0x64, 0x0, 0x4b, "Num 4" },
{ 0x65, 0x0, 0x4c, "Num 5" },
{ 0x66, 0x0, 0x4d, "Num 6" },
{ 0x67, 0x0, 0x47, "Num 7" },
{ 0x68, 0x0, 0x48, "Num 8" },
{ 0x69, 0x0, 0x49, "Num 9" },
{ 0x6a, 0x2a, 0x37, "Num *" },
{ 0x6b, 0x2b, 0x4e, "Num +" },
{ 0x6c, 0x0, 0x0, "" },
{ 0x6d, 0x2d, 0x4a, "Num -" },
{ 0x6e, 0x2e, 0x53, "Num Del" },
{ 0x6f, 0x2f, 0x0, "" },
{ 0x70, 0x0, 0x3b, "F1" },
{ 0x71, 0x0, 0x3c, "F2" },
{ 0x72, 0x0, 0x3d, "F3" },
{ 0x73, 0x0, 0x3e, "F4" },
{ 0x74, 0x0, 0x3f, "F5" },
{ 0x75, 0x0, 0x40, "F6" },
{ 0x76, 0x0, 0x41, "F7" },
{ 0x77, 0x0, 0x42, "F8" },
{ 0x78, 0x0, 0x43, "F9" },
{ 0x79, 0x0, 0x44, "F10" },
{ 0x7a, 0x0, 0x57, "F11" },
{ 0x7b, 0x0, 0x58, "F12" },
{ 0x90, 0x0, 0x45, "Pause" },
{ 0x91, 0x0, 0x46, "Scroll Lock" },
{ 0xba, 0x3b, 0x27, ";" },
{ 0xbb, 0x3d, 0xd, "=" },
{ 0xbc, 0x2c, 0x33, "," },
{ 0xbd, 0x2d, 0xc, "-" },
{ 0xbe, 0x2e, 0x34, "." },
{ 0xbf, 0x2f, 0x35, "/" },
{ 0xc0, 0x60, 0x29, "`" },
{ 0xdb, 0x5b, 0x1a, "[" },
{ 0xdc, 0x5c, 0x2b, "\\" },
{ 0xdd, 0x5d, 0x1b, "]" },
{ 0xde, 0x27, 0x28, "\'" },
{ 0xe2, 0x5c, 0x56, "\\" },
};
#define KeyTableSize sizeof(KeyTable) / sizeof(struct KeyTableEntry)
#endif /* __WINE_KEYBOARD_H */
......@@ -623,6 +623,10 @@ typedef MMCKINFO FAR *LPMMCKINFO;
#define MMIO_CREATERIFF 0x0020 /* mmioCreateChunk: make a LIST chunk */
#define MMIO_CREATELIST 0x0040 /* mmioCreateChunk: make a RIFF chunk */
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#define MMIOM_READ MMIO_READ /* read */
#define MMIOM_WRITE MMIO_WRITE /* write */
#define MMIOM_SEEK 2 /* seek to a new position in file */
......
......@@ -493,7 +493,7 @@ int GetRsrcCount(HINSTANCE hInst, int type_id)
off_t rtoff;
if (hInst == 0) return 0;
#ifdef DEBUG_RESOURCE
printf("GetRsrcCount hInst=%04X typename=%08X\n", hInst, type_name);
printf("GetRsrcCount hInst=%04X typename=%08X\n", hInst, type_id);
#endif
if (OpenResourceFile(hInst) < 0) return 0;
......@@ -978,7 +978,7 @@ int AccessResource(HANDLE instance, HANDLE hResInfo)
lseek(resfile, ((int) r->nameinfo.offset << r->size_shift), SEEK_SET);
GlobalUnlock(hResInfo);
return resfile;
return dup(resfile);
}
/**********************************************************************
......@@ -1049,9 +1049,9 @@ RSC_LoadResource(int instance, char *rsc_name, int type, int *image_size_ret)
}
if (size_shift == -1) {
if ((LONG)rsc_name >= 0x00010000L)
printf("RSC_LoadResource / Resource '%s' not Found !\n", rsc_name);
printf("RSC_LoadResource inst (%x)/ Resource '%s' not Found !\n", instance, rsc_name);
else
printf("RSC_LoadResource / Resource '%X' not Found !\n", rsc_name);
printf("RSC_LoadResource inst (%x)/ Resource '0x%X' not Found !\n", instance, rsc_name);
return 0;
}
/*
......
......@@ -59,6 +59,7 @@ int do_int(int intnum, struct sigcontext_struct *scp)
scp->sc_eax = (scp->sc_eax & 0xffff0000L) | 640L;
return 1; /* get base mem size */
case 0x13: return do_int13(scp);
case 0x15: return do_int15(scp);
case 0x16: return do_int16(scp);
case 0x1A: return do_int1A(scp);
......@@ -73,6 +74,7 @@ int do_int(int intnum, struct sigcontext_struct *scp)
case 0x25: return do_int25(scp);
case 0x26: return do_int26(scp);
case 0x2a: return do_int2a(scp);
case 0x2f: return do_int2f(scp);
case 0x31: return do_int31(scp);
}
......
......@@ -3,10 +3,15 @@
*
* Copyright 1994 Martin Ayotte
*/
static char Copyright[] = "Copyright Martin Ayotte, 1994";
#ifndef WINELIB
#define DEBUG_MCIWAVE
#define BUILTIN_MMSYSTEM
#endif
static char Copyright[] = "Copyright Martin Ayotte, 1994";
#ifdef BUILTIN_MMSYSTEM
#define DEBUG_MCIWAVE
#include "stdio.h"
#include "win.h"
......@@ -60,7 +65,7 @@ typedef struct {
BOOL fShareable; /* TRUE if first open was shareable */
WORD wNotifyDeviceID; /* MCI device ID with a pending notification */
HANDLE hCallback; /* Callback handle for pending notification */
int hFile; /* file handle open as Element */
HMMIO hFile; /* mmio file handle open as Element */
MCI_WAVE_OPEN_PARMS openParms;
PCMWAVEFORMAT WaveFormat;
WAVEHDR WaveHdr;
......@@ -207,13 +212,13 @@ DWORD WAVE_mciOpen(DWORD dwFlags, LPMCI_WAVE_OPEN_PARMS lpParms)
if (dwFlags & MCI_OPEN_ELEMENT) {
printf("WAVE_mciOpen // MCI_OPEN_ELEMENT '%s' !\n",
lpParms->lpstrElementName);
printf("WAVE_mciOpen // cdw='%s'\n", DOS_GetCurrentDir(DOS_GetDefaultDrive()));
/* printf("WAVE_mciOpen // cdw='%s'\n", DOS_GetCurrentDir(DOS_GetDefaultDrive())); */
if (strlen(lpParms->lpstrElementName) > 0) {
strcpy(str, lpParms->lpstrElementName);
AnsiUpper(str);
MCIWavDev[wDevID].hFile = _lopen(str, OF_READWRITE);
if (MCIWavDev[wDevID].hFile < 1) {
MCIWavDev[wDevID].hFile = 0;
MCIWavDev[wDevID].hFile = mmioOpen(str, NULL,
MMIO_ALLOCBUF | MMIO_READWRITE | MMIO_EXCLUSIVE);
if (MCIWavDev[wDevID].hFile == 0) {
printf("WAVE_mciOpen // can't find file='%s' !\n", str);
return MCIERR_FILE_NOT_FOUND;
}
......@@ -233,6 +238,49 @@ DWORD WAVE_mciOpen(DWORD dwFlags, LPMCI_WAVE_OPEN_PARMS lpParms)
lpWaveFormat->wf.nSamplesPerSec = 11025;
lpWaveFormat->wf.nAvgBytesPerSec = 11025;
lpWaveFormat->wf.nBlockAlign = 1;
if (MCIWavDev[wDevID].hFile != 0) {
MMCKINFO mmckInfo;
MMCKINFO ckMainRIFF;
if (mmioDescend(MCIWavDev[wDevID].hFile, &ckMainRIFF, NULL, 0) != 0) {
return MCIERR_INTERNAL;
}
#ifdef DEBUG_MCIWAVE
printf("WAVE_mciOpen // ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n",
(LPSTR)&ckMainRIFF.ckid, (LPSTR)&ckMainRIFF.fccType,
ckMainRIFF.cksize);
#endif
if ((ckMainRIFF.ckid != FOURCC_RIFF) ||
(ckMainRIFF.fccType != mmioFOURCC('W', 'A', 'V', 'E'))) {
return MCIERR_INTERNAL;
}
mmckInfo.ckid = mmioFOURCC('f', 'm', 't', ' ');
if (mmioDescend(MCIWavDev[wDevID].hFile, &mmckInfo, &ckMainRIFF, MMIO_FINDCHUNK) != 0) {
return MCIERR_INTERNAL;
}
#ifdef DEBUG_MCIWAVE
printf("WAVE_mciOpen // Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
(LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType,
mmckInfo.cksize);
#endif
if (mmioRead(MCIWavDev[wDevID].hFile, (HPSTR) lpWaveFormat,
(long) sizeof(PCMWAVEFORMAT)) != (long) sizeof(PCMWAVEFORMAT)) {
return MCIERR_INTERNAL;
}
mmckInfo.ckid = mmioFOURCC('d', 'a', 't', 'a');
if (mmioDescend(MCIWavDev[wDevID].hFile, &mmckInfo, &ckMainRIFF, MMIO_FINDCHUNK) != 0) {
return MCIERR_INTERNAL;
}
#ifdef DEBUG_MCIWAVE
printf("WAVE_mciOpen // Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
(LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType,
mmckInfo.cksize);
printf("WAVE_mciOpen // nChannels=%d nSamplesPerSec=%d\n",
lpWaveFormat->wf.nChannels, lpWaveFormat->wf.nSamplesPerSec);
#endif
lpWaveFormat->wBitsPerSample = 0;
}
lpWaveFormat->wf.nAvgBytesPerSec =
lpWaveFormat->wf.nSamplesPerSec * lpWaveFormat->wf.nBlockAlign;
dwRet = wodMessage(0, WODM_OPEN, 0, (DWORD)&WaveDesc, CALLBACK_NULL);
dwRet = widMessage(0, WIDM_OPEN, 0, (DWORD)&WaveDesc, CALLBACK_NULL);
return 0;
......@@ -318,20 +366,18 @@ DWORD WAVE_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
lpWaveHdr->dwFlags = 0L;
lpWaveHdr->dwLoops = 0L;
dwRet = wodMessage(0, WODM_PREPARE, 0, (DWORD)lpWaveHdr, sizeof(WAVEHDR));
printf("WAVE_mciPlay // after WODM_PREPARE \n");
/* printf("WAVE_mciPlay // after WODM_PREPARE \n"); */
while(TRUE) {
/* printf("WAVE_mciPlay // before 'read' hFile=%u lpData=%08X dwBufferLength=%u\n",
MCIWavDev[wDevID].hFile, lpWaveHdr->lpData, lpWaveHdr->dwBufferLength); */
count = _lread(MCIWavDev[wDevID].hFile, lpWaveHdr->lpData, lpWaveHdr->dwBufferLength);
count = mmioRead(MCIWavDev[wDevID].hFile, lpWaveHdr->lpData, lpWaveHdr->dwBufferLength);
if (count < 1) break;
lpWaveHdr->dwBytesRecorded = count;
#ifdef DEBUG_MCIWAVE
printf("WAVE_mciPlay // before WODM_WRITE lpWaveHdr=%08X dwBytesRecorded=%u\n",
lpWaveHdr, lpWaveHdr->dwBytesRecorded);
#endif
dwRet = wodMessage(0, WODM_WRITE, 0, (DWORD)lpWaveHdr, sizeof(WAVEHDR));
}
printf("WAVE_mciPlay // before WODM_UNPREPARE \n");
dwRet = wodMessage(0, WODM_UNPREPARE, 0, (DWORD)lpWaveHdr, sizeof(WAVEHDR));
printf("WAVE_mciPlay // after WODM_UNPREPARE \n");
if (lpWaveHdr->lpData != NULL) {
free(lpWaveHdr->lpData);
lpWaveHdr->lpData = NULL;
......@@ -1642,4 +1688,4 @@ DWORD modMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
return MMSYSERR_NOTENABLED;
}
#endif /* !WINELIB */
#endif /* #ifdef BUILTIN_MMSYSTEM */
......@@ -15,6 +15,26 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994";
LPDRIVERITEM lpDrvItemList = NULL;
void LoadStartupDrivers()
{
HDRVR hDrv;
char str[256];
LPSTR ptr = str;
LPSTR file = "SYSTEM.INI";
if (GetPrivateProfileString("drivers", NULL,
"", str, sizeof(str), file) < 2) {
printf("LoadStartupDrivers // can't find drivers section in '%s'\n", file);
return;
}
while(strlen(ptr) != 0) {
printf("LoadStartupDrivers // str='%s'\n", ptr);
hDrv = OpenDriver(ptr, "drivers", 0L);
printf("LoadStartupDrivers // hDrv=%04X\n", hDrv);
ptr += strlen(ptr) + 1;
}
printf("LoadStartupDrivers // end of list !\n");
}
/**************************************************************************
* SendDriverMessage [USER.251]
*/
......@@ -48,12 +68,13 @@ HDRVR OpenDriver(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
lpnewdrv = (LPDRIVERITEM) GlobalLock(hDrvr);
if (lpnewdrv == NULL) return 0;
lpnewdrv->dis.length = sizeof(DRIVERINFOSTRUCT);
lpnewdrv->dis.hModule = LoadImage("DrvName", DLL, 0);
lpnewdrv->dis.hModule = 0;
/* lpnewdrv->dis.hModule = LoadImage(DrvName, DLL, 0);
if (lpnewdrv->dis.hModule == 0) {
GlobalUnlock(hDrvr);
GlobalFree(hDrvr);
return 0;
}
} */
lpnewdrv->dis.hDriver = hDrvr;
strcpy(lpnewdrv->dis.szAliasName, lpDriverName);
lpnewdrv->count = 0;
......@@ -165,18 +186,30 @@ HDRVR GetNextDriver(HDRVR hDrvr, DWORD dwFlags)
LPDRIVERITEM lpdrv;
HDRVR hRetDrv = 0;
printf("GetNextDriver(%04X, %08X);\n", hDrvr, dwFlags);
if (hDrvr == 0) {
if (lpDrvItemList == NULL) {
printf("GetNextDriver // drivers list empty !\n");
LoadStartupDrivers();
if (lpDrvItemList == NULL) return 0;
}
printf("GetNextDriver // return first %04X !\n",
lpDrvItemList->dis.hDriver);
return lpDrvItemList->dis.hDriver;
}
lpdrv = (LPDRIVERITEM) GlobalLock(hDrvr);
if (lpdrv != NULL) {
if (dwFlags & GND_REVERSE)
if (dwFlags & GND_REVERSE) {
if (lpdrv->lpPrevItem)
hRetDrv = ((LPDRIVERITEM)lpdrv->lpPrevItem)->dis.hDriver;
if (dwFlags & GND_FORWARD)
}
else {
if (lpdrv->lpNextItem)
hRetDrv = ((LPDRIVERITEM)lpdrv->lpNextItem)->dis.hDriver;
}
GlobalUnlock(hDrvr);
}
printf("GetNextDriver // return %04X !\n", hRetDrv);
return hRetDrv;
}
......@@ -28,6 +28,7 @@
/* #define DEBUG_FILE /* */
char WindowsDirectory[256], SystemDirectory[256], TempDirectory[256];
extern char WindowsPath[256];
/***************************************************************************
_lopen
......@@ -123,9 +124,10 @@ INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
{
int base, flags;
int handle;
char buf[256];
#ifdef DEBUG_FILE
fprintf(stderr,"Openfile(%s,<struct>,%d) ",lpFileName,wStyle);
fprintf(stderr,"OpenFile(%s,<struct>,%04X)\n",lpFileName,wStyle);
#endif
base = wStyle & 0xF;
......@@ -150,6 +152,12 @@ INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
{
printf("OpenFile // OF_EXIST '%s' !\n", lpFileName);
handle = _lopen (lpFileName, wStyle);
if (handle == -1) {
/* Try again with WindowsPath */
if (FindFile(buf, sizeof(buf), lpFileName, NULL, WindowsPath) != NULL) {
handle = _lopen (buf, wStyle);
}
}
close(handle);
return handle;
}
......@@ -160,12 +168,21 @@ INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
}
else
{
int handle;
char *UnixFileName;
int handle;
char *UnixFileName;
if ((UnixFileName = GetUnixFileName(lpFileName)) == NULL)
return HFILE_ERROR;
handle = open(UnixFileName, base, 0666);
if (handle == -1) {
/* Try again with WindowsPath */
if (FindFile(buf, sizeof(buf), lpFileName, NULL, WindowsPath) != NULL) {
#ifdef DEBUG_FILE
printf("OpenFile // file '%s' found !\n", buf);
#endif
UnixFileName = buf;
handle = open(UnixFileName, base, 0666);
}
}
#ifdef DEBUG_FILE
fprintf(stderr, "OpenFile: returning %04.4x\n", handle);
......
static char RCSId[] = "$Id: keyboard.c,v 1.2 1993/09/13 18:52:02 scott Exp $";
static char Copyright[] = "Copyright Scott A. Laird, 1993";
static char Copyright[] = "Copyright Scott A. Laird, Erik Bos 1993, 1994";
#include <stdlib.h>
#include <stdio.h>
#include "prototypes.h"
#include "windows.h"
#include "keyboard.h"
int ToAscii(WORD wVirtKey, WORD wScanCode, LPSTR lpKeyState,
LPVOID lpChar, WORD wFlags)
LPVOID lpChar, WORD wFlags)
{
printf("ToAscii (%d,%d)\n",wVirtKey, wScanCode);
return -1;
}
int i;
#ifdef BOGUS_ANSI_OEM
printf("ToAscii (%d,%d)\n",wVirtKey, wScanCode);
int AnsiToOem(LPSTR lpAnsiStr, LPSTR lpOemStr)
{
printf("AnsiToOem (%s)\n",lpAnsiStr);
strcpy(lpOemStr,lpAnsiStr); /* Probably not the right thing to do, but... */
return -1;
}
/* FIXME: this is not sufficient but better than returing -1 */
BOOL OemToAnsi(LPSTR lpOemStr, LPSTR lpAnsiStr)
{
printf("OemToAnsi (%s)\n",lpOemStr);
strcpy(lpAnsiStr,lpOemStr); /* Probably not the right thing to do, but... */
return -1;
}
for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].virtualkey == wVirtKey) {
*(BYTE*)lpChar++ = *KeyTable[i].name;
*(BYTE*)lpChar = 0;
return 1;
}
#endif
*(BYTE*)lpChar = 0;
return 0;
}
DWORD OemKeyScan(WORD wOemChar)
{
printf("*OemKeyScan (%d)\n",wOemChar);
return 0;
printf("*OemKeyScan (%d)\n",wOemChar);
return wOemChar;
}
/* VkKeyScan translates an ANSI character to a virtual-key and shift code
* for the current keyboard. For now we return -1, which is fail. */
* for the current keyboard. */
WORD VkKeyScan(WORD cChar)
{
printf("VkKeyScan (%d)\n",cChar);
return -1;
int i;
printf("VkKeyScan (%d)\n",cChar);
for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].ASCII == cChar)
return KeyTable[i].virtualkey;
return -1;
}
int GetKeyboardType(int nTypeFlag)
......@@ -61,58 +65,64 @@ int GetKeyboardType(int nTypeFlag)
return 12; /* We're doing an 101 for now, so return 12 F-keys */
break;
default:
printf(" Unknown type on GetKeyboardType\n");
fprintf(stderr, "Unknown type on GetKeyboardType\n");
return 0; /* The book says 0 here, so 0 */
}
}
/* MapVirtualKey translates keycodes from one format to another. This
* is a total punt. */
/* MapVirtualKey translates keycodes from one format to another. */
WORD MapVirtualKey(WORD wCode, WORD wMapType)
{
printf("*MapVirtualKey(%d,%d)\n",wCode,wMapType);
return 0;
int i;
switch(wMapType) {
case 0:
for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].virtualkey == wCode)
return KeyTable[i].scancode;
return 0;
case 1:
for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].scancode == wCode)
return KeyTable[i].virtualkey;
return 0;
case 2:
for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].virtualkey == wCode)
return KeyTable[i].ASCII;
return 0;
default:
fprintf(stderr, "MapVirtualKey: unknown wMapType!\n");
return 0;
}
return 0;
}
int GetKbCodePage(void)
{
printf("GetKbCodePage()\n");
return 437; /* US -- probably should be 850 from time to time */
printf("GetKbCodePage()\n");
return 850;
}
/* This should distinguish key names. Maybe later */
int GetKeyNameText(LONG lParam, LPSTR lpBuffer, int nSize)
{
printf("GetKeyNameText(%d,<ptr>, %d)\n",lParam,nSize);
lpBuffer[0]=0; /* This key has no name */
return 0;
}
int i;
printf("GetKeyNameText(%d,<ptr>, %d)\n",lParam,nSize);
#ifdef BOGUS_ANSI_OEM
lParam >>= 16;
lParam &= 0xff;
void AnsiToOemBuff(LPSTR lpAnsiStr, LPSTR lpOemStr, int nLength)
{
printf("AnsiToOemBuff(%s,<ptr>,%d)\n",lpAnsiStr,nLength);
strncpy(lpOemStr,lpAnsiStr,nLength); /* should translate... */
}
for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].scancode == lParam) {
strncpy(lpBuffer, KeyTable[i].name, nSize);
return strlen(lpBuffer);
}
void OemToAnsiBuff(LPSTR lpOemStr, LPSTR lpAnsiStr, int nLength)
{
printf("OemToAnsiBuff(%s,<ptr>,%d)\n",lpOemStr,nLength);
strncpy(lpAnsiStr,lpOemStr,nLength); /* should translate... */
*lpBuffer = 0;
return 0;
}
#endif
......@@ -3,9 +3,14 @@
*
* Copyright 1994 Martin Ayotte
*/
#ifndef WINELIB
static char Copyright[] = "Copyright Martin Ayotte, 1994";
#ifndef WINELIB
#define BUILTIN_MMSYSTEM
#endif
#ifdef BUILTIN_MMSYSTEM
/*
#define DEBUG_CDAUDIO
*/
......@@ -158,7 +163,7 @@ DWORD CDAUDIO_mciGetDevCaps(UINT wDevID, DWORD dwFlags,
#endif
if (lpParms == NULL) return MCIERR_INTERNAL;
if (dwFlags & MCI_GETDEVCAPS_ITEM) {
printf("CDAUDIO_mciGetDevCaps // MCI_GETDEVCAPS_ITEM dwItem=%08X);\n",
printf("CDAUDIO_mciGetDevCaps // MCI_GETDEVCAPS_ITEM dwItem=%08X;\n",
lpParms->dwItem);
switch(lpParms->dwItem) {
case MCI_GETDEVCAPS_CAN_RECORD:
......@@ -192,7 +197,7 @@ DWORD CDAUDIO_mciGetDevCaps(UINT wDevID, DWORD dwFlags,
return MCIERR_UNRECOGNIZED_COMMAND;
}
}
printf("CDAUDIO_mciGetDevCaps // lpParms->dwReturn=%08X);\n", lpParms->dwReturn);
printf("CDAUDIO_mciGetDevCaps // lpParms->dwReturn=%08X;\n", lpParms->dwReturn);
return 0;
#else
return MCIERR_INTERNAL;
......@@ -486,6 +491,7 @@ BOOL CDAUDIO_GetTracksInfo(UINT wDevID)
if (CDADev[wDevID].nTracks == 0) {
if (CDAUDIO_GetNumberOfTracks(wDevID) == (WORD)-1) return FALSE;
}
printf("CDAUDIO_GetTracksInfo // nTracks=%u\n", CDADev[wDevID].nTracks);
if (CDADev[wDevID].lpdwTrackLen != NULL)
free(CDADev[wDevID].lpdwTrackLen);
CDADev[wDevID].lpdwTrackLen = (LPDWORD)malloc(
......@@ -533,6 +539,7 @@ BOOL CDAUDIO_GetTracksInfo(UINT wDevID)
}
CDADev[wDevID].dwTotalLen = total_length;
printf("CDAUDIO_GetTracksInfo // total_len=%u\n", total_length);
fflush(stdout);
return TRUE;
#else
return FALSE;
......@@ -552,7 +559,7 @@ BOOL CDAUDIO_GetCDStatus(UINT wDevID)
#ifdef DEBUG_CDAUDIO
printf("CDAUDIO_GetCDStatus // opened or no_media !\n");
#endif
CDADev[wDevID].mode = MCI_MODE_OPEN;
CDADev[wDevID].mode = MCI_MODE_NOT_READY;
return TRUE;
}
switch (CDADev[wDevID].sc.cdsc_audiostatus) {
......@@ -923,4 +930,4 @@ LRESULT CDAUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
/*-----------------------------------------------------------------------*/
#endif
#endif /* #ifdef BUILTIN_MMSYSTEM */
......@@ -3,9 +3,14 @@
*
* Copyright 1994 Martin Ayotte
*/
#ifndef WINELIB
static char Copyright[] = "Copyright Martin Ayotte, 1994";
#ifndef WINELIB
#define BUILTIN_MMSYSTEM
#endif
#ifdef BUILTIN_MMSYSTEM
#include "stdio.h"
#include "win.h"
#include "user.h"
......@@ -128,4 +133,4 @@ DWORD auxMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
}
#endif /* !WINELIB */
#endif /* #ifdef BUILTIN_MMSYSTEM */
......@@ -5,12 +5,14 @@ MODULE = miscemu
SRCS = \
emulate.c \
int10.c \
int13.c \
int15.c \
int16.c \
int1a.c \
int21.c \
int25.c \
int26.c \
int2a.c \
int2f.c \
int31.c \
ioports.c \
......
#include <stdio.h>
#include <stdlib.h>
#include "msdos.h"
#include "wine.h"
int do_int13(struct sigcontext_struct *context)
{
switch((context->sc_eax >> 8) & 0xff)
{
case 0x00: /* RESET DISK SYSTEM */
case 0x04: /* VERIFY DISK SECTOR(S) */
EAX = (EAX & 0xffff00ff);
break;
case 0x05: /* FORMAT TRACK */
EAX = (EAX & 0xffff00ff) | 0x0c;
SetCflag;
break;
case 0x06: /* FORMAT TRACK AND SET BAD SECTOR FLAGS */
case 0x07: /* FORMAT DRIVE STARTING AT GIVEN TRACK */
EAX = (EAX & 0xffff00ff) | 0x0c;
break;
case 0x08: /* GET DRIVE PARAMETERS */
EAX = (EAX & 0xffff00ff) | ((EDX & 0x00000080)? 0x07: 0x01);
SetCflag;
break;
case 0x09: /* INITIALIZE CONTROLLER WITH DRIVE PARAMETERS */
case 0x0c: /* SEEK TO CYLINDER */
case 0x0d: /* RESET HARD DISKS */
case 0x10: /* CHECK IF DRIVE READY */
case 0x11: /* RECALIBRATE DRIVE */
case 0x14: /* CONTROLLER INTERNAL DIAGNOSTIC */
EAX = (EAX & 0xffff00ff);
break;
case 0x0e: /* READ SECTOR BUFFER (XT only) */
case 0x0f: /* WRITE SECTOR BUFFER (XT only) */
case 0x12: /* CONTROLLER RAM DIAGNOSTIC (XT,PS) */
case 0x13: /* DRIVE DIAGNOSTIC (XT,PS) */
EAX = (EAX & 0xffff00ff) | 0x01;
SetCflag;
break;
default:
IntBarf(0x13, context);
};
return 1;
}
......@@ -3,6 +3,7 @@
#include <stdlib.h>
#include "msdos.h"
#include "wine.h"
#include "options.h"
#ifdef linux
#include <linux/sched.h> /* needed for HZ */
......@@ -16,6 +17,12 @@ int do_int1A(struct sigcontext_struct * context){
struct tm *bdtime;
int ticks;
if (Options.relay_debug) {
printf("int1A: AX %04x, BX %04x, CX %04x, DX %04x, "
"SI %04x, DI %04x, DS %04x, ES %04x\n",
AX, BX, CX, DX, SI, DI, DS, ES);
}
switch((context->sc_eax >> 8) & 0xff){
case 0:
ltime = time(NULL);
......@@ -23,6 +30,7 @@ int do_int1A(struct sigcontext_struct * context){
context->sc_ecx = ticks >> 16;
context->sc_edx = ticks & 0x0000FFFF;
context->sc_eax = 0; /* No midnight rollover */
printf("int1a_00 // ltime=%ld ticks=%ld\n", ltime, ticks);
break;
case 2:
......
......@@ -1169,7 +1169,16 @@ int do_int21(struct sigcontext_struct * context)
case 0x00:
ioctlGetDeviceInfo(context);
break;
case 0x09: /* CHECK IF BLOCK DEVICE REMOTE */
EDX = (EDX & 0xffff0000) | (1<<9) | (1<<12);
ResetCflag;
break;
case 0x0b: /* SET SHARING RETRY COUNT */
ResetCflag;
break;
case 0x0d:
ioctlGenericBlkDevReq(context);
break;
......@@ -1364,6 +1373,9 @@ int do_int21(struct sigcontext_struct * context)
ResetCflag;
break;
case 0xea: /* NOVELL NETWARE - RETURN SHELL VERSION */
break;
default:
IntBarf(0x21, context);
return 1;
......
#include <stdio.h>
#include <stdlib.h>
#include "msdos.h"
#include "wine.h"
int do_int2a(struct sigcontext_struct *context)
{
switch((context->sc_eax >> 8) & 0xff)
{
case 0x00: /* NETWORK INSTALLATION CHECK */
break;
default:
IntBarf(0x2a, context);
};
return 1;
}
......@@ -10,6 +10,10 @@ int do_int2f(struct sigcontext_struct *context)
{
switch((context->sc_eax >> 8) & 0xff)
{
case 0x10: /* share isn't installed */
EAX = (EAX & 0xffffff00) | 0x01;
break;
case 0x15: /* mscdex */
/* ignore requests */
return 1;
......
......@@ -14,6 +14,9 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "user.h"
#include "syscolor.h"
/* Last COLOR id */
#define COLOR_MAX COLOR_BTNHIGHLIGHT
extern LONG NC_HandleNCPaint( HWND hwnd, HRGN hrgn );
extern LONG NC_HandleNCActivate( HWND hwnd, WORD wParam );
extern LONG NC_HandleNCCalcSize( HWND hwnd, NCCALCSIZE_PARAMS *params );
......@@ -149,7 +152,16 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
{
if (!(classPtr = CLASS_FindClassPtr( wndPtr->hClass ))) return 1;
if (!classPtr->wc.hbrBackground) return 1;
FillWindow( GetParent(hwnd), hwnd, (HDC)wParam,
if (classPtr->wc.hbrBackground <= COLOR_MAX+1)
{
HBRUSH hbrush;
hbrush = CreateSolidBrush(
GetSysColor(classPtr->wc.hbrBackground-1));
FillWindow( GetParent(hwnd), hwnd, (HDC)wParam, hbrush);
DeleteObject (hbrush);
}
else
FillWindow( GetParent(hwnd), hwnd, (HDC)wParam,
classPtr->wc.hbrBackground );
return 0;
}
......
......@@ -54,8 +54,10 @@ BOOL DIALOG_Init()
static DLGCONTROLHEADER * DIALOG_GetControl( DLGCONTROLHEADER * ptr,
char ** class, char ** text )
{
int i;
unsigned char * p = (unsigned char *)ptr;
p += 14; /* size of control header */
if (*p & 0x80)
{
switch(*p++)
......@@ -74,8 +76,15 @@ static DLGCONTROLHEADER * DIALOG_GetControl( DLGCONTROLHEADER * ptr,
*class = p;
p += strlen(p) + 1;
}
*text = p;
p += strlen(p) + 2;
/* FIXME: how can I determine if the resource id is an integer or a string ? */
if (*p == 0xff) {
/* *(DWORD*)text = (*p << 8) | *p;*/
*(DWORD*)text = 0xebeb;
p += 4;
} else {
*text = p;
p += strlen(p) + 2;
}
return (DLGCONTROLHEADER *)p;
}
......@@ -285,9 +294,14 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, LPCSTR dlgTemplate,
next_header = DIALOG_GetControl( header, &class, &text );
#ifdef DEBUG_DIALOG
printf( " %s '%s' %d, %d, %d, %d, %d, %08x\n",
class, text, header->id, header->x, header->y, header->cx,
header->cy, header->style );
printf( " %s ", class);
if ((DWORD*)text < 0x10000)
printf("'%4X'", (DWORD*)text);
else
printf("'%s'", text);
printf(" %d, %d, %d, %d, %d, %08x\n", header->id, header->x, header->y,
header->cx, header->cy, header->style );
#endif
if ((strcmp(class, "STATIC") == 0) & ((header->style & SS_ICON) == SS_ICON)) {
header->cx = 32;
......
......@@ -44,6 +44,7 @@ BYTE KeyStateTable[256];
BYTE AsyncKeyStateTable[256];
static WORD ALTKeyState;
static HWND captureWnd = 0;
static BOOL InputEnabled = TRUE;
Window winHasCursor = 0;
/* Keyboard translation tables */
......@@ -517,3 +518,16 @@ HWND GetCapture()
{
return captureWnd;
}
/**********************************************************************
* EnableHardwareInput [USER.331]
*/
BOOL EnableHardwareInput(BOOL bEnable)
{
BOOL bOldState = InputEnabled;
printf("EMPTY STUB !!! EnableHardwareInput(%d);\n", bEnable);
InputEnabled = bEnable;
return (bOldState && !bEnable);
}
......@@ -21,6 +21,8 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "sysmetrics.h"
#include "hook.h"
#define HWND_BROADCAST ((HWND)0xffff)
#define MAX_QUEUE_SIZE 120 /* Max. size of a message queue */
......@@ -115,8 +117,10 @@ static int MSG_AddMsg( MESSAGEQUEUE * msgQueue, MSG * msg, DWORD extraInfo )
pos = msgQueue->nextFreeMessage;
/* Check if queue is full */
if ((pos == msgQueue->nextMessage) && (msgQueue->msgCount > 0))
return FALSE;
if ((pos == msgQueue->nextMessage) && (msgQueue->msgCount > 0)) {
printf("MSG_AddMsg // queue is full !\n");
return FALSE;
}
/* Store message */
msgQueue->messages[pos].msg = *msg;
......@@ -724,16 +728,44 @@ BOOL GetMessage( LPMSG msg, HWND hwnd, WORD first, WORD last )
}
/***********************************************************************
* PostMessage (USER.110)
*/
BOOL PostMessage( HWND hwnd, WORD message, WORD wParam, LONG lParam )
{
MSG msg;
WND *wndPtr = WIN_FindWndPtr( hwnd );
MSG msg;
WND *wndPtr;
if (!wndPtr || !wndPtr->hmemTaskQ) return FALSE;
if (hwnd == HWND_BROADCAST) {
#ifdef DEBUG_MSG
printf("PostMessage // HWND_BROADCAST !\n");
#endif
hwnd = GetTopWindow(GetDesktopWindow());
while (hwnd) {
if (!(wndPtr = WIN_FindWndPtr(hwnd))) break;
if (wndPtr->dwStyle & WS_POPUP || wndPtr->dwStyle & WS_CAPTION) {
#ifdef DEBUG_MSG
printf("BROADCAST Message to hWnd=%04X m=%04X w=%04X l=%08X !\n",
hwnd, message, wParam, lParam);
#endif
PostMessage(hwnd, message, wParam, lParam);
}
/* {
char str[128];
GetWindowText(hwnd, str, sizeof(str));
printf("BROADCAST GetWindowText()='%s' !\n", str);
}*/
hwnd = wndPtr->hwndNext;
}
#ifdef DEBUG_MSG
printf("PostMessage // End of HWND_BROADCAST !\n");
#endif
return TRUE;
}
wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr || !wndPtr->hmemTaskQ) return FALSE;
msg.hwnd = hwnd;
msg.message = message;
msg.wParam = wParam;
......@@ -760,6 +792,51 @@ LONG SendMessage( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
/***********************************************************************
* WaitMessage (USER.112)
*/
void WaitMessage( void )
{
MSG msg;
LONG nextExp; /* Next timer expiration time */
XEvent event;
while (XPending( display ))
{
XNextEvent( display, &event );
EVENT_ProcessEvent( &event );
}
while(1)
{
if ((appMsgQueue->wPostQMsg) ||
(appMsgQueue->status & (QS_SENDMESSAGE | QS_PAINT)) ||
(appMsgQueue->msgCount) || (sysMsgQueue->msgCount) )
break;
if ((appMsgQueue->status & QS_TIMER) &&
TIMER_CheckTimer( &nextExp, &msg, 0, FALSE))
break;
else
nextExp=-1;
if (!XPending( display ) && (nextExp != -1))
{
fd_set read_set;
struct timeval timeout;
int fd = ConnectionNumber(display);
FD_ZERO( &read_set );
FD_SET( fd, &read_set );
timeout.tv_sec = nextExp / 1000;
timeout.tv_usec = (nextExp % 1000) * 1000;
if (select( fd+1, &read_set, NULL, NULL, &timeout ) != 1)
continue; /* On timeout or error, restart from the start */
}
XNextEvent( display, &event );
EVENT_ProcessEvent( &event );
}
}
/***********************************************************************
* TranslateMessage (USER.113)
*/
BOOL TranslateMessage( LPMSG msg )
......@@ -851,10 +928,12 @@ LONG GetMessageExtraInfo(void)
*/
WORD RegisterWindowMessage( LPCSTR str )
{
WORD wRet;
#ifdef DEBUG_MSG
printf( "RegisterWindowMessage: '%s'\n", str );
#endif
return GlobalAddAtom( str );
wRet = GlobalAddAtom( str );
return wRet;
}
......
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