Release 940602

Sat May 28 12:03:23 1994  Bob Amstadt  (bob@pooh)

	* miscemu/int21.c (OpenExistingFile): 
	OpenExistingFile needed to return handle in AX register instead
	of the BX register.

	* miscemu/int21.c (ioctlGetDeviceInfo): 
	Added a little code to give a fake result for normal files.

Wed May 25 21:55:38 1994  Bob Amstadt  (bob@pooh)

	* [memory/global.c]
	return value from GlobalSize was completely wrong.

	* [miscemu/int21.h]
	fixed bug in FindFirst.  Directory pointer (dp) was not placed in
	dta correctly.

	* [tools/build.c]
	fixed creation of pop.h to guarantee that flags are restored correctly.

	* [misc/comm.c]
	changed all occurance of strncmp() to strncasecmp().
	BuildCommDCB() should not require that OpenComm() be called first.

	* [loader/selector.c]
	Heap initialized to size of full segment less stack size and 
	automatic data size.

Sat May 28 09:14:33 1994  Rick Sladkey  (jrs@world.std.com)

	* [controls/listbox.c]
	Correct typos in ListBoxResetContent where lpls variable is
	used where lsls2 variable is meant.  Don't call USER_HEAP_FREE
	twice on the same handle if hData and hMem are the same.

	* [debugger/opcodes/i386-dis.c]
	Add new name array names_rmw for table driven decoding of the
	16-bit mod/rm field.  Omit large case statement in OP_E and
	replace with array reference to match existing coding style.
	Add new static variable machine with value 286 or 386 to
	correctly decode mod/rm field in either 16 or 32 bit modes.
	Set it in print_insn_i{2,3}86.  In OP_E use it to decide how
	to decode mod/rm.  While the code was correct for 16 bit code,
	it was improperly decoding mod/rm fields on word prefixed
	32 bit instructions.

	* [debugger/debug.l]
	Recognize new token ABORT.   Recognize single letters 'p'
	and 'q' as tokens.

	* [debugger/dbg.y]
	Add new token ABORT.  Allow print command to be invoked by
	'p' and quit command by 'q', ala GDB.  Change lots of '};'
	to just '}'.  Add static dummy_regs to wine_debug so that
	wine_debug(0, NULL) doesn't core dump with qmagic.

	* [debugger/info.c]
	Correct syntax of break command in helptext and omit former
	comment about probable bugginess of the disassembly since it
	is now correct.  Change fprintf of first backtrace stack
	frame to match that of the second and subsequent frames.

	* [loader/selector.c]
	Change construction of command line in CreatePSP from creating
	a string that looks like "arg1 arg2 \r" to "arg1 arg2".  A DOS
	PSP command line looks like " arg1 arg2\r" with the length not
	including the trailing "\r" but that is not how Windows does it.

	* [loader/library.c]
	Change uses of %s to print strings in GetModuleHandle to %x so
	that string IDs don't cause a core dump with qmagic.  Handle
	converting a string id to a literal module handle.  For
	example, GetModuleHandle((LPSTR) 0x57) now returns 0x57 if
	it is a real module handle.

	* [misc/message.c]
	In MessageBox, translate a NULL title argument to the string "Error".

	* [misc/profile.c]
	In GetSetProfile translate a NULL Default argument to "".  Any
	caller whose Default argument is NULL is buggy, but CHARMAP does it
	anyway.

	* [objects/font.c]
	Add NULL pointer checks in EnumFontFamilies to prevent core dumps.

Sat May 28 20:01:51 1994 Jon Tombs (jon@gtex02.us.es) 

	* New options/resourses nosaveunders and nobackingstore.  By 
	default backingstore and saveunders are now enabled, these use 
	more memory but avoids those slow (sometimes multiple) redraws 
	caused be exposure events.

May 30, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)

	* [misc/driver.c] New file
	Skeleton for 'Installable Wine Drivers' functions. :-)
	* [misc/audio.c] New file
	Skeleton for basic 'Audio Driver' functions.
	* [misc/network.c] New file
	Stubs for few networking functions.

	* [misc/mmsystem.c]
	More coding ... a dust in a galaxy ...
	* [misc/shell.c]
	Some coding for 'RegXXX' functions ... a dust in the wind ...

	* [misc/profile.c]
	Bug fix in GetSetProfile(), bad enumeration if KeyName == NULL.

	* [objects/gdi.c]
	New function CreateDiscardableBitmap(), it just calling 
	CreateCompatibleBitmap() for now. It's get 'clock.exe' running ! :-)

	* [controls/listbox.c]
	* [controls/combo.c]
	New font member assigned to SYSTEM_FONT as default.
	Added processing for WM_SETFONT message;


Tue May 31 20:34:25 EDT 1994  John Richardson <jrichard@cs.uml.edu>

        * [windows/event.c]
        Added AsyncMouseButtonsStates array for GetAsyncKeyState.

        * [windows/keyboard.c]
        Implemented beginning of GetAsyncKeyState.

Wed May 25 23:35:03 1994  David Metcalfe <david@prism.demon.co.uk>

        * [objects/metafile.c] [include/metafile.h]
          [windows/mapping.c] [objects/clipping.c] [objects/bitblt.c]
          [windows/dc.c]
        Further metafile support.
This commit is contained in:
Alexandre Julliard 1994-06-02 22:38:20 +00:00
parent 1f57929b17
commit 36ca1368c9
50 changed files with 1919 additions and 452 deletions

139
ChangeLog
View File

@ -1,3 +1,140 @@
----------------------------------------------------------------------
Sat May 28 12:03:23 1994 Bob Amstadt (bob@pooh)
* miscemu/int21.c (OpenExistingFile):
OpenExistingFile needed to return handle in AX register instead
of the BX register.
* miscemu/int21.c (ioctlGetDeviceInfo):
Added a little code to give a fake result for normal files.
Wed May 25 21:55:38 1994 Bob Amstadt (bob@pooh)
* [memory/global.c]
return value from GlobalSize was completely wrong.
* [miscemu/int21.h]
fixed bug in FindFirst. Directory pointer (dp) was not placed in
dta correctly.
* [tools/build.c]
fixed creation of pop.h to guarantee that flags are restored correctly.
* [misc/comm.c]
changed all occurance of strncmp() to strncasecmp().
BuildCommDCB() should not require that OpenComm() be called first.
* [loader/selector.c]
Heap initialized to size of full segment less stack size and
automatic data size.
Sat May 28 09:14:33 1994 Rick Sladkey (jrs@world.std.com)
* [controls/listbox.c]
Correct typos in ListBoxResetContent where lpls variable is
used where lsls2 variable is meant. Don't call USER_HEAP_FREE
twice on the same handle if hData and hMem are the same.
* [debugger/opcodes/i386-dis.c]
Add new name array names_rmw for table driven decoding of the
16-bit mod/rm field. Omit large case statement in OP_E and
replace with array reference to match existing coding style.
Add new static variable machine with value 286 or 386 to
correctly decode mod/rm field in either 16 or 32 bit modes.
Set it in print_insn_i{2,3}86. In OP_E use it to decide how
to decode mod/rm. While the code was correct for 16 bit code,
it was improperly decoding mod/rm fields on word prefixed
32 bit instructions.
* [debugger/debug.l]
Recognize new token ABORT. Recognize single letters 'p'
and 'q' as tokens.
* [debugger/dbg.y]
Add new token ABORT. Allow print command to be invoked by
'p' and quit command by 'q', ala GDB. Change lots of '};'
to just '}'. Add static dummy_regs to wine_debug so that
wine_debug(0, NULL) doesn't core dump with qmagic.
* [debugger/info.c]
Correct syntax of break command in helptext and omit former
comment about probable bugginess of the disassembly since it
is now correct. Change fprintf of first backtrace stack
frame to match that of the second and subsequent frames.
* [loader/selector.c]
Change construction of command line in CreatePSP from creating
a string that looks like "arg1 arg2 \r" to "arg1 arg2". A DOS
PSP command line looks like " arg1 arg2\r" with the length not
including the trailing "\r" but that is not how Windows does it.
* [loader/library.c]
Change uses of %s to print strings in GetModuleHandle to %x so
that string IDs don't cause a core dump with qmagic. Handle
converting a string id to a literal module handle. For
example, GetModuleHandle((LPSTR) 0x57) now returns 0x57 if
it is a real module handle.
* [misc/message.c]
In MessageBox, translate a NULL title argument to the string "Error".
* [misc/profile.c]
In GetSetProfile translate a NULL Default argument to "". Any
caller whose Default argument is NULL is buggy, but CHARMAP does it
anyway.
* [objects/font.c]
Add NULL pointer checks in EnumFontFamilies to prevent core dumps.
Sat May 28 20:01:51 1994 Jon Tombs (jon@gtex02.us.es)
* New options/resourses nosaveunders and nobackingstore. By
default backingstore and saveunders are now enabled, these use
more memory but avoids those slow (sometimes multiple) redraws
caused be exposure events.
May 30, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [misc/driver.c] New file
Skeleton for 'Installable Wine Drivers' functions. :-)
* [misc/audio.c] New file
Skeleton for basic 'Audio Driver' functions.
* [misc/network.c] New file
Stubs for few networking functions.
* [misc/mmsystem.c]
More coding ... a dust in a galaxy ...
* [misc/shell.c]
Some coding for 'RegXXX' functions ... a dust in the wind ...
* [misc/profile.c]
Bug fix in GetSetProfile(), bad enumeration if KeyName == NULL.
* [objects/gdi.c]
New function CreateDiscardableBitmap(), it just calling
CreateCompatibleBitmap() for now. It's get 'clock.exe' running ! :-)
* [controls/listbox.c]
* [controls/combo.c]
New font member assigned to SYSTEM_FONT as default.
Added processing for WM_SETFONT message;
Tue May 31 20:34:25 EDT 1994 John Richardson <jrichard@cs.uml.edu>
* [windows/event.c]
Added AsyncMouseButtonsStates array for GetAsyncKeyState.
* [windows/keyboard.c]
Implemented beginning of GetAsyncKeyState.
Wed May 25 23:35:03 1994 David Metcalfe <david@prism.demon.co.uk>
* [objects/metafile.c] [include/metafile.h]
[windows/mapping.c] [objects/clipping.c] [objects/bitblt.c]
[windows/dc.c]
Further metafile support.
---------------------------------------------------------------------- ----------------------------------------------------------------------
Mon May 23 15:07:36 1994 Bob Amstadt (bob@pooh) Mon May 23 15:07:36 1994 Bob Amstadt (bob@pooh)
@ -30,7 +167,7 @@ Mon May 23 00:48:25 1994 Rick Sladkey (jrs@world.std.com)
* [windows/dialog.c] * [windows/dialog.c]
Fix inadvertent printing of string IDs as strings. Fix inadvertent printing of string IDs as strings.
May 16, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) May 23, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [controls/menu.c] * [controls/menu.c]
New functions GetMenuItemCount(), GetMenuItemID(). New functions GetMenuItemCount(), GetMenuItemID().

11
README
View File

@ -197,6 +197,17 @@ bob@amscons.com
7. WHAT'S NEW 7. WHAT'S NEW
WHAT'S NEW with Wine-940602: (see ChangeLog for details)
- CLOCK.EXE runs.
- ABORT command added to debugger.
- Windows environment is now imported from the UNIX environment.
- Use of save unders and backing store are now the default. Resource
and command line options have been added to disable these things.
- Assorted new driver functions
- GetAsyncKeyState()
- More metafile support
- and many many bug fixes!
WHAT'S NEW with Wine-940524: (see ChangeLog for details) WHAT'S NEW with Wine-940524: (see ChangeLog for details)
- New menu functions - New menu functions
- EnumObjects() - EnumObjects()

View File

@ -673,7 +673,7 @@ void EDIT_WriteTextLine(HWND hwnd, RECT *rect, int y)
int col, off = 0; int col, off = 0;
int sbl, sel, sbc, sec; int sbl, sel, sbc, sec;
RECT rc; RECT rc;
div_t num;
BOOL trunc = FALSE; BOOL trunc = FALSE;
WND *wndPtr = WIN_FindWndPtr(hwnd); WND *wndPtr = WIN_FindWndPtr(hwnd);
EDITSTATE *es = (EDITSTATE *)EDIT_HEAP_ADDR((HANDLE)(*(wndPtr->wExtra))); EDITSTATE *es = (EDITSTATE *)EDIT_HEAP_ADDR((HANDLE)(*(wndPtr->wExtra)));

View File

@ -78,6 +78,7 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
lphl->hWndLogicParent = (HWND)HIWORD(createStruct->lpCreateParams); lphl->hWndLogicParent = (HWND)HIWORD(createStruct->lpCreateParams);
else else
lphl->hWndLogicParent = GetParent(hwnd); lphl->hWndLogicParent = GetParent(hwnd);
lphl->hFont = GetStockObject(SYSTEM_FONT);
lphl->ColumnsWidth = wndPtr->rectClient.right - wndPtr->rectClient.left; lphl->ColumnsWidth = wndPtr->rectClient.right - wndPtr->rectClient.left;
if (wndPtr->dwStyle & WS_VSCROLL) { if (wndPtr->dwStyle & WS_VSCROLL) {
SetScrollRange(hwnd, SB_VERT, 1, lphl->ItemsCount, TRUE); SetScrollRange(hwnd, SB_VERT, 1, lphl->ItemsCount, TRUE);
@ -330,6 +331,14 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd); UpdateWindow(hwnd);
break; break;
case WM_SETFONT:
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
if (lphl == NULL) return 0;
if (wParam == 0)
lphl->hFont = GetStockObject(SYSTEM_FONT);
else
lphl->hFont = wParam;
if (wParam == 0) break;
case WM_PAINT: case WM_PAINT:
wndPtr = WIN_FindWndPtr(hwnd); wndPtr = WIN_FindWndPtr(hwnd);
if ((wndPtr->dwStyle & LBS_OWNERDRAWFIXED) == LBS_OWNERDRAWFIXED) { if ((wndPtr->dwStyle & LBS_OWNERDRAWFIXED) == LBS_OWNERDRAWFIXED) {
@ -514,6 +523,7 @@ void StdDrawListBox(HWND hwnd)
} }
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr); lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
if (lphl == NULL) goto EndOfPaint; if (lphl == NULL) goto EndOfPaint;
SelectObject(hdc, lphl->hFont);
hBrush = SendMessage(lphl->hWndLogicParent, WM_CTLCOLOR, (WORD)hdc, hBrush = SendMessage(lphl->hWndLogicParent, WM_CTLCOLOR, (WORD)hdc,
MAKELONG(hwnd, CTLCOLOR_LISTBOX)); MAKELONG(hwnd, CTLCOLOR_LISTBOX));
if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(WHITE_BRUSH); if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(WHITE_BRUSH);
@ -986,8 +996,9 @@ int ListBoxResetContent(HWND hwnd)
#ifdef DEBUG_LISTBOX #ifdef DEBUG_LISTBOX
printf("ResetContent #%u\n", i); printf("ResetContent #%u\n", i);
#endif #endif
if (lpls2->hData != 0) USER_HEAP_FREE(lpls->hData); if (lpls2->hData != 0 && lpls2->hData != lpls2->hMem)
if (lpls2->hMem != 0) USER_HEAP_FREE(lpls->hMem); USER_HEAP_FREE(lpls2->hData);
if (lpls2->hMem != 0) USER_HEAP_FREE(lpls2->hMem);
} }
if (lpls == NULL) break; if (lpls == NULL) break;
} }
@ -1093,6 +1104,7 @@ int ListBoxGetSel(HWND hwnd, WORD wIndex)
int ListBoxDirectory(HWND hwnd, UINT attrib, LPSTR filespec) int ListBoxDirectory(HWND hwnd, UINT attrib, LPSTR filespec)
{ {
struct dosdirent *dp; struct dosdirent *dp;
struct dosdirent *newdp;
struct stat st; struct stat st;
int x, wRet; int x, wRet;
char temp[256]; char temp[256];
@ -1100,9 +1112,8 @@ int ListBoxDirectory(HWND hwnd, UINT attrib, LPSTR filespec)
fprintf(stderr,"ListBoxDirectory: %s, %4x\n",filespec,attrib); fprintf(stderr,"ListBoxDirectory: %s, %4x\n",filespec,attrib);
#endif #endif
if ((dp = (struct dosdirent *)DOS_opendir(filespec)) ==NULL) return 0; if ((dp = (struct dosdirent *)DOS_opendir(filespec)) ==NULL) return 0;
while (1) { while (dp = (struct dosdirent *)DOS_readdir(dp)) {
dp = (struct dosdirent *)DOS_readdir(dp); if (!dp->inuse) break;
if (!dp->inuse) break;
#ifdef DEBUG_LISTBOX #ifdef DEBUG_LISTBOX
printf("ListBoxDirectory %08X '%s' !\n", dp->filename, dp->filename); printf("ListBoxDirectory %08X '%s' !\n", dp->filename, dp->filename);
#endif #endif

View File

@ -43,6 +43,7 @@ void mode_command(int);
%token NO_SYMBOL %token NO_SYMBOL
%token SYMBOLFILE %token SYMBOLFILE
%token DEFINE %token DEFINE
%token ABORT
%% %%
@ -52,17 +53,20 @@ void mode_command(int);
line: '\n' line: '\n'
| infocmd '\n' | infocmd '\n'
| error '\n' { yyerrok; } | error '\n' { yyerrok; }
| QUIT '\n' { exit(0); }; | QUIT '\n' { exit(0); }
| HELP '\n' { dbg_help(); }; | 'q' '\n' { exit(0); }
| CONT '\n' { return; }; | HELP '\n' { dbg_help(); }
| SYMBOLFILE IDENTIFIER '\n' { read_symboltable($2); }; | CONT '\n' { return; }
| DEFINE IDENTIFIER expr '\n' { add_hash($2, $3); }; | 'c' '\n' { return; }
| MODE NUM { mode_command($2); }; | ABORT '\n' { kill(getpid(), SIGABRT); }
| ENABLE NUM { enable_break($2); }; | SYMBOLFILE IDENTIFIER '\n' { read_symboltable($2); }
| DISABLE NUM { disable_break($2); }; | DEFINE IDENTIFIER expr '\n' { add_hash($2, $3); }
| BREAK '*' expr { add_break($3); }; | MODE NUM { mode_command($2); }
| ENABLE NUM { enable_break($2); }
| DISABLE NUM { disable_break($2); }
| BREAK '*' expr { add_break($3); }
| x_command | x_command
| BACKTRACE '\n' { dbg_bt(); }; | BACKTRACE '\n' { dbg_bt(); }
| print_command | print_command
| deposit_command | deposit_command
@ -73,12 +77,18 @@ deposit_command:
x_command: x_command:
'x' expr '\n' { examine_memory($2, 1, 'x'); }; 'x' expr '\n' { examine_memory($2, 1, 'x'); }
| 'x' '/' fmt expr '\n' { examine_memory($4, 1, $3); }; | 'x' '/' fmt expr '\n' { examine_memory($4, 1, $3); }
| 'x' '/' NUM fmt expr '\n' { examine_memory($5, $3, $4); }; | 'x' '/' NUM fmt expr '\n' { examine_memory($5, $3, $4); }
print:
'p'
| print
print_command: print_command:
PRINT expr '\n' { examine_memory(((unsigned int) &$2 ), 1, 'x'); }; print expr '\n' { examine_memory(((unsigned int) &$2 ), 1, 'x'); }
| print '/' fmt expr '\n' { examine_memory((unsigned int) &$4, 1, $3); }
| print '/' NUM fmt expr '\n' { examine_memory((unsigned int) &$5, $3, $4); }
fmt: 'x' { $$ = 'x'; } fmt: 'x' { $$ = 'x'; }
| 'd' { $$ = 'd'; } | 'd' { $$ = 'd'; }
@ -92,20 +102,20 @@ x_command:
if($$ == 0xffffffff) { if($$ == 0xffffffff) {
fprintf(stderr,"Symbol %s not found\n", $1); fprintf(stderr,"Symbol %s not found\n", $1);
YYERROR; YYERROR;
}; }
}; }
expr: NUM { $$ = $1; } expr: NUM { $$ = $1; }
| REG { if(regval) $$ = regval[$1]; else application_not_running();} | REG { if(regval) $$ = regval[$1]; else application_not_running();}
| symbol { $$ = *((unsigned int *) $1); } | symbol { $$ = *((unsigned int *) $1); }
| expr '+' NUM { $$ = $1 + $3; } | expr '+' NUM { $$ = $1 + $3; }
| expr '-' NUM { $$ = $1 - $3; }; | expr '-' NUM { $$ = $1 - $3; }
| '(' expr ')' { $$ = $2; }; | '(' expr ')' { $$ = $2; }
| '*' expr { $$ = *((unsigned int *) $2); }; | '*' expr { $$ = *((unsigned int *) $2); }
infocmd: INFO REGS { info_reg(); } infocmd: INFO REGS { info_reg(); }
| INFO STACK { info_stack(); }; | INFO STACK { info_stack(); }
| INFO BREAK { info_break(); }; | INFO BREAK { info_break(); }
%% %%
@ -141,8 +151,10 @@ wine_debug(int signal, int * regs)
#ifdef YYDEBUG #ifdef YYDEBUG
yydebug = 0; yydebug = 0;
#endif #endif
static int dummy_regs[32];
yyin = stdin; yyin = stdin;
regval = regs; regval = regs ? regs : dummy_regs;
#ifdef linux #ifdef linux
if((SC_CS & 7) != 7) { if((SC_CS & 7) != 7) {
@ -151,7 +163,7 @@ wine_debug(int signal, int * regs)
} else { } else {
dbg_mask = 0xffff; dbg_mask = 0xffff;
dbg_mode = 16; dbg_mode = 16;
}; }
#endif #endif
#ifdef __NetBSD__ #ifdef __NetBSD__
if(SC_CS == 0x1f) { if(SC_CS == 0x1f) {
@ -160,7 +172,7 @@ wine_debug(int signal, int * regs)
} else { } else {
dbg_mask = 0xffff; dbg_mask = 0xffff;
dbg_mode = 16; dbg_mode = 16;
}; }
#endif #endif
fprintf(stderr,"In %d bit mode.\n", dbg_mode); fprintf(stderr,"In %d bit mode.\n", dbg_mode);
@ -170,7 +182,7 @@ wine_debug(int signal, int * regs)
if(!loaded_symbols){ if(!loaded_symbols){
loaded_symbols++; loaded_symbols++;
load_entrypoints(); load_entrypoints();
}; }
#endif #endif
/* Remove the breakpoints from memory... */ /* Remove the breakpoints from memory... */
@ -187,7 +199,7 @@ wine_debug(int signal, int * regs)
} }
/* Show where we crashed */ /* Show where we crashed */
if(regval) if(regs)
examine_memory(SC_EIP(dbg_mask), 1, 'i'); examine_memory(SC_EIP(dbg_mask), 1, 'i');
issue_prompt(); issue_prompt();

View File

@ -98,6 +98,7 @@ cont|con|co { return CONT; }
symbolfile|symbolfil|symbolfi|symbolf|symbol|symbo|symb { return SYMBOLFILE; } symbolfile|symbolfil|symbolfi|symbolf|symbol|symbo|symb { return SYMBOLFILE; }
define|defin|defi|def|de { return DEFINE; } define|defin|defi|def|de { return DEFINE; }
abort|abor|abo { return ABORT; }
print|prin|pri|pr { return PRINT; } print|prin|pri|pr { return PRINT; }
mode { return MODE; } mode { return MODE; }
@ -106,13 +107,15 @@ regs|reg|re { return REGS; }
stack|stac|sta|st { return STACK; } stack|stac|sta|st { return STACK; }
x { return 'x'; } p { return 'p'; }
x { return 'x'; }
d { return 'd'; } d { return 'd'; }
i { return 'i'; } i { return 'i'; }
w { return 'w'; } w { return 'w'; }
b { return 'b'; } b { return 'b'; }
s { return 's'; } s { return 's'; }
c { return 'c'; } c { return 'c'; }
q { return 'q'; }
{IDENTIFIER} {yylval = (int) make_symbol(yytext); {IDENTIFIER} {yylval = (int) make_symbol(yytext);
return IDENTIFIER; return IDENTIFIER;

View File

@ -222,7 +222,7 @@ char * helptext[] = {
"of the commands that gdb would accept. The commands currently", "of the commands that gdb would accept. The commands currently",
"are:\n", "are:\n",
" info [reg,stack,break]", " info [reg,stack,break]",
" break <addr>", " break *<addr>",
" enable bpnum", " enable bpnum",
" disable bpnum", " disable bpnum",
" help", " help",
@ -246,10 +246,6 @@ char * helptext[] = {
" symbolfile command. Symbols can also be defined individually with", " symbolfile command. Symbols can also be defined individually with",
" the define command.", " the define command.",
"", "",
"The disassembly code seems to work most of the time, but it does get",
"a little confused at times. The 16 bit mode probably has not been used",
"much so there are probably bugs.",
"",
NULL}; NULL};
void dbg_help(){ void dbg_help(){
@ -286,7 +282,7 @@ void dbg_bt(){
} }
fprintf(stderr,"Backtrace:\n"); fprintf(stderr,"Backtrace:\n");
fprintf(stderr,"%d: %4.4x:%4.4x\n", frameno++, SC_CS, SC_EIP(dbg_mask)); fprintf(stderr,"%d %4.4x:%4.4x\n", frameno++, SC_CS, SC_EIP(dbg_mask));
cs = SC_CS; cs = SC_CS;
frame = (struct frame *) ((SC_EBP(dbg_mask) & ~1) | (SC_SS << 16)); frame = (struct frame *) ((SC_EBP(dbg_mask) & ~1) | (SC_SS << 16));

View File

@ -703,6 +703,9 @@ static char *names8[] = {
static char *names_seg[] = { static char *names_seg[] = {
"%es","%cs","%ss","%ds","%fs","%gs","%?","%?", "%es","%cs","%ss","%ds","%fs","%gs","%?","%?",
}; };
static char *names_rmw[] = {
"%bx,%si","%bx,%di","%bp,%si","%bp,%di","%si","%di","%bp","%bx",
};
struct dis386 grps[][8] = { struct dis386 grps[][8] = {
/* GRP1b */ /* GRP1b */
@ -950,8 +953,9 @@ ckprefix ()
} }
} }
static int machine;
static int dflag; static int dflag;
static int aflag; static int aflag;
static char op1out[100], op2out[100], op3out[100]; static char op1out[100], op2out[100], op3out[100];
static int op_address[3], op_ad, op_index[3]; static int op_address[3], op_ad, op_index[3];
@ -1140,6 +1144,7 @@ print_insn_i286 (pc, info)
bfd_vma pc; bfd_vma pc;
disassemble_info *info; disassemble_info *info;
{ {
machine = 286;
dflag = 0; dflag = 0;
aflag = 0; aflag = 0;
return print_insn_i286_or_i386 (pc, info); return print_insn_i286_or_i386 (pc, info);
@ -1150,6 +1155,7 @@ print_insn_i386 (pc, info)
bfd_vma pc; bfd_vma pc;
disassemble_info *info; disassemble_info *info;
{ {
machine = 386;
dflag = 1; dflag = 1;
aflag = 1; aflag = 1;
return print_insn_i286_or_i386 (pc, info, 36); return print_insn_i286_or_i386 (pc, info, 36);
@ -1555,7 +1561,7 @@ OP_E (bytemode)
append_prefix (); append_prefix ();
if (bytemode == w_mode || (bytemode == v_mode && !dflag)) if (machine == 286)
{ {
if (mod == 0 && rm == 6) if (mod == 0 && rm == 6)
{ {
@ -1579,33 +1585,8 @@ OP_E (bytemode)
oappend (scratchbuf); oappend (scratchbuf);
} }
switch (rm) sprintf (scratchbuf, "(%s)", names_rmw[rm]);
{ oappend (scratchbuf);
case 0:
oappend ("(%bx,%si)");
break;
case 1:
oappend ("(%bx,%di)");
break;
case 2:
oappend ("(%bp,%si)");
break;
case 3:
oappend ("(%bp,%di)");
break;
case 4:
oappend ("(%si)");
break;
case 5:
oappend ("(%di)");
break;
case 6:
oappend ("(%bp)");
break;
case 7:
oappend ("(%bx)");
break;
}
return 0; return 0;
} }

View File

@ -155,7 +155,7 @@ LONG CallWindowProc( FARPROC func, HWND hwnd, WORD message,
user_tab = FindDLLTable("USER"); user_tab = FindDLLTable("USER");
/* DefWindowProc */ /* DefWindowProc */
if (user_tab[104].address == address) if (user_tab[107].address == address)
return DefWindowProc(hwnd, message, wParam, lParam); return DefWindowProc(hwnd, message, wParam, lParam);
/* DefDlgProc */ /* DefDlgProc */

View File

@ -127,7 +127,7 @@ length 490
117 pascal SetDCOrg(word s_word s_word) SetDCOrg(1 2 3) 117 pascal SetDCOrg(word s_word s_word) SetDCOrg(1 2 3)
#121 pascal Death #121 pascal Death
#122 pascal ReSurRection #122 pascal ReSurRection
#123 pascal PlayMetaFile 123 pascal PlayMetaFile(word word) PlayMetaFile(1 2)
#124 pascal GetMetaFile #124 pascal GetMetaFile
125 pascal CreateMetaFile(ptr) CreateMetaFile(1) 125 pascal CreateMetaFile(ptr) CreateMetaFile(1)
126 pascal CloseMetaFile(word) CloseMetaFile(1) 126 pascal CloseMetaFile(word) CloseMetaFile(1)
@ -148,7 +148,8 @@ length 490
153 pascal CreateIC(ptr ptr ptr ptr) CreateIC(1 2 3 4) 153 pascal CreateIC(ptr ptr ptr ptr) CreateIC(1 2 3 4)
154 pascal GetNearestColor(word long) GetNearestColor(1 2) 154 pascal GetNearestColor(word long) GetNearestColor(1 2)
#155 pascal QueryAbort #155 pascal QueryAbort
#156 pascal CreateDiscardableBitmap 156 pascal CreateDiscardableBitmap(word word word)
CreateDiscardableBitmap(1 2 3)
#159 pascal GetMetaFileBits #159 pascal GetMetaFileBits
#160 pascal SetMetaFileBits #160 pascal SetMetaFileBits
161 pascal PtInRegion(word s_word s_word) PtInRegion(1 2 3) 161 pascal PtInRegion(word s_word s_word) PtInRegion(1 2 3)
@ -159,6 +160,7 @@ length 490
172 pascal SetRectRgn(word s_word s_word s_word s_word) SetRectRgn(1 2 3 4 5) 172 pascal SetRectRgn(word s_word s_word s_word s_word) SetRectRgn(1 2 3 4 5)
173 pascal GetClipRgn(word) GetClipRgn(1) 173 pascal GetClipRgn(word) GetClipRgn(1)
#175 pascal EnumMetaFile #175 pascal EnumMetaFile
176 pascal PlayMetaFileRecord(word ptr ptr word) PlayMetaFileRecord(1 2 3 4)
179 pascal GetDCState(word) GetDCState(1) 179 pascal GetDCState(word) GetDCState(1)
180 pascal SetDCState(word word) SetDCState(1 2) 180 pascal SetDCState(word word) SetDCState(1 2)
181 pascal RectInRegionOld(word ptr) RectInRegion(1 2) 181 pascal RectInRegionOld(word ptr) RectInRegion(1 2)

View File

@ -18,7 +18,7 @@ length 415
12 pascal LocalFlags(word) WIN16_LocalFlags(1) 12 pascal LocalFlags(word) WIN16_LocalFlags(1)
13 pascal LocalCompact(word) WIN16_LocalCompact(1) 13 pascal LocalCompact(word) WIN16_LocalCompact(1)
14 return LocalNotify 4 0 14 return LocalNotify 4 0
15 pascal GlobalAlloc(word long) GlobalAlloc(1 2) 15 pascal GlobalAlloc(word long) WIN16_GlobalAlloc(1 2)
16 pascal GlobalReAlloc(word long word) GlobalReAlloc(1 2 3) 16 pascal GlobalReAlloc(word long word) GlobalReAlloc(1 2 3)
17 pascal GlobalFree(word) GlobalFree(1) 17 pascal GlobalFree(word) GlobalFree(1)
18 pascal GlobalLock(word) GlobalLock(1) 18 pascal GlobalLock(word) GlobalLock(1)
@ -203,7 +203,7 @@ length 415
#204 SWAPRECORDING #204 SWAPRECORDING
#205 CVWBREAK #205 CVWBREAK
#206 ALLOCSELECTORARRAY #206 ALLOCSELECTORARRAY
#207 ISDBCSLEADBYTE 207 return IsDBCSLeadByte 2 0
#310 LOCALHANDLEDELTA #310 LOCALHANDLEDELTA
#311 GETSETKERNELDOSPROC #311 GETSETKERNELDOSPROC
#314 DEBUGDEFINESEGMENT #314 DEBUGDEFINESEGMENT

View File

@ -12,5 +12,7 @@
popl %ecx popl %ecx
popl %eax popl %eax
add $16,%esp add $16,%esp
popfl popl %gs:return_value
add $20,%esp add $20,%esp
pushl %gs:return_value
popfl

View File

@ -258,7 +258,7 @@ length 540
#246 EXITWINDOWSEXEC #246 EXITWINDOWSEXEC
247 pascal GetCursor() GetCursor() 247 pascal GetCursor() GetCursor()
248 pascal GetOpenClipboardWindow() GetOpenClipboardWindow() 248 pascal GetOpenClipboardWindow() GetOpenClipboardWindow()
#249 GETASYNCKEYSTATE 249 pascal GetAsyncKeyState(word) GetAsyncKeyState(1)
#250 GETMENUSTATE #250 GETMENUSTATE
#251 SENDDRIVERMESSAGE #251 SENDDRIVERMESSAGE
#252 OPENDRIVER #252 OPENDRIVER
@ -413,13 +413,13 @@ length 540
#509 WNETUNWATCHQUEUE #509 WNETUNWATCHQUEUE
#510 WNETLOCKQUEUEDATA #510 WNETLOCKQUEUEDATA
#511 WNETUNLOCKQUEUEDATA #511 WNETUNLOCKQUEUEDATA
#512 WNETGETCONNECTION 512 pascal WNetGetConnection(ptr ptr ptr) WNetGetConnection(1 2 3)
#513 WNETGETCAPS #513 WNETGETCAPS
#514 WNETDEVICEMODE #514 WNETDEVICEMODE
#515 WNETBROWSEDIALOG #515 WNETBROWSEDIALOG
#516 WNETGETUSER 516 pascal WNetGetUser(ptr ptr ptr) WNetGetUser(1 2 3)
#517 WNETADDCONNECTION 517 pascal WNetAddConnection(ptr ptr ptr) WNetAddConnection(1 2 3)
#518 WNETCANCELCONNECTION 518 pascal WNetCancelConnection(ptr word) WNetCancelConnection(1 2)
#519 WNETGETERROR #519 WNETGETERROR
#520 WNETGETERRORTEXT #520 WNETGETERRORTEXT
#521 WNETENABLE #521 WNETENABLE

View File

@ -26,6 +26,7 @@ typedef struct tagHEADLIST {
void *lpFirst; void *lpFirst;
DWORD dwStyle; DWORD dwStyle;
HWND hWndLogicParent; HWND hWndLogicParent;
HFONT hFont;
} HEADLIST; } HEADLIST;
typedef HEADLIST FAR* LPHEADLIST; typedef HEADLIST FAR* LPHEADLIST;

View File

@ -19,13 +19,16 @@ typedef struct tagMETAFILE
char Filename[80]; /* metafile name, if disk based */ char Filename[80]; /* metafile name, if disk based */
int hFile; /* MSDOS file handle for metafile */ int hFile; /* MSDOS file handle for metafile */
HANDLE hMetaHdr; /* handle of metafile header */ HANDLE hMetaHdr; /* handle of metafile header */
int MetaOffset; /* offset of current record in metafile */ int MetaOffset; /* offset of current record in metafile */
HANDLE hBuffer; /* handle of buffer for disk based metafiles */ HANDLE hBuffer; /* handle of buffer for disk based metafiles */
} METAFILE; } METAFILE;
typedef METAFILE *LPMETAFILE; typedef METAFILE *LPMETAFILE;
BOOL MF_WriteRecord(HMETAFILE hmf, METARECORD *mr, WORD rlen); BOOL MF_WriteRecord(HMETAFILE hmf, METARECORD *mr, WORD rlen);
int MF_AddHandle(HANDLETABLE *ht, WORD htlen, HANDLE hobj);
int MF_AddHandleInternal(HANDLE hobj);
BOOL MF_MetaParam0(DC *dc, short func);
BOOL MF_MetaParam1(DC *dc, short func, short param1); BOOL MF_MetaParam1(DC *dc, short func, short param1);
BOOL MF_MetaParam2(DC *dc, short func, short param1, short param2); BOOL MF_MetaParam2(DC *dc, short func, short param1, short param2);
BOOL MF_MetaParam4(DC *dc, short func, short param1, short param2, BOOL MF_MetaParam4(DC *dc, short func, short param1, short param2,
@ -35,9 +38,9 @@ BOOL MF_MetaParam6(DC *dc, short func, short param1, short param2,
BOOL MF_MetaParam8(DC *dc, short func, short param1, short param2, BOOL MF_MetaParam8(DC *dc, short func, short param1, short param2,
short param3, short param4, short param5, short param3, short param4, short param5,
short param6, short param7, short param8); short param6, short param7, short param8);
BOOL MF_CreateBrushIndirect(DC *dc, LOGBRUSH *logbrush); BOOL MF_CreateBrushIndirect(DC *dc, HBRUSH hBrush, LOGBRUSH *logbrush);
BOOL MF_CreatePatternBrush(DC *dc, LOGBRUSH *logbrush); BOOL MF_CreatePatternBrush(DC *dc, HBRUSH hBrush, LOGBRUSH *logbrush);
BOOL MF_CreatePenIndirect(DC *dc, LOGPEN *logpen); BOOL MF_CreatePenIndirect(DC *dc, HPEN hPen, LOGPEN *logpen);
BOOL MF_TextOut(DC *dc, short x, short y, LPSTR str, short count); BOOL MF_TextOut(DC *dc, short x, short y, LPSTR str, short count);
BOOL MF_MetaPoly(DC *dc, short func, LPPOINT pt, short count); BOOL MF_MetaPoly(DC *dc, short func, LPPOINT pt, short count);

View File

@ -251,7 +251,7 @@ UINT WINAPI waveOutSetVolume(UINT uDeviceID, DWORD dwVolume);
UINT WINAPI waveOutGetErrorText(UINT uError, LPSTR lpText, UINT uSize); UINT WINAPI waveOutGetErrorText(UINT uError, LPSTR lpText, UINT uSize);
UINT WINAPI waveGetErrorText(UINT uError, LPSTR lpText, UINT uSize); UINT WINAPI waveGetErrorText(UINT uError, LPSTR lpText, UINT uSize);
UINT WINAPI waveOutOpen(HWAVEOUT FAR* lphWaveOut, UINT uDeviceID, UINT WINAPI waveOutOpen(HWAVEOUT FAR* lphWaveOut, UINT uDeviceID,
const WAVEFORMAT FAR* lpFormat, DWORD dwCallback, DWORD dwInstance, DWORD dwFlags); const LPWAVEFORMAT lpFormat, DWORD dwCallback, DWORD dwInstance, DWORD dwFlags);
UINT WINAPI waveOutClose(HWAVEOUT hWaveOut); UINT WINAPI waveOutClose(HWAVEOUT hWaveOut);
UINT WINAPI waveOutPrepareHeader(HWAVEOUT hWaveOut, UINT WINAPI waveOutPrepareHeader(HWAVEOUT hWaveOut,
WAVEHDR FAR* lpWaveOutHdr, UINT uSize); WAVEHDR FAR* lpWaveOutHdr, UINT uSize);
@ -278,7 +278,7 @@ UINT WINAPI waveInGetDevCaps(UINT uDeviceID, WAVEINCAPS FAR* lpCaps,
UINT uSize); UINT uSize);
UINT WINAPI waveInGetErrorText(UINT uError, LPSTR lpText, UINT uSize); UINT WINAPI waveInGetErrorText(UINT uError, LPSTR lpText, UINT uSize);
UINT WINAPI waveInOpen(HWAVEIN FAR* lphWaveIn, UINT uDeviceID, UINT WINAPI waveInOpen(HWAVEIN FAR* lphWaveIn, UINT uDeviceID,
const WAVEFORMAT FAR* lpFormat, DWORD dwCallback, DWORD dwInstance, DWORD dwFlags); const LPWAVEFORMAT lpFormat, DWORD dwCallback, DWORD dwInstance, DWORD dwFlags);
UINT WINAPI waveInClose(HWAVEIN hWaveIn); UINT WINAPI waveInClose(HWAVEIN hWaveIn);
UINT WINAPI waveInPrepareHeader(HWAVEIN hWaveIn, UINT WINAPI waveInPrepareHeader(HWAVEIN hWaveIn,
WAVEHDR FAR* lpWaveInHdr, UINT uSize); WAVEHDR FAR* lpWaveInHdr, UINT uSize);
@ -1385,6 +1385,32 @@ typedef struct {
typedef MCI_OVLY_LOAD_PARMS FAR * LPMCI_OVLY_LOAD_PARMS; typedef MCI_OVLY_LOAD_PARMS FAR * LPMCI_OVLY_LOAD_PARMS;
/**************************************************************
* Linux MMSYSTEM Internals & Sample Audio Drivers
*/
typedef struct {
DWORD dwCallback;
DWORD dwInstance;
HMIDIOUT hMidi;
DWORD dwFlags;
} PORTALLOC;
typedef PORTALLOC FAR *LPPORTALLOC;
BOOL DriverCallback(DWORD dwCallBack, UINT uFlags, HANDLE hDev,
WORD wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
DWORD auxMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
DWORD dwParam1, DWORD dwParam2);
DWORD midMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
DWORD dwParam1, DWORD dwParam2);
DWORD modMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
DWORD dwParam1, DWORD dwParam2);
DWORD widMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
DWORD dwParam1, DWORD dwParam2);
DWORD wodMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
DWORD dwParam1, DWORD dwParam2);
#endif /* MMSYSTEM_H */ #endif /* MMSYSTEM_H */

View File

@ -14,6 +14,8 @@ struct options
char * programName; /* To use when loading resources */ char * programName; /* To use when loading resources */
int usePrivateMap; int usePrivateMap;
int synchronous; int synchronous;
int nobackingstore;
int nosaveunders;
short cmdShow; short cmdShow;
int relay_debug; int relay_debug;
int debug; int debug;

View File

@ -82,7 +82,7 @@ extern void load_ne_header (int, struct ne_header_s *);
extern char *GetFilenameFromInstance(unsigned short instance); extern char *GetFilenameFromInstance(unsigned short instance);
extern struct w_files *GetFileInfo(unsigned short instance); extern struct w_files *GetFileInfo(unsigned short instance);
extern HINSTANCE LoadImage(char *modulename, int filetype); extern HINSTANCE LoadImage(char *modulename, int filetype, int change_dir);
extern int _WinMain(int argc, char **argv); extern int _WinMain(int argc, char **argv);
extern void InitializeLoadedDLLs(); extern void InitializeLoadedDLLs();
extern int FixupSegment(struct w_files * wpnt, int segment_num); extern int FixupSegment(struct w_files * wpnt, int segment_num);

View File

@ -46,11 +46,18 @@ HANDLE GetModuleHandle(LPSTR lpModuleName)
{ {
register struct w_files *w = wine_files; register struct w_files *w = wine_files;
int i; int i;
printf("GetModuleHandle('%s');\n", lpModuleName); printf("GetModuleHandle('%x');\n", lpModuleName);
printf("GetModuleHandle // searching in loaded modules\n"); printf("GetModuleHandle // searching in loaded modules\n");
while (w) { while (w) {
/* printf("GetModuleHandle // '%s' \n", w->name); */ /* printf("GetModuleHandle // '%x' \n", w->name); */
if (strcasecmp(w->name, lpModuleName) == 0) { if (((int) lpModuleName & 0xffff0000) == 0) {
if (w->hinstance == (int) lpModuleName) {
printf("GetModuleHandle('%x') return %04X \n",
lpModuleName, w->hinstance);
return w->hinstance;
}
}
else if (strcasecmp(w->name, lpModuleName) == 0) {
printf("GetModuleHandle('%s') return %04X \n", printf("GetModuleHandle('%s') return %04X \n",
lpModuleName, w->hinstance); lpModuleName, w->hinstance);
return w->hinstance; return w->hinstance;
@ -60,13 +67,20 @@ HANDLE GetModuleHandle(LPSTR lpModuleName)
printf("GetModuleHandle // searching in builtin libraries\n"); printf("GetModuleHandle // searching in builtin libraries\n");
for (i = 0; i < N_BUILTINS; i++) { for (i = 0; i < N_BUILTINS; i++) {
if (dll_builtin_table[i].dll_name == NULL) break; if (dll_builtin_table[i].dll_name == NULL) break;
if (strcasecmp(dll_builtin_table[i].dll_name, lpModuleName) == 0) { if (((int) lpModuleName & 0xffff0000) == 0) {
printf("GetModuleHandle('%s') return %04X \n", if (0xFF00 + i == (int) lpModuleName) {
printf("GetModuleHandle('%s') return %04X \n",
lpModuleName, w->hinstance);
return 0xFF + i;
}
}
else if (strcasecmp(dll_builtin_table[i].dll_name, lpModuleName) == 0) {
printf("GetModuleHandle('%x') return %04X \n",
lpModuleName, 0xFF00 + i); lpModuleName, 0xFF00 + i);
return (0xFF00 + i); return (0xFF00 + i);
} }
} }
printf("GetModuleHandle('%s') not found !\n", lpModuleName); printf("GetModuleHandle('%x') not found !\n", lpModuleName);
return 0; return 0;
} }
@ -192,7 +206,7 @@ HANDLE LoadLibrary(LPSTR libname)
lpNewMod->FileName = (LPSTR) malloc(strlen(libname)); lpNewMod->FileName = (LPSTR) malloc(strlen(libname));
if (lpNewMod->FileName != NULL) if (lpNewMod->FileName != NULL)
strcpy(lpNewMod->FileName, libname); strcpy(lpNewMod->FileName, libname);
lpNewMod->hInst = LoadImage(libname, DLL); lpNewMod->hInst = LoadImage(libname, DLL, 0);
lpNewMod->Count = 1; lpNewMod->Count = 1;
printf("LoadLibrary returned Library hInst=%04X\n", lpNewMod->hInst); printf("LoadLibrary returned Library hInst=%04X\n", lpNewMod->hInst);
GlobalUnlock(hModule); GlobalUnlock(hModule);
@ -315,7 +329,7 @@ FARPROC GetProcAddress(HANDLE hModule, char *proc_name)
break; break;
} }
cpnt += len + 2; cpnt += len + 2;
}; }
if (ordinal == 0) if (ordinal == 0)
{ {
printf("GetProcAddress // function '%s' not found !\n", proc_name); printf("GetProcAddress // function '%s' not found !\n", proc_name);

View File

@ -60,9 +60,12 @@ SEGDESC Segments[MAX_SELECTORS];
extern void KERNEL_Ordinal_102(); extern void KERNEL_Ordinal_102();
extern void UNIXLIB_Ordinal_0(); extern void UNIXLIB_Ordinal_0();
extern char *WIN_ProgramName;
extern char WindowsPath[256];
extern char **Argv; extern char **Argv;
extern int Argc; extern int Argc;
extern char **environ;
/********************************************************************** /**********************************************************************
* FindUnusedSelectors * FindUnusedSelectors
@ -709,7 +712,9 @@ LPSTR GetDOSEnvironment(void)
static SEGDESC * static SEGDESC *
CreateEnvironment(void) CreateEnvironment(void)
{ {
char **e;
char *p; char *p;
unsigned short *w;
SEGDESC * s; SEGDESC * s;
s = CreateNewSegments(0, 0, PAGE_SIZE, 1); s = CreateNewSegments(0, 0, PAGE_SIZE, 1);
@ -717,15 +722,36 @@ CreateEnvironment(void)
return NULL; return NULL;
/* /*
* Fill environment with meaningless babble. * Fill environment with Windows path, the Unix environment,
* and program name.
*/ */
p = (char *) s->base_addr; p = (char *) s->base_addr;
strcpy(p, "PATH=C:\\WINDOWS"); strcpy(p, "PATH=");
strcat(p, WindowsPath);
p += strlen(p) + 1; p += strlen(p) + 1;
for (e = environ; *e; e++)
{
if (strncasecmp(*e, "path", 4))
{
strcpy(p, *e);
p += strlen(p) + 1;
}
}
*p++ = '\0'; *p++ = '\0';
*p++ = 11; w = (unsigned short *) p;
*p++ = 0; *w = strlen(WIN_ProgramName);
strcpy(p, "C:\\TEST.EXE"); strcpy(p + 2, WIN_ProgramName);
/*
* Display environment
*/
fprintf(stderr, "Environment at %08.8x\n", s->base_addr);
for (p = s->base_addr; *p; p += strlen(p) + 1)
fprintf(stderr, " %s\n", p);
p += 3;
fprintf(stderr, " Program: %s\n", p);
return s; return s;
} }
@ -769,12 +795,13 @@ CreatePSP(void)
strlen(Argv[i]) > 124) strlen(Argv[i]) > 124)
break; break;
if (i != 1)
*p1++ = ' ';
for (p2 = Argv[i]; *p2 != '\0'; ) for (p2 = Argv[i]; *p2 != '\0'; )
*p1++ = *p2++; *p1++ = *p2++;
*p1++ = ' ';
} }
*p1++ = '\r';
*p1 = '\0'; *p1 = '\0';
psp->pspCommandTailCount = strlen(psp->pspCommandTail); psp->pspCommandTailCount = strlen(psp->pspCommandTail);
@ -903,7 +930,8 @@ CreateSelectors(struct w_files * wpnt)
Segments[s->selector >> 3].owner = auto_data_sel; Segments[s->selector >> 3].owner = auto_data_sel;
if (s->selector == auto_data_sel) if (s->selector == auto_data_sel)
HEAP_LocalInit(auto_data_sel, s->base_addr + saved_old_length, HEAP_LocalInit(auto_data_sel, s->base_addr + saved_old_length,
ne_header->local_heap_length); 0x10000 - 2 - saved_old_length
- ne_header->stack_length);
} }
if(!EnvironmentSelector) { if(!EnvironmentSelector) {

View File

@ -34,6 +34,8 @@ extern void CallTo32();
char * GetModuleName(struct w_files * wpnt, int index, char *buffer); char * GetModuleName(struct w_files * wpnt, int index, char *buffer);
extern unsigned char ran_out; extern unsigned char ran_out;
extern char WindowsPath[256]; extern char WindowsPath[256];
char *WIN_ProgramName;
unsigned short WIN_StackSize; unsigned short WIN_StackSize;
unsigned short WIN_HeapSize; unsigned short WIN_HeapSize;
@ -124,24 +126,46 @@ void load_ne_header (int fd, struct ne_header_s *ne_header)
* LoadImage * LoadImage
* Load one NE format executable into memory * Load one NE format executable into memory
*/ */
HINSTANCE LoadImage(char *modulename, int filetype) HINSTANCE LoadImage(char *modulename, int filetype, int change_dir)
{ {
unsigned int read_size; unsigned int read_size;
int i; int i;
struct w_files * wpnt, *wpnt1; struct w_files * wpnt, *wpnt1;
unsigned int status; unsigned int status;
char buffer[256]; char buffer[256];
char *fullname;
/* /*
* search file * search file
*/ */
if (FindFile(buffer, sizeof(buffer), modulename, (filetype == EXE ? fullname = FindFile(buffer, sizeof(buffer), modulename,
EXE_Extensions : DLL_Extensions), WindowsPath) ==NULL) (filetype == EXE ? EXE_Extensions : DLL_Extensions),
WindowsPath);
if (fullname == NULL)
{ {
fprintf(stderr, "LoadImage: I can't find %s.dll | %s.exe !\n",modulename, modulename); fprintf(stderr, "LoadImage: I can't find %s.dll | %s.exe !\n",
modulename, modulename);
return (HINSTANCE) NULL; return (HINSTANCE) NULL;
} }
fprintf(stderr,"LoadImage: loading %s (%s)\n", modulename, buffer);
fullname = GetDosFileName(fullname);
WIN_ProgramName = strdup(fullname);
fprintf(stderr,"LoadImage: loading %s (%s)\n [%s]\n",
modulename, buffer, WIN_ProgramName);
if (change_dir && fullname)
{
char dirname[256];
char *p;
strcpy(dirname, fullname);
p = strrchr(dirname, '\\');
*p = '\0';
DOS_SetDefaultDrive(dirname[0] - 'A');
DOS_ChangeDir(dirname[0] - 'A', dirname + 2);
}
/* First allocate a spot to store the info we collect, and add it to /* First allocate a spot to store the info we collect, and add it to
* our linked list. * our linked list.
@ -257,7 +281,7 @@ HINSTANCE LoadImage(char *modulename, int filetype)
if(FindDLLTable(buff)) continue; /* This module already loaded */ if(FindDLLTable(buff)) continue; /* This module already loaded */
#endif #endif
LoadImage(buff, DLL); LoadImage(buff, DLL, 0);
/* /*
fprintf(stderr,"Unable to load:%s\n", buff); fprintf(stderr,"Unable to load:%s\n", buff);
*/ */
@ -297,7 +321,7 @@ _WinMain(int argc, char **argv)
strcat(WinePath, p); strcat(WinePath, p);
} }
if ((hInstMain = LoadImage(Argv[0], EXE)) == (HINSTANCE) NULL ) { if ((hInstMain = LoadImage(Argv[0], EXE, 1)) == (HINSTANCE) NULL ) {
fprintf(stderr, "wine: can't find %s!.\n", Argv[0]); fprintf(stderr, "wine: can't find %s!.\n", Argv[0]);
exit(1); exit(1);
} }

View File

@ -1,6 +1,7 @@
static char RCSId[] = "$Id: global.c,v 1.2 1993/07/04 04:04:21 root Exp root $"; static char RCSId[] = "$Id: global.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
/* #define DEBUG_HEAP /* */
#define GLOBAL_SOURCE #define GLOBAL_SOURCE
#include <stdio.h> #include <stdio.h>
@ -406,21 +407,23 @@ GlobalFlags(unsigned int block)
unsigned int unsigned int
GlobalSize(unsigned int block) GlobalSize(unsigned int block)
{ {
GDESC *g; GDESC *g = GlobalGetGDesc(block);
if (block == 0) if (g == NULL)
return 0; return 0;
/* if (g->sequence == 0)
* Find GDESC for this block.
*/
for (g = GlobalList; g != NULL; g = g->next)
{ {
if (g->handle == block) MDESC *m = (MDESC *) g->addr - 1;
return g->length;
return m->length;
} }
else if (g->sequence >= 1)
return 0; {
return g->length * 0x10000;
}
return g->length;
} }
/********************************************************************** /**********************************************************************

View File

@ -9,7 +9,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "heap.h" #include "heap.h"
#include "regfunc.h" #include "regfunc.h"
/* #define DEBUG_HEAP */ /* #define DEBUG_HEAP /* */
LHEAP *LocalHeaps = NULL; LHEAP *LocalHeaps = NULL;

View File

@ -3,11 +3,13 @@
MODULE = misc MODULE = misc
SRCS = \ SRCS = \
audio.c \
atom.c \ atom.c \
clipboard.c \ clipboard.c \
comm.c \ comm.c \
cursor.c \ cursor.c \
dos_fs.c \ dos_fs.c \
driver.c \
exec.c \ exec.c \
file.c \ file.c \
keyboard.c \ keyboard.c \
@ -15,6 +17,7 @@ SRCS = \
main.c \ main.c \
message.c \ message.c \
mmsystem.c \ mmsystem.c \
network.c \
profile.c \ profile.c \
property.c \ property.c \
rect.c \ rect.c \

View File

@ -19,7 +19,7 @@
#include "wine.h" #include "wine.h"
#include "windows.h" #include "windows.h"
#define DEBUG_COMM /* #define DEBUG_COMM /* */
#define MAX_PORTS 16 #define MAX_PORTS 16
@ -155,7 +155,7 @@ fprintf(stderr,"BuildCommDCB: (%s), ptr %d\n", device, (long) lpdcb);
#endif #endif
commerror = 0; commerror = 0;
if (!strncmp(device,"COM",3)) { if (!strncasecmp(device,"COM",3)) {
port = device[3] - '0'; port = device[3] - '0';
@ -170,8 +170,7 @@ fprintf(stderr,"BuildCommDCB: (%s), ptr %d\n", device, (long) lpdcb);
} }
if (!COM[port].fd) { if (!COM[port].fd) {
commerror = IE_NOPEN; OpenComm(device, 0, 0);
return -1;
} }
lpdcb->Id = COM[port].fd; lpdcb->Id = COM[port].fd;
@ -246,7 +245,7 @@ fprintf(stderr,"OpenComm: %s, %d, %d\n", device, cbInQueue, cbOutQueue);
commerror = 0; commerror = 0;
if (!strncmp(device,"COM",3)) { if (!strncasecmp(device,"COM",3)) {
port = device[3] - '0'; port = device[3] - '0';
if (port-- == 0) { if (port-- == 0) {
@ -259,8 +258,7 @@ fprintf(stderr,"OpenComm: %s, %d, %d\n", device, cbInQueue, cbOutQueue);
return -1; return -1;
} }
if (COM[port].fd) { if (COM[port].fd) {
commerror = IE_OPEN; return COM[port].fd;
return -1;
} }
fd = open(COM[port].devicename, O_RDWR | O_NONBLOCK, 0); fd = open(COM[port].devicename, O_RDWR | O_NONBLOCK, 0);
@ -273,7 +271,7 @@ fprintf(stderr,"OpenComm: %s, %d, %d\n", device, cbInQueue, cbOutQueue);
} }
} }
else else
if (!strncmp(device,"LPT",3)) { if (!strncasecmp(device,"LPT",3)) {
port = device[3] - '0'; port = device[3] - '0';
if (!ValidLPTPort(port)) { if (!ValidLPTPort(port)) {

View File

@ -28,7 +28,7 @@
#include "prototypes.h" #include "prototypes.h"
#include "autoconf.h" #include "autoconf.h"
/* #define DEBUG */ /* #define DEBUG /* */
#define WINE_INI_USER "~/.winerc" #define WINE_INI_USER "~/.winerc"
#define MAX_OPEN_DIRS 16 #define MAX_OPEN_DIRS 16
@ -363,7 +363,7 @@ char *GetUnixFileName(char *dosfilename)
{ {
/* a:\windows\system.ini => /dos/windows/system.ini */ /* a:\windows\system.ini => /dos/windows/system.ini */
char temp[256]; static char temp[256];
int drive; int drive;
if (dosfilename[1] == ':') if (dosfilename[1] == ':')
@ -393,7 +393,7 @@ char *GetUnixFileName(char *dosfilename)
char *GetDosFileName(char *unixfilename) char *GetDosFileName(char *unixfilename)
{ {
int i; int i;
char temp[256]; static char temp[256];
/* /dos/windows/system.ini => c:\windows\system.ini */ /* /dos/windows/system.ini => c:\windows\system.ini */
for (i = 0 ; i != MAX_DOS_DRIVES; i++) { for (i = 0 ; i != MAX_DOS_DRIVES; i++) {

View File

@ -45,7 +45,7 @@ extern int CallToInit16(unsigned long csip, unsigned long sssp,
unsigned short ds); unsigned short ds);
HANDLE CreateNewTask(HINSTANCE hInst); HANDLE CreateNewTask(HINSTANCE hInst);
#ifndef WINELIB
void InitializeLoadedNewDLLs(HINSTANCE hInst) void InitializeLoadedNewDLLs(HINSTANCE hInst)
{ {
struct w_files * w; struct w_files * w;
@ -127,7 +127,12 @@ void StartNewTask(HINSTANCE hInst)
} }
#else
void StartNewTask (HINSTANCE hInst)
{
printf ("Not yet implemented\n");
}
#endif
/********************************************************************** /**********************************************************************
* LoadModule [KERNEL.45] * LoadModule [KERNEL.45]
@ -172,7 +177,7 @@ WORD WinExec(LPSTR lpCmdLine, WORD nCmdShow)
printf("Can't 'fork' process !\n"); printf("Can't 'fork' process !\n");
break; break;
case 0: case 0:
if ((hInst = LoadImage(ArgV[0], EXE)) == (HINSTANCE) NULL ) { if ((hInst = LoadImage(ArgV[0], EXE, 1)) == (HINSTANCE) NULL ) {
fprintf(stderr, "wine: can't find %s!.\n", ArgV[0]); fprintf(stderr, "wine: can't find %s!.\n", ArgV[0]);
printf("Child process died !\n"); printf("Child process died !\n");
exit(1); exit(1);

View File

@ -17,8 +17,6 @@
* *
************************************************************************/ ************************************************************************/
/* #define DEBUG_FILE */
#include <stdio.h> #include <stdio.h>
#include <fcntl.h> #include <fcntl.h>
#include <limits.h> #include <limits.h>
@ -27,7 +25,7 @@
#include <windows.h> #include <windows.h>
#include "prototypes.h" #include "prototypes.h"
/* #define DEBUG_FILE */ /* #define DEBUG_FILE /* */
char WindowsDirectory[256], SystemDirectory[256], TempDirectory[256]; char WindowsDirectory[256], SystemDirectory[256], TempDirectory[256];
@ -87,9 +85,11 @@ INT _lwrite (INT hFile, LPSTR lpBuffer, INT wBytes)
{ {
int result; int result;
#if 0
#ifdef DEBUG_FILE #ifdef DEBUG_FILE
fprintf(stderr, "_lwrite: handle %d, buffer = %ld, length = %d\n", fprintf(stderr, "_lwrite: handle %d, buffer = %ld, length = %d\n",
hFile, (int) lpBuffer, wBytes); hFile, (int) lpBuffer, wBytes);
#endif
#endif #endif
result = write (hFile, lpBuffer, wBytes); result = write (hFile, lpBuffer, wBytes);
@ -121,38 +121,61 @@ INT _lclose (INT hFile)
**************************************************************************/ **************************************************************************/
INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle) INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
{ {
int base,flags; int base, flags;
int handle; int handle;
#ifdef DEBUG_FILE
fprintf(stderr,"Openfile(%s,<struct>,%d) ",lpFileName,wStyle);
#endif
base=wStyle&0xF;
flags=wStyle&0xFFF0;
flags&=0xFF0F; /* strip SHARE bits for now */
flags&=0xD7FF; /* strip PROMPT & CANCEL bits for now */
flags&=0x7FFF; /* strip REOPEN bit for now */
flags&=0xFBFF; /* strib VERIFY bit for now */
if(flags&OF_CREATE) { base |=O_CREAT; flags &=0xEFFF; }
#ifdef DEBUG_FILE #ifdef DEBUG_FILE
fprintf(stderr,"now %d,%d\n",base,flags); fprintf(stderr,"Openfile(%s,<struct>,%d) ",lpFileName,wStyle);
#endif #endif
if (flags & OF_EXIST) { base = wStyle & 0xF;
printf("OpenFile // OF_EXIST '%s' !\n", lpFileName); flags = wStyle & 0xFFF0;
handle = _lopen (lpFileName, wStyle);
close(handle); flags &= 0xFF0F; /* strip SHARE bits for now */
return handle; flags &= 0xD7FF; /* strip PROMPT & CANCEL bits for now */
} flags &= 0x7FFF; /* strip REOPEN bit for now */
if (flags & OF_DELETE) { flags &= 0xFBFF; /* strib VERIFY bit for now */
printf("OpenFile // OF_DELETE '%s' !\n", lpFileName);
return unlink(lpFileName); if (flags & OF_CREATE)
} {
else { base |= O_CREAT;
return _lopen (lpFileName, wStyle); flags &= 0xEFFF;
} }
#ifdef DEBUG_FILE
fprintf(stderr,"now %d,%d\n",base,flags);
#endif
if (flags & OF_EXIST)
{
printf("OpenFile // OF_EXIST '%s' !\n", lpFileName);
handle = _lopen (lpFileName, wStyle);
close(handle);
return handle;
}
if (flags & OF_DELETE)
{
printf("OpenFile // OF_DELETE '%s' !\n", lpFileName);
return unlink(lpFileName);
}
else
{
int handle;
char *UnixFileName;
if ((UnixFileName = GetUnixFileName(lpFileName)) == NULL)
return HFILE_ERROR;
handle = open(UnixFileName, base, 0666);
#ifdef DEBUG_FILE
fprintf(stderr, "OpenFile: returning %04.4x\n", handle);
#endif
if (handle == -1)
return HFILE_ERROR;
else
return handle;
}
} }
/************************************************************************** /**************************************************************************

View File

@ -40,6 +40,8 @@ struct options Options =
NULL, /* programName */ NULL, /* programName */
FALSE, /* usePrivateMap */ FALSE, /* usePrivateMap */
FALSE, /* synchronous */ FALSE, /* synchronous */
FALSE, /* no backing store */
FALSE, /* no save unders */
SW_SHOWNORMAL, /* cmdShow */ SW_SHOWNORMAL, /* cmdShow */
FALSE FALSE
}; };
@ -47,16 +49,18 @@ struct options Options =
static XrmOptionDescRec optionsTable[] = static XrmOptionDescRec optionsTable[] =
{ {
{ "-desktop", ".desktop", XrmoptionSepArg, (caddr_t)NULL }, { "-desktop", ".desktop", XrmoptionSepArg, (caddr_t)NULL },
{ "-depth", ".depth", XrmoptionSepArg, (caddr_t)NULL }, { "-depth", ".depth", XrmoptionSepArg, (caddr_t)NULL },
{ "-display", ".display", XrmoptionSepArg, (caddr_t)NULL }, { "-display", ".display", XrmoptionSepArg, (caddr_t)NULL },
{ "-iconic", ".iconic", XrmoptionNoArg, (caddr_t)"on" }, { "-iconic", ".iconic", XrmoptionNoArg, (caddr_t)"on" },
{ "-name", ".name", XrmoptionSepArg, (caddr_t)NULL }, { "-name", ".name", XrmoptionSepArg, (caddr_t)NULL },
{ "-privatemap", ".privatemap", XrmoptionNoArg, (caddr_t)"on" }, { "-privatemap", ".privatemap", XrmoptionNoArg, (caddr_t)"on" },
{ "-synchronous", ".synchronous", XrmoptionNoArg, (caddr_t)"on" }, { "-synchronous", ".synchronous", XrmoptionNoArg, (caddr_t)"on" },
{ "-spy", ".spy", XrmoptionSepArg, (caddr_t)NULL }, { "-nobackingstore",".nobackingstore", XrmoptionNoArg, (caddr_t)"on" },
{ "-debug", ".debug", XrmoptionNoArg, (caddr_t)"on" }, { "-nosaveunders", ".nosaveunders", XrmoptionNoArg, (caddr_t)"on" },
{ "-relaydbg", ".relaydbg", XrmoptionNoArg, (caddr_t)"on" } { "-spy", ".spy", XrmoptionSepArg, (caddr_t)NULL },
{ "-debug", ".debug", XrmoptionNoArg, (caddr_t)"on" },
{ "-relaydbg", ".relaydbg", XrmoptionNoArg, (caddr_t)"on" }
}; };
#define NB_OPTIONS (sizeof(optionsTable) / sizeof(optionsTable[0])) #define NB_OPTIONS (sizeof(optionsTable) / sizeof(optionsTable[0]))
@ -73,6 +77,8 @@ static XrmOptionDescRec optionsTable[] =
" -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" \
" -synchronous Turn on synchronous display mode\n" \ " -synchronous Turn on synchronous display mode\n" \
" -nobackingstore Turn off backing store\n" \
" -nosaveunders Turn off saveunders\n" \
" -spy file Turn on message spying to the specified file\n" \ " -spy file Turn on message spying to the specified file\n" \
" -relaydbg Display call relay information\n" " -relaydbg Display call relay information\n"
@ -177,6 +183,10 @@ static void MAIN_ParseOptions( int *argc, char *argv[] )
Options.usePrivateMap = TRUE; Options.usePrivateMap = TRUE;
if (MAIN_GetResource( db, ".synchronous", &value )) if (MAIN_GetResource( db, ".synchronous", &value ))
Options.synchronous = TRUE; Options.synchronous = TRUE;
if (MAIN_GetResource( db, ".nosaveunders", &value ))
Options.nosaveunders = TRUE;
if (MAIN_GetResource( db, ".nobackingstore", &value ))
Options.nobackingstore = TRUE;
if (MAIN_GetResource( db, ".relaydbg", &value )) if (MAIN_GetResource( db, ".relaydbg", &value ))
Options.relay_debug = TRUE; Options.relay_debug = TRUE;
if (MAIN_GetResource( db, ".debug", &value )) if (MAIN_GetResource( db, ".debug", &value ))
@ -217,10 +227,21 @@ static void MAIN_CreateDesktop( int argc, char *argv[] )
StructureNotifyMask; StructureNotifyMask;
win_attr.cursor = XCreateFontCursor( display, XC_top_left_arrow ); win_attr.cursor = XCreateFontCursor( display, XC_top_left_arrow );
if (Options.nobackingstore)
win_attr.backing_store = NotUseful;
else
win_attr.backing_store = Always;
if (Options.nosaveunders)
win_attr.save_under = FALSE;
else
win_attr.save_under = TRUE;
rootWindow = XCreateWindow( display, DefaultRootWindow(display), rootWindow = XCreateWindow( display, DefaultRootWindow(display),
desktopX, desktopY, width, height, 0, desktopX, desktopY, width, height, 0,
CopyFromParent, InputOutput, CopyFromParent, CopyFromParent, InputOutput, CopyFromParent,
CWEventMask | CWCursor, &win_attr ); CWEventMask | CWCursor | CWSaveUnder |
CWBackingStore, &win_attr );
/* Set window manager properties */ /* Set window manager properties */
@ -324,14 +345,12 @@ int main( int argc, char *argv[] )
#ifndef sunos #ifndef sunos
atexit(called_at_exit); atexit(called_at_exit);
#else
on_exit (called_at_exit, 0);
#endif #endif
ret_val = _WinMain( argc, argv ); ret_val = _WinMain( argc, argv );
#ifdef sunos
called_at_exit();
#endif
return ret_val; return ret_val;
} }

View File

@ -54,6 +54,9 @@ int MessageBox(HWND hWnd, LPSTR str, LPSTR title, WORD type)
DWORD dwStyle; DWORD dwStyle;
HINSTANCE hInst; HINSTANCE hInst;
int nRet; int nRet;
if (title == NULL)
title = "Error";
wndPtr = WIN_FindWndPtr(hWnd); wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == NULL) { if (wndPtr == NULL) {
hInst = hSysRes; hInst = hSysRes;

View File

@ -24,7 +24,9 @@ int MCI_LibMain(HANDLE hInstance, WORD wDataSeg,
return(TRUE); return(TRUE);
} }
/**************************************************************************
* sndPlaySound [MMSYSTEM.2]
*/
BOOL WINAPI sndPlaySound(LPCSTR lpszSoundName, UINT uFlags) BOOL WINAPI sndPlaySound(LPCSTR lpszSoundName, UINT uFlags)
{ {
printf("sndPlaySound // lpszSoundName='%s' uFlags=%04X !\n", printf("sndPlaySound // lpszSoundName='%s' uFlags=%04X !\n",
@ -32,58 +34,68 @@ BOOL WINAPI sndPlaySound(LPCSTR lpszSoundName, UINT uFlags)
return 0; return 0;
} }
/**************************************************************************
* mmsystemGetVersion [MMSYSTEM.5]
*/
WORD WINAPI mmsystemGetVersion() WORD WINAPI mmsystemGetVersion()
{ {
printf("mmsystemGetVersion // 0.4.0 ...?... :-) !\n"); printf("mmsystemGetVersion // 0.4.0 ...?... :-) !\n");
return(0x0040); return(0x0040);
} }
/**************************************************************************
* OutputDebugStr [MMSYSTEM.30]
*/
void WINAPI OutputDebugStr(LPCSTR str) void WINAPI OutputDebugStr(LPCSTR str)
{ {
printf("OutputDebugStr('%s');\n", str); printf("OutputDebugStr('%s');\n", str);
} }
/**************************************************************************
* auxGetNumDevs [MMSYSTEM.350]
*/
UINT WINAPI auxGetNumDevs() UINT WINAPI auxGetNumDevs()
{ {
printf("auxGetNumDevs !\n"); printf("auxGetNumDevs !\n");
return 0; return 0;
} }
/**************************************************************************
* auxGetDevCaps [MMSYSTEM.351]
*/
UINT WINAPI auxGetDevCaps(UINT uDeviceID, AUXCAPS FAR* lpCaps, UINT uSize) UINT WINAPI auxGetDevCaps(UINT uDeviceID, AUXCAPS FAR* lpCaps, UINT uSize)
{ {
printf("auxGetDevCaps !\n"); printf("auxGetDevCaps !\n");
return 0; return 0;
} }
/**************************************************************************
* auxGetVolume [MMSYSTEM.352]
*/
UINT WINAPI auxGetVolume(UINT uDeviceID, DWORD FAR* lpdwVolume) UINT WINAPI auxGetVolume(UINT uDeviceID, DWORD FAR* lpdwVolume)
{ {
printf("auxGetVolume !\n"); printf("auxGetVolume !\n");
return 0; return 0;
} }
/**************************************************************************
* auxSetVolume [MMSYSTEM.353]
*/
UINT WINAPI auxSetVolume(UINT uDeviceID, DWORD dwVolume) UINT WINAPI auxSetVolume(UINT uDeviceID, DWORD dwVolume)
{ {
printf("auxSetVolume !\n"); printf("auxSetVolume !\n");
return 0; return 0;
} }
/**************************************************************************
* auxOutMessage [MMSYSTEM.354]
*/
DWORD WINAPI auxOutMessage(UINT uDeviceID, UINT uMessage, DWORD dw1, DWORD dw2) DWORD WINAPI auxOutMessage(UINT uDeviceID, UINT uMessage, DWORD dw1, DWORD dw2)
{ {
printf("auxOutMessage !\n"); printf("auxOutMessage !\n");
return 0L; return 0L;
} }
/************************************************************************** /**************************************************************************
* mciGetErrorString [MMSYSTEM.706] * mciGetErrorString [MMSYSTEM.706]
*/ */
@ -402,8 +414,7 @@ DWORD mciOpen(UINT wDevID, DWORD dwParam, LPMCI_OPEN_PARMS lpParms)
return MCIERR_DEVICE_NOT_INSTALLED; return MCIERR_DEVICE_NOT_INSTALLED;
case MCI_DEVTYPE_SEQUENCER: case MCI_DEVTYPE_SEQUENCER:
printf("MCI_OPEN // No SEQUENCER yet !\n"); printf("MCI_OPEN // No SEQUENCER yet !\n");
break; return MCIERR_DEVICE_NOT_INSTALLED;
/* return MCIERR_DEVICE_NOT_INSTALLED; */
case MCI_DEVTYPE_ANIMATION: case MCI_DEVTYPE_ANIMATION:
printf("MCI_OPEN // No ANIMATION yet !\n"); printf("MCI_OPEN // No ANIMATION yet !\n");
return MCIERR_DEVICE_NOT_INSTALLED; return MCIERR_DEVICE_NOT_INSTALLED;
@ -540,7 +551,6 @@ DWORD mciSendCommand(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwParam2)
return MCIERR_DEVICE_NOT_INSTALLED; return MCIERR_DEVICE_NOT_INSTALLED;
} }
/************************************************************************** /**************************************************************************
* mciGetDeviceID [MMSYSTEM.703] * mciGetDeviceID [MMSYSTEM.703]
*/ */
@ -550,8 +560,6 @@ UINT mciGetDeviceID (LPCSTR lpstrName)
return 0; return 0;
} }
/************************************************************************** /**************************************************************************
* mciSendString [MMSYSTEM.702] * mciSendString [MMSYSTEM.702]
*/ */
@ -564,16 +572,47 @@ DWORD WINAPI mciSendString (LPCSTR lpstrCommand,
return MCIERR_MISSING_COMMAND_STRING; return MCIERR_MISSING_COMMAND_STRING;
} }
/**************************************************************************
* mciSetYieldProc [MMSYSTEM.714]
*/
BOOL WINAPI mciSetYieldProc (UINT uDeviceID,
YIELDPROC fpYieldProc, DWORD dwYieldData)
{
}
/**************************************************************************
* mciGetDeviceIDFromElementID [MMSYSTEM.715]
*/
UINT WINAPI mciGetDeviceIDFromElementID(DWORD dwElementID, LPCSTR lpstrType)
{
}
/**************************************************************************
* mciGetYieldProc [MMSYSTEM.716]
*/
YIELDPROC WINAPI mciGetYieldProc(UINT uDeviceID, DWORD FAR* lpdwYieldData)
{
}
/**************************************************************************
* mciGetCreatorTask [MMSYSTEM.717]
*/
HTASK WINAPI mciGetCreatorTask(UINT uDeviceID)
{
}
/**************************************************************************
* midiOutGetNumDevs [MMSYSTEM.201]
*/
UINT WINAPI midiOutGetNumDevs(void) UINT WINAPI midiOutGetNumDevs(void)
{ {
printf("midiOutGetNumDevs\n"); printf("midiOutGetNumDevs\n");
return 0; return 0;
} }
/**************************************************************************
* midiOutGetDevCaps [MMSYSTEM.202]
*/
UINT WINAPI midiOutGetDevCaps(UINT uDeviceID, UINT WINAPI midiOutGetDevCaps(UINT uDeviceID,
MIDIOUTCAPS FAR* lpCaps, UINT uSize) MIDIOUTCAPS FAR* lpCaps, UINT uSize)
{ {
@ -581,23 +620,8 @@ UINT WINAPI midiOutGetDevCaps(UINT uDeviceID,
return 0; return 0;
} }
UINT WINAPI midiOutGetVolume(UINT uDeviceID, DWORD FAR* lpdwVolume)
{
printf("midiOutGetVolume\n");
return 0;
}
UINT WINAPI midiOutSetVolume(UINT uDeviceID, DWORD dwVolume)
{
printf("midiOutSetVolume\n");
return 0;
}
/************************************************************************** /**************************************************************************
* midiOutGetErrorText [MMSYSTEM.203] * midiOutGetErrorText [MMSYSTEM.203]
*/ */
UINT WINAPI midiOutGetErrorText(UINT uError, LPSTR lpText, UINT uSize) UINT WINAPI midiOutGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
{ {
@ -654,7 +678,9 @@ msg# 343 : There are no MIDI devices installed on the system. Use the Drivers op
return(TRUE); return(TRUE);
} }
/**************************************************************************
* midiOutOpen [MMSYSTEM.204]
*/
UINT WINAPI midiOutOpen(HMIDIOUT FAR* lphMidiOut, UINT uDeviceID, UINT WINAPI midiOutOpen(HMIDIOUT FAR* lphMidiOut, UINT uDeviceID,
DWORD dwCallback, DWORD dwInstance, DWORD dwFlags) DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
{ {
@ -663,14 +689,18 @@ UINT WINAPI midiOutOpen(HMIDIOUT FAR* lphMidiOut, UINT uDeviceID,
return 0; return 0;
} }
/**************************************************************************
* midiOutClose [MMSYSTEM.205]
*/
UINT WINAPI midiOutClose(HMIDIOUT hMidiOut) UINT WINAPI midiOutClose(HMIDIOUT hMidiOut)
{ {
printf("midiOutClose\n"); printf("midiOutClose\n");
return 0; return 0;
} }
/**************************************************************************
* midiOutPrepareHeader [MMSYSTEM.206]
*/
UINT WINAPI midiOutPrepareHeader(HMIDIOUT hMidiOut, UINT WINAPI midiOutPrepareHeader(HMIDIOUT hMidiOut,
MIDIHDR FAR* lpMidiOutHdr, UINT uSize) MIDIHDR FAR* lpMidiOutHdr, UINT uSize)
{ {
@ -678,7 +708,9 @@ UINT WINAPI midiOutPrepareHeader(HMIDIOUT hMidiOut,
return 0; return 0;
} }
/**************************************************************************
* midiOutUnprepareHeader [MMSYSTEM.207]
*/
UINT WINAPI midiOutUnprepareHeader(HMIDIOUT hMidiOut, UINT WINAPI midiOutUnprepareHeader(HMIDIOUT hMidiOut,
MIDIHDR FAR* lpMidiOutHdr, UINT uSize) MIDIHDR FAR* lpMidiOutHdr, UINT uSize)
{ {
@ -686,14 +718,18 @@ UINT WINAPI midiOutUnprepareHeader(HMIDIOUT hMidiOut,
return 0; return 0;
} }
/**************************************************************************
* midiOutShortMsg [MMSYSTEM.208]
*/
UINT WINAPI midiOutShortMsg(HMIDIOUT hMidiOut, DWORD dwMsg) UINT WINAPI midiOutShortMsg(HMIDIOUT hMidiOut, DWORD dwMsg)
{ {
printf("midiOutShortMsg\n"); printf("midiOutShortMsg\n");
return 0; return 0;
} }
/**************************************************************************
* midiOutLongMsg [MMSYSTEM.209]
*/
UINT WINAPI midiOutLongMsg(HMIDIOUT hMidiOut, UINT WINAPI midiOutLongMsg(HMIDIOUT hMidiOut,
MIDIHDR FAR* lpMidiOutHdr, UINT uSize) MIDIHDR FAR* lpMidiOutHdr, UINT uSize)
{ {
@ -701,14 +737,36 @@ UINT WINAPI midiOutLongMsg(HMIDIOUT hMidiOut,
return 0; return 0;
} }
/**************************************************************************
* midiOutReset [MMSYSTEM.210]
*/
UINT WINAPI midiOutReset(HMIDIOUT hMidiOut) UINT WINAPI midiOutReset(HMIDIOUT hMidiOut)
{ {
printf("midiOutReset\n"); printf("midiOutReset\n");
return 0; return 0;
} }
/**************************************************************************
* midiOutGetVolume [MMSYSTEM.211]
*/
UINT WINAPI midiOutGetVolume(UINT uDeviceID, DWORD FAR* lpdwVolume)
{
printf("midiOutGetVolume\n");
return 0;
}
/**************************************************************************
* midiOutSetVolume [MMSYSTEM.212]
*/
UINT WINAPI midiOutSetVolume(UINT uDeviceID, DWORD dwVolume)
{
printf("midiOutSetVolume\n");
return 0;
}
/**************************************************************************
* midiOutCachePatches [MMSYSTEM.213]
*/
UINT WINAPI midiOutCachePatches(HMIDIOUT hMidiOut, UINT WINAPI midiOutCachePatches(HMIDIOUT hMidiOut,
UINT uBank, WORD FAR* lpwPatchArray, UINT uFlags) UINT uBank, WORD FAR* lpwPatchArray, UINT uFlags)
{ {
@ -716,7 +774,9 @@ UINT WINAPI midiOutCachePatches(HMIDIOUT hMidiOut,
return 0; return 0;
} }
/**************************************************************************
* midiOutCacheDrumPatches [MMSYSTEM.214]
*/
UINT WINAPI midiOutCacheDrumPatches(HMIDIOUT hMidiOut, UINT WINAPI midiOutCacheDrumPatches(HMIDIOUT hMidiOut,
UINT uPatch, WORD FAR* lpwKeyArray, UINT uFlags) UINT uPatch, WORD FAR* lpwKeyArray, UINT uFlags)
{ {
@ -724,31 +784,36 @@ UINT WINAPI midiOutCacheDrumPatches(HMIDIOUT hMidiOut,
return 0; return 0;
} }
/**************************************************************************
* midiOutGetID [MMSYSTEM.215]
*/
UINT WINAPI midiOutGetID(HMIDIOUT hMidiOut, UINT FAR* lpuDeviceID) UINT WINAPI midiOutGetID(HMIDIOUT hMidiOut, UINT FAR* lpuDeviceID)
{ {
printf("midiOutGetID\n"); printf("midiOutGetID\n");
return 0; return 0;
} }
/**************************************************************************
* midiOutMessage [MMSYSTEM.216]
*/
DWORD WINAPI midiOutMessage(HMIDIOUT hMidiOut, UINT uMessage, DWORD dw1, DWORD dw2) DWORD WINAPI midiOutMessage(HMIDIOUT hMidiOut, UINT uMessage, DWORD dw1, DWORD dw2)
{ {
printf("midiOutMessage\n"); printf("midiOutMessage\n");
return 0; return 0;
} }
/**************************************************************************
* midiInGetNumDevs [MMSYSTEM.301]
*/
UINT WINAPI midiInGetNumDevs(void) UINT WINAPI midiInGetNumDevs(void)
{ {
printf("midiInGetNumDevs\n"); printf("midiInGetNumDevs\n");
return 0; return 0;
} }
/**************************************************************************
* midiInGetDevCaps [MMSYSTEM.302]
*/
UINT WINAPI midiInGetDevCaps(UINT uDeviceID, UINT WINAPI midiInGetDevCaps(UINT uDeviceID,
LPMIDIINCAPS lpCaps, UINT uSize) LPMIDIINCAPS lpCaps, UINT uSize)
{ {
@ -756,8 +821,6 @@ UINT WINAPI midiInGetDevCaps(UINT uDeviceID,
return 0; return 0;
} }
/************************************************************************** /**************************************************************************
* midiInGetErrorText [MMSYSTEM.303] * midiInGetErrorText [MMSYSTEM.303]
*/ */
@ -767,8 +830,9 @@ UINT WINAPI midiInGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
return (midiGetErrorText(uError, lpText, uSize)); return (midiGetErrorText(uError, lpText, uSize));
} }
/**************************************************************************
* midiInOpen [MMSYSTEM.304]
*/
UINT WINAPI midiInOpen(HMIDIIN FAR* lphMidiIn, UINT uDeviceID, UINT WINAPI midiInOpen(HMIDIIN FAR* lphMidiIn, UINT uDeviceID,
DWORD dwCallback, DWORD dwInstance, DWORD dwFlags) DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
{ {
@ -777,25 +841,18 @@ UINT WINAPI midiInOpen(HMIDIIN FAR* lphMidiIn, UINT uDeviceID,
return 0; return 0;
} }
/**************************************************************************
* midiInClose [MMSYSTEM.305]
*/
UINT WINAPI midiInClose(HMIDIIN hMidiIn) UINT WINAPI midiInClose(HMIDIIN hMidiIn)
{ {
printf("midiInClose\n"); printf("midiInClose\n");
return 0; return 0;
} }
/**************************************************************************
* midiInPrepareHeader [MMSYSTEM.306]
*/
UINT WINAPI midiInGetID(HMIDIIN hMidiIn, UINT FAR* lpuDeviceID)
{
printf("midiInGetID\n");
return 0;
}
UINT WINAPI midiInPrepareHeader(HMIDIIN hMidiIn, UINT WINAPI midiInPrepareHeader(HMIDIIN hMidiIn,
MIDIHDR FAR* lpMidiInHdr, UINT uSize) MIDIHDR FAR* lpMidiInHdr, UINT uSize)
{ {
@ -803,8 +860,9 @@ UINT WINAPI midiInPrepareHeader(HMIDIIN hMidiIn,
return 0; return 0;
} }
/**************************************************************************
* midiInUnprepareHeader [MMSYSTEM.307]
*/
UINT WINAPI midiInUnprepareHeader(HMIDIIN hMidiIn, UINT WINAPI midiInUnprepareHeader(HMIDIIN hMidiIn,
MIDIHDR FAR* lpMidiInHdr, UINT uSize) MIDIHDR FAR* lpMidiInHdr, UINT uSize)
{ {
@ -812,8 +870,9 @@ UINT WINAPI midiInUnprepareHeader(HMIDIIN hMidiIn,
return 0; return 0;
} }
/**************************************************************************
* midiInAddBuffer [MMSYSTEM.308]
*/
UINT WINAPI midiInAddBuffer(HMIDIIN hMidiIn, UINT WINAPI midiInAddBuffer(HMIDIIN hMidiIn,
MIDIHDR FAR* lpMidiInHdr, UINT uSize) MIDIHDR FAR* lpMidiInHdr, UINT uSize)
{ {
@ -821,45 +880,71 @@ UINT WINAPI midiInAddBuffer(HMIDIIN hMidiIn,
return 0; return 0;
} }
/**************************************************************************
* midiInStart [MMSYSTEM.309]
*/
UINT WINAPI midiInStart(HMIDIIN hMidiIn) UINT WINAPI midiInStart(HMIDIIN hMidiIn)
{ {
printf("midiInStart\n"); printf("midiInStart\n");
return 0; return 0;
} }
/**************************************************************************
* midiInStop [MMSYSTEM.310]
*/
UINT WINAPI midiInStop(HMIDIIN hMidiIn) UINT WINAPI midiInStop(HMIDIIN hMidiIn)
{ {
printf("midiInStop\n"); printf("midiInStop\n");
return 0; return 0;
} }
/**************************************************************************
* midiInReset [MMSYSTEM.311]
*/
UINT WINAPI midiInReset(HMIDIIN hMidiIn) UINT WINAPI midiInReset(HMIDIIN hMidiIn)
{ {
printf("midiInReset\n"); printf("midiInReset\n");
return 0; return 0;
} }
/**************************************************************************
* midiInGetID [MMSYSTEM.312]
UINT WINAPI waveOutGetNumDevs() */
UINT WINAPI midiInGetID(HMIDIIN hMidiIn, UINT FAR* lpuDeviceID)
{ {
printf("waveOutGetNumDevs\n"); printf("midiInGetID\n");
return 0;
}
/**************************************************************************
* midiInMessage [MMSYSTEM.313]
*/
DWORD WINAPI midiInMessage(HMIDIIN hMidiIn, UINT uMessage,
DWORD dwParam1, DWORD dwParam2)
{
printf("midiInMessage\n");
return 0; return 0;
} }
/**************************************************************************
* waveOutGetNumDevs [MMSYSTEM.401]
*/
UINT WINAPI waveOutGetNumDevs()
{
printf("waveOutGetNumDevs\n");
return 1;
}
/**************************************************************************
* waveOutGetDevCaps [MMSYSTEM.402]
*/
UINT WINAPI waveOutGetDevCaps(UINT uDeviceID, WAVEOUTCAPS FAR* lpCaps, UINT uSize) UINT WINAPI waveOutGetDevCaps(UINT uDeviceID, WAVEOUTCAPS FAR* lpCaps, UINT uSize)
{ {
printf("waveOutGetDevCaps\n"); printf("waveOutGetDevCaps\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
/************************************************************************** /**************************************************************************
* waveOutGetErrorText [MMSYSTEM.403] * waveOutGetErrorText [MMSYSTEM.403]
*/ */
@ -939,25 +1024,40 @@ UINT WINAPI waveGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
return(TRUE); return(TRUE);
} }
/**************************************************************************
* waveOutOpen [MMSYSTEM.404]
*/
UINT WINAPI waveOutOpen(HWAVEOUT FAR* lphWaveOut, UINT uDeviceID, UINT WINAPI waveOutOpen(HWAVEOUT FAR* lphWaveOut, UINT uDeviceID,
const WAVEFORMAT FAR* lpFormat, DWORD dwCallback, DWORD dwInstance, DWORD dwFlags) const LPWAVEFORMAT lpFormat, DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
{ {
printf("waveOutOpen\n"); printf("waveOutOpen(%08X, %d, %08X, %08X, %08X, %08X);\n",
lphWaveOut, uDeviceID, lpFormat, dwCallback, dwInstance, dwFlags);
if (dwFlags & WAVE_FORMAT_QUERY) {
printf("waveOutOpen // WAVE_FORMAT_QUERY !\n");
if (uDeviceID == (UINT)WAVE_MAPPER) {
printf("waveOutOpen // No WAVE_MAPPER supported yet !\n");
return MMSYSERR_BADDEVICEID;
}
}
if (lpFormat == NULL) return WAVERR_BADFORMAT;
if (lphWaveOut != NULL) *lphWaveOut = 0; if (lphWaveOut != NULL) *lphWaveOut = 0;
return MMSYSERR_BADDEVICEID; if (lphWaveOut != NULL) *lphWaveOut = ++mciActiveDev;
return 0;
/* return MMSYSERR_BADDEVICEID;*/
} }
/**************************************************************************
* waveOutClose [MMSYSTEM.405]
*/
UINT WINAPI waveOutClose(HWAVEOUT hWaveOut) UINT WINAPI waveOutClose(HWAVEOUT hWaveOut)
{ {
printf("waveOutClose\n"); printf("waveOutClose\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
/**************************************************************************
* waveOutPrepareHeader [MMSYSTEM.406]
*/
UINT WINAPI waveOutPrepareHeader(HWAVEOUT hWaveOut, UINT WINAPI waveOutPrepareHeader(HWAVEOUT hWaveOut,
WAVEHDR FAR* lpWaveOutHdr, UINT uSize) WAVEHDR FAR* lpWaveOutHdr, UINT uSize)
{ {
@ -965,8 +1065,9 @@ UINT WINAPI waveOutPrepareHeader(HWAVEOUT hWaveOut,
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
/**************************************************************************
* waveOutUnprepareHeader [MMSYSTEM.407]
*/
UINT WINAPI waveOutUnprepareHeader(HWAVEOUT hWaveOut, UINT WINAPI waveOutUnprepareHeader(HWAVEOUT hWaveOut,
WAVEHDR FAR* lpWaveOutHdr, UINT uSize) WAVEHDR FAR* lpWaveOutHdr, UINT uSize)
{ {
@ -974,115 +1075,144 @@ UINT WINAPI waveOutUnprepareHeader(HWAVEOUT hWaveOut,
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
/**************************************************************************
* waveOutWrite [MMSYSTEM.408]
*/
UINT WINAPI waveOutWrite(HWAVEOUT hWaveOut, WAVEHDR FAR* lpWaveOutHdr, UINT uSize) UINT WINAPI waveOutWrite(HWAVEOUT hWaveOut, WAVEHDR FAR* lpWaveOutHdr, UINT uSize)
{ {
printf("waveOutWrite\n"); printf("waveOutWrite\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
/**************************************************************************
* waveOutPause [MMSYSTEM.409]
*/
UINT WINAPI waveOutPause(HWAVEOUT hWaveOut) UINT WINAPI waveOutPause(HWAVEOUT hWaveOut)
{ {
printf("waveOutPause\n"); printf("waveOutPause\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
/**************************************************************************
* waveOutRestart [MMSYSTEM.410]
*/
UINT WINAPI waveOutRestart(HWAVEOUT hWaveOut) UINT WINAPI waveOutRestart(HWAVEOUT hWaveOut)
{ {
printf("waveOutRestart\n"); printf("waveOutRestart\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
/**************************************************************************
* waveOutReset [MMSYSTEM.411]
*/
UINT WINAPI waveOutReset(HWAVEOUT hWaveOut) UINT WINAPI waveOutReset(HWAVEOUT hWaveOut)
{ {
printf("waveOutReset\n"); printf("waveOutReset\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
/**************************************************************************
* waveOutGetPosition [MMSYSTEM.412]
*/
UINT WINAPI waveOutGetPosition(HWAVEOUT hWaveOut, MMTIME FAR* lpInfo, UINT uSize) UINT WINAPI waveOutGetPosition(HWAVEOUT hWaveOut, MMTIME FAR* lpInfo, UINT uSize)
{ {
printf("waveOutGetPosition\n"); printf("waveOutGetPosition\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
/**************************************************************************
* waveOutGetPitch [MMSYSTEM.413]
UINT WINAPI waveOutGetVolume(UINT uDeviceID, DWORD FAR* lpdwVolume) */
{
printf("waveOutGetVolume\n");
return MMSYSERR_INVALHANDLE;
}
UINT WINAPI waveOutSetVolume(UINT uDeviceID, DWORD dwVolume)
{
printf("waveOutSetVolume\n");
return MMSYSERR_INVALHANDLE;
}
UINT WINAPI waveOutGetID(HWAVEOUT hWaveOut, UINT FAR* lpuDeviceID)
{
printf("waveOutGetID\n");
return MMSYSERR_INVALHANDLE;
}
UINT WINAPI waveOutGetPitch(HWAVEOUT hWaveOut, DWORD FAR* lpdwPitch) UINT WINAPI waveOutGetPitch(HWAVEOUT hWaveOut, DWORD FAR* lpdwPitch)
{ {
printf("waveOutGetPitch\n"); printf("waveOutGetPitch\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
/**************************************************************************
* waveOutSetPitch [MMSYSTEM.414]
*/
UINT WINAPI waveOutSetPitch(HWAVEOUT hWaveOut, DWORD dwPitch) UINT WINAPI waveOutSetPitch(HWAVEOUT hWaveOut, DWORD dwPitch)
{ {
printf("waveOutSetPitch\n"); printf("waveOutSetPitch\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
/**************************************************************************
* waveOutGetVolume [MMSYSTEM.415]
*/
UINT WINAPI waveOutGetVolume(UINT uDeviceID, DWORD FAR* lpdwVolume)
{
printf("waveOutGetVolume\n");
return MMSYSERR_INVALHANDLE;
}
/**************************************************************************
* waveOutSetVolume [MMSYSTEM.416]
*/
UINT WINAPI waveOutSetVolume(UINT uDeviceID, DWORD dwVolume)
{
printf("waveOutSetVolume\n");
return MMSYSERR_INVALHANDLE;
}
/**************************************************************************
* waveOutGetPlaybackRate [MMSYSTEM.417]
*/
UINT WINAPI waveOutGetPlaybackRate(HWAVEOUT hWaveOut, DWORD FAR* lpdwRate) UINT WINAPI waveOutGetPlaybackRate(HWAVEOUT hWaveOut, DWORD FAR* lpdwRate)
{ {
printf("waveOutGetPlaybackRate\n"); printf("waveOutGetPlaybackRate\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
/**************************************************************************
* waveOutSetPlaybackRate [MMSYSTEM.418]
*/
UINT WINAPI waveOutSetPlaybackRate(HWAVEOUT hWaveOut, DWORD dwRate) UINT WINAPI waveOutSetPlaybackRate(HWAVEOUT hWaveOut, DWORD dwRate)
{ {
printf("waveOutSetPlaybackRate\n"); printf("waveOutSetPlaybackRate\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
/**************************************************************************
* waveOutBreakLoop [MMSYSTEM.419]
*/
UINT WINAPI waveOutBreakLoop(HWAVEOUT hWaveOut) UINT WINAPI waveOutBreakLoop(HWAVEOUT hWaveOut)
{ {
printf("waveOutBreakLoop\n"); printf("waveOutBreakLoop\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
/**************************************************************************
* waveOutGetID [MMSYSTEM.420]
*/
UINT WINAPI waveOutGetID(HWAVEOUT hWaveOut, UINT FAR* lpuDeviceID)
{
printf("waveOutGetID\n");
return MMSYSERR_INVALHANDLE;
}
/**************************************************************************
* waveOutMessage [MMSYSTEM.421]
*/
DWORD WINAPI waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage,
DWORD dwParam1, DWORD dwParam2)
{
}
/**************************************************************************
* waveInGetNumDevs [MMSYSTEM.501]
*/
UINT WINAPI waveInGetNumDevs() UINT WINAPI waveInGetNumDevs()
{ {
/* printf("waveInGetNumDevs\n"); */ printf("waveInGetNumDevs\n");
return 0; return 0;
} }
/**************************************************************************
* waveInGetDevCaps [MMSYSTEM.502]
*/
UINT WINAPI waveInGetDevCaps(UINT uDeviceID, WAVEINCAPS FAR* lpCaps, UINT uSize) UINT WINAPI waveInGetDevCaps(UINT uDeviceID, WAVEINCAPS FAR* lpCaps, UINT uSize)
{ {
printf("waveInGetDevCaps\n"); printf("waveInGetDevCaps\n");
@ -1104,10 +1234,19 @@ UINT WINAPI waveInGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
* waveInOpen [MMSYSTEM.504] * waveInOpen [MMSYSTEM.504]
*/ */
UINT WINAPI waveInOpen(HWAVEIN FAR* lphWaveIn, UINT uDeviceID, UINT WINAPI waveInOpen(HWAVEIN FAR* lphWaveIn, UINT uDeviceID,
const WAVEFORMAT FAR* lpFormat, DWORD dwCallback, DWORD dwInstance, DWORD dwFlags) const LPWAVEFORMAT lpFormat, DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
{ {
printf("waveInOpen\n"); printf("waveInOpen(%08X, %d, %08X, %08X, %08X, %08X);\n",
lphWaveIn, uDeviceID, lpFormat, dwCallback, dwInstance, dwFlags);
if (dwFlags & WAVE_FORMAT_QUERY) {
printf("waveInOpen // WAVE_FORMAT_QUERY !\n");
if (uDeviceID == (UINT)WAVE_MAPPER) {
printf("waveInOpen // No WAVE_MAPPER supported yet !\n");
return MMSYSERR_BADDEVICEID;
}
}
if (lphWaveIn != NULL) *lphWaveIn = 0; if (lphWaveIn != NULL) *lphWaveIn = 0;
if (lpFormat == NULL) return WAVERR_BADFORMAT;
return MMSYSERR_BADDEVICEID; return MMSYSERR_BADDEVICEID;
} }
@ -1206,6 +1345,16 @@ UINT WINAPI waveInGetID(HWAVEIN hWaveIn, UINT FAR* lpuDeviceID)
} }
/**************************************************************************
* waveInMessage [MMSYSTEM.514]
*/
DWORD WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage,
DWORD dwParam1, DWORD dwParam2)
{
}
/************************************************************************** /**************************************************************************
* mmioOpen [MMSYSTEM.1210] * mmioOpen [MMSYSTEM.1210]
*/ */
@ -1248,7 +1397,6 @@ LONG WINAPI mmioWrite(HMMIO hmmio, HPCSTR pch, LONG cch)
return 0; return 0;
} }
/************************************************************************** /**************************************************************************
* mmioSeek [MMSYSTEM.1214] * mmioSeek [MMSYSTEM.1214]
*/ */
@ -1258,7 +1406,6 @@ LONG WINAPI mmioSeek(HMMIO hmmio, LONG lOffset, int iOrigin)
return 0; return 0;
} }
/************************************************************************** /**************************************************************************
* mmioGetInfo [MMSYSTEM.1215] * mmioGetInfo [MMSYSTEM.1215]
*/ */
@ -1268,7 +1415,6 @@ UINT WINAPI mmioGetInfo(HMMIO hmmio, MMIOINFO FAR* lpmmioinfo, UINT uFlags)
return 0; return 0;
} }
/************************************************************************** /**************************************************************************
* mmioGetInfo [MMSYSTEM.1216] * mmioGetInfo [MMSYSTEM.1216]
*/ */
@ -1278,45 +1424,139 @@ UINT WINAPI mmioSetInfo(HMMIO hmmio, const MMIOINFO FAR* lpmmioinfo, UINT uFlags
return 0; return 0;
} }
/**************************************************************************
/* * mmioSetBuffer [MMSYSTEM.1217]
#1100 pascal DRVOPEN
#1101 pascal DRVCLOSE
#1102 pascal DRVSENDMESSAGE
#1103 pascal DRVGETMODULEHANDLE
#1104 pascal DRVDEFDRIVERPROC
UINT WINAPI mciGetDeviceIDFromElementID (DWORD dwElementID,
LPCSTR lpstrType);
BOOL WINAPI mciSetYieldProc (UINT uDeviceID, YIELDPROC fpYieldProc,
DWORD dwYieldData);
HTASK WINAPI mciGetCreatorTask(UINT uDeviceID);
YIELDPROC WINAPI mciGetYieldProc (UINT uDeviceID, DWORD FAR* lpdwYieldData);
FOURCC WINAPI mmioStringToFOURCC(LPCSTR sz, UINT uFlags);
LPMMIOPROC WINAPI mmioInstallIOProc(FOURCC fccIOProc, LPMMIOPROC pIOProc,
DWORD dwFlags);
UINT WINAPI mmioSetBuffer(HMMIO hmmio, LPSTR pchBuffer, LONG cchBuffer,
UINT uFlags);
UINT WINAPI mmioFlush(HMMIO hmmio, UINT uFlags);
UINT WINAPI mmioAdvance(HMMIO hmmio, MMIOINFO FAR* lpmmioinfo, UINT uFlags);
LRESULT WINAPI mmioSendMessage(HMMIO hmmio, UINT uMessage,
LPARAM lParam1, LPARAM lParam2);
UINT WINAPI mmioDescend(HMMIO hmmio, MMCKINFO FAR* lpck,
const MMCKINFO FAR* lpckParent, UINT uFlags);
UINT WINAPI mmioAscend(HMMIO hmmio, MMCKINFO FAR* lpck, UINT uFlags);
UINT WINAPI mmioCreateChunk(HMMIO hmmio, MMCKINFO FAR* lpck, UINT uFlags);
DWORD WINAPI midiInMessage(HMIDIIN hMidiIn, UINT uMessage, DWORD dw1, DWORD dw2);
DWORD WINAPI waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage, DWORD dw1, DWORD dw2);
UINT WINAPI waveInAddBuffer(HWAVEIN hWaveIn,
WAVEHDR FAR* lpWaveInHdr, UINT uSize);
DWORD WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage, DWORD dw1, DWORD dw2);
*/ */
UINT WINAPI mmioSetBuffer(HMMIO hmmio, LPSTR pchBuffer,
LONG cchBuffer, UINT uFlags)
{
printf("mmioSetBuffer\n");
return 0;
}
/**************************************************************************
* mmioFlush [MMSYSTEM.1218]
*/
UINT WINAPI mmioFlush(HMMIO hmmio, UINT uFlags)
{
printf("mmioFlush\n");
return 0;
}
/**************************************************************************
* mmioAdvance [MMSYSTEM.1219]
*/
UINT WINAPI mmioAdvance(HMMIO hmmio, MMIOINFO FAR* lpmmioinfo, UINT uFlags)
{
printf("mmioAdvance\n");
return 0;
}
/**************************************************************************
* mmioStringToFOURCC [MMSYSTEM.1220]
*/
FOURCC WINAPI mmioStringToFOURCC(LPCSTR sz, UINT uFlags)
{
printf("mmioStringToFOURCC\n");
return 0;
}
/**************************************************************************
* mmioInstallIOProc [MMSYSTEM.1221]
*/
LPMMIOPROC WINAPI mmioInstallIOProc(FOURCC fccIOProc,
LPMMIOPROC pIOProc, DWORD dwFlags)
{
printf("mmioInstallIOProc\n");
return 0;
}
/**************************************************************************
* mmioSendMessage [MMSYSTEM.1222]
*/
LRESULT WINAPI mmioSendMessage(HMMIO hmmio, UINT uMessage,
LPARAM lParam1, LPARAM lParam2)
{
printf("mmioSendMessage\n");
return 0;
}
/**************************************************************************
* mmioDescend [MMSYSTEM.1223]
*/
UINT WINAPI mmioDescend(HMMIO hmmio, MMCKINFO FAR* lpck,
const MMCKINFO FAR* lpckParent, UINT uFlags)
{
printf("mmioDescend\n");
return 0;
}
/**************************************************************************
* mmioAscend [MMSYSTEM.1224]
*/
UINT WINAPI mmioAscend(HMMIO hmmio, MMCKINFO FAR* lpck, UINT uFlags)
{
printf("mmioAscend\n");
return 0;
}
/**************************************************************************
* mmioCreateChunk [MMSYSTEM.1225]
*/
UINT WINAPI mmioCreateChunk(HMMIO hmmio, MMCKINFO FAR* lpck, UINT uFlags)
{
printf("mmioCreateChunk\n");
return 0;
}
/**************************************************************************
* DrvOpen [MMSYSTEM.1100]
*/
HDRVR DrvOpen(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
{
printf("DrvOpen('%s', '%s', %08X);\n",
lpDriverName, lpSectionName, lParam);
return OpenDriver(lpDriverName, lpSectionName, lParam);
}
/**************************************************************************
* DrvClose [MMSYSTEM.1101]
*/
LRESULT DrvClose(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2)
{
printf("DrvClose(%04X, %08X, %08X);\n", hDrvr, lParam1, lParam2);
return CloseDriver(hDrvr, lParam1, lParam2);
}
/**************************************************************************
* DrvSendMessage [MMSYSTEM.1102]
*/
LRESULT WINAPI DrvSendMessage(HDRVR hDriver, WORD msg, LPARAM lParam1, LPARAM lParam2)
{
printf("DrvSendMessage(%04X, %04X, %08X, %08X);\n",
hDriver, msg, lParam1, lParam2);
}
/**************************************************************************
* DrvGetModuleHandle [MMSYSTEM.1103]
*/
HANDLE DrvGetModuleHandle(HDRVR hDrvr)
{
printf("DrvGetModuleHandle(%04X);\n", hDrvr);
}
/**************************************************************************
* DrvDefDriverProc [MMSYSTEM.1104]
*/
LRESULT DrvDefDriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
DWORD dwParam1, DWORD dwParam2)
{
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
}

View File

@ -220,6 +220,10 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName,
TSecHeader *section; TSecHeader *section;
TKeys *key; TKeys *key;
/* Supposedly Default should NEVER be NULL. But sometimes it is. */
if (Default == NULL)
Default = "";
if (!(section = is_loaded (FileName))){ if (!(section = is_loaded (FileName))){
New = (TProfile *) xmalloc (sizeof (TProfile)); New = (TProfile *) xmalloc (sizeof (TProfile));
New->link = Base; New->link = Base;
@ -237,16 +241,31 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName,
/* If no key value given, then list all the keys */ /* If no key value given, then list all the keys */
if ((!KeyName) && (!set)){ if ((!KeyName) && (!set)){
char *p = ReturnedString; char *p = ReturnedString;
int left = Size - 1; int left = Size - 2;
int slen; int slen;
#ifdef DEBUG_PROFILE
printf("GetSetProfile // KeyName == NULL, Enumeration !\n");
#endif
for (key = section->Keys; key; key = key->link){ for (key = section->Keys; key; key = key->link){
strncpy (p, key->KeyName, left); if (left < 1) {
slen = strlen (key->KeyName) + 1; printf("GetSetProfile // No more storage for enum !\n");
left -= slen+1; return (Size - 2);
}
slen = min(strlen(key->KeyName) + 1, left);
#ifdef DEBUG_PROFILE
printf("GetSetProfile // strncpy(%08X, %08X, %d);\n",
ReturnedString, key->Value, slen);
#endif
strncpy (p, key->KeyName, slen);
#ifdef DEBUG_PROFILE
printf("GetSetProfile // enum '%s' !\n", p);
#endif
left -= slen;
p += slen; p += slen;
} }
return left; *p = '\0';
printf("GetSetProfile // normal end of enum !\n");
return (Size - 2 - left);
} }
for (key = section->Keys; key; key = key->link){ for (key = section->Keys; key; key = key->link){
if (strcasecmp (key->KeyName, KeyName)) if (strcasecmp (key->KeyName, KeyName))
@ -291,7 +310,11 @@ short GetPrivateProfileString (LPSTR AppName, LPSTR KeyName,
short Size, LPSTR FileName) short Size, LPSTR FileName)
{ {
int v; int v;
#ifdef DEBUG_PROFILE
printf("GetPrivateProfileString ('%s', '%s', '%s', %08X, %d, %s\n",
AppName, KeyName, Default, ReturnedString, Size, FileName);
#endif
v = GetSetProfile (0,AppName,KeyName,Default,ReturnedString,Size,FileName); v = GetSetProfile (0,AppName,KeyName,Default,ReturnedString,Size,FileName);
if (AppName) if (AppName)
return strlen (ReturnedString); return strlen (ReturnedString);

View File

@ -1,14 +1,19 @@
/* /*
* Shell Library Functions * Shell Library Functions
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include "windows.h" #include "windows.h"
#include "shell.h"
/*
#define DEBUG_REG
*/
LPKEYSTRUCT lphRootKey = NULL;
typedef DWORD HKEY;
typedef FAR LONG *LPWORD; typedef FAR LONG *LPWORD;
DECLARE_HANDLE(HDROP); DECLARE_HANDLE(HDROP);
@ -17,63 +22,270 @@ extern HINSTANCE hSysRes;
/************************************************************************* /*************************************************************************
* RegOpenKey [SHELL.1] * RegOpenKey [SHELL.1]
*/ */
LONG RegOpenKey(HKEY k, LPCSTR s, HKEY FAR *p) LONG RegOpenKey(HKEY hKey, LPCSTR lpSubKey, HKEY FAR *lphKey)
{ {
fprintf(stderr, "RegOpenKey : Empty Stub !!!\n"); LPKEYSTRUCT lpKey = lphRootKey;
LPSTR ptr;
char str[128];
int size;
#ifdef DEBUG_REG
fprintf(stderr, "RegOpenKey(%04X, %08X='%s', %08X)\n",
hKey, lpSubKey, lpSubKey, lphKey);
#endif
if (lpKey == NULL) return ERROR_BADKEY;
if (lpSubKey == NULL) return ERROR_INVALID_PARAMETER;
if (lphKey == NULL) return ERROR_INVALID_PARAMETER;
if (hKey != HKEY_CLASSES_ROOT) {
#ifdef DEBUG_REG
printf("RegOpenKey // specific key = %04X !\n", hKey);
#endif
lpKey = (LPKEYSTRUCT)GlobalLock(hKey);
}
while ( (ptr = strchr(lpSubKey, '\\')) != NULL ) {
strncpy(str, lpSubKey, (LONG)ptr - (LONG)lpSubKey);
str[(LONG)ptr - (LONG)lpSubKey] = '\0';
lpSubKey = ptr + 1;
#ifdef DEBUG_REG
printf("RegOpenKey // next level '%s' !\n", str);
#endif
while(TRUE) {
#ifdef DEBUG_REG
printf("RegOpenKey // '%s' <-> '%s' !\n", str, lpKey->lpSubKey);
#endif
if (lpKey->lpSubKey != NULL && lpKey->lpSubKey[0] != '\0' &&
strcmp(lpKey->lpSubKey, str) == 0) {
lpKey = lpKey->lpSubLvl;
if (lpKey == NULL) {
printf("RegOpenKey // can't find subkey '%s' !\n", str);
return ERROR_BADKEY;
}
break;
}
if (lpKey->lpNextKey == NULL) {
printf("RegOpenKey // can't find subkey '%s' !\n", str);
return ERROR_BADKEY;
}
lpKey = lpKey->lpNextKey;
}
}
while(TRUE) {
if (lpKey->lpSubKey != NULL &&
strcmp(lpKey->lpSubKey, lpSubKey) == 0) break;
if (lpKey->lpNextKey == NULL) {
printf("RegOpenKey // can't find subkey '%s' !\n", str);
return ERROR_BADKEY;
}
lpKey = lpKey->lpNextKey;
}
*lphKey = lpKey->hKey;
#ifdef DEBUG_REG
printf("RegOpenKey // return hKey=%04X !\n", lpKey->hKey);
#endif
return ERROR_SUCCESS;
} }
/************************************************************************* /*************************************************************************
* RegCreateKey [SHELL.2] * RegCreateKey [SHELL.2]
*/ */
LONG RegCreateKey(HKEY k, LPCSTR s, HKEY FAR *p) LONG RegCreateKey(HKEY hKey, LPCSTR lpSubKey, HKEY FAR *lphKey)
{ {
fprintf(stderr, "RegCreateKey : Empty Stub !!!\n"); HKEY hNewKey;
LPKEYSTRUCT lpNewKey;
LPKEYSTRUCT lpKey = lphRootKey;
LPKEYSTRUCT lpPrevKey;
LONG dwRet;
LPSTR ptr;
char str[128];
#ifdef DEBUG_REG
fprintf(stderr, "RegCreateKey(%04X, '%s', %08X)\n", hKey, lpSubKey, lphKey);
#endif
if (lpSubKey == NULL) return ERROR_INVALID_PARAMETER;
if (lphKey == NULL) return ERROR_INVALID_PARAMETER;
if (hKey != HKEY_CLASSES_ROOT) {
#ifdef DEBUG_REG
printf("RegCreateKey // specific key = %04X !\n", hKey);
#endif
lpKey = (LPKEYSTRUCT)GlobalLock(hKey);
}
while ( (ptr = strchr(lpSubKey, '\\')) != NULL ) {
strncpy(str, lpSubKey, (LONG)ptr - (LONG)lpSubKey);
str[(LONG)ptr - (LONG)lpSubKey] = '\0';
lpSubKey = ptr + 1;
#ifdef DEBUG_REG
printf("RegCreateKey // next level '%s' !\n", str);
#endif
lpPrevKey = lpKey;
while(TRUE) {
#ifdef DEBUG_REG
printf("RegCreateKey // '%s' <-> '%s' !\n", str, lpKey->lpSubKey);
#endif
if (lpKey->lpSubKey != NULL &&
strcmp(lpKey->lpSubKey, str) == 0) {
if (lpKey->lpSubLvl == NULL) {
#ifdef DEBUG_REG
printf("RegCreateKey // '%s' found !\n", str);
#endif
if ( (ptr = strchr(lpSubKey, '\\')) != NULL ) {
strncpy(str, lpSubKey, (LONG)ptr - (LONG)lpSubKey);
str[(LONG)ptr - (LONG)lpSubKey] = '\0';
lpSubKey = ptr + 1;
}
else
strcpy(str, lpSubKey);
dwRet = RegCreateKey(lpKey->hKey, str, &hNewKey);
if (dwRet != ERROR_SUCCESS) {
printf("RegCreateKey // can't create subkey '%s' !\n", str);
return dwRet;
}
lpKey->lpSubLvl = (LPKEYSTRUCT)GlobalLock(hNewKey);
}
lpKey = lpKey->lpSubLvl;
break;
}
if (lpKey->lpNextKey == NULL) {
dwRet = RegCreateKey(lpPrevKey->hKey, str, &hNewKey);
if (dwRet != ERROR_SUCCESS) {
printf("RegCreateKey // can't create subkey '%s' !\n", str);
return dwRet;
}
lpKey = (LPKEYSTRUCT)GlobalLock(hNewKey);
break;
}
lpKey = lpKey->lpNextKey;
}
}
hNewKey = GlobalAlloc(GMEM_MOVEABLE, sizeof(KEYSTRUCT));
lpNewKey = (LPKEYSTRUCT) GlobalLock(hNewKey);
if (lpNewKey == NULL) {
printf("RegCreateKey // Can't alloc new key !\n");
return ERROR_OUTOFMEMORY;
}
if (lphRootKey == NULL) {
lphRootKey = lpNewKey;
lpNewKey->lpPrevKey = NULL;
}
else {
lpKey->lpNextKey = lpNewKey;
lpNewKey->lpPrevKey = lpKey;
}
lpNewKey->hKey = hNewKey;
lpNewKey->lpSubKey = malloc(strlen(lpSubKey) + 1);
if (lpNewKey->lpSubKey == NULL) {
printf("RegCreateKey // Can't alloc key string !\n");
return ERROR_OUTOFMEMORY;
}
strcpy(lpNewKey->lpSubKey, lpSubKey);
lpNewKey->dwType = 0;
lpNewKey->lpValue = NULL;
lpNewKey->lpNextKey = NULL;
lpNewKey->lpSubLvl = NULL;
*lphKey = hNewKey;
#ifdef DEBUG_REG
printf("RegCreateKey // successful '%s' key=%04X !\n", lpSubKey, hNewKey);
#endif
return ERROR_SUCCESS;
} }
/************************************************************************* /*************************************************************************
* RegCloseKey [SHELL.3] * RegCloseKey [SHELL.3]
*/ */
LONG RegCloseKey(HKEY k) LONG RegCloseKey(HKEY hKey)
{ {
fprintf(stderr, "RegCloseKey : Empty Stub !!!\n"); fprintf(stderr, "EMPTY STUB !!! RegCloseKey(%04X);\n", hKey);
return ERROR_INVALID_PARAMETER;
} }
/************************************************************************* /*************************************************************************
* RegDeleteKey [SHELL.4] * RegDeleteKey [SHELL.4]
*/ */
LONG RegDeleteKey(HKEY k, LPCSTR s) LONG RegDeleteKey(HKEY hKey, LPCSTR lpSubKey)
{ {
fprintf(stderr, "RegDeleteKey : Empty Stub !!!\n"); fprintf(stderr, "EMPTY STUB !!! RegDeleteKey(%04X, '%s');\n",
hKey, lpSubKey);
return ERROR_INVALID_PARAMETER;
} }
/************************************************************************* /*************************************************************************
* RegSetValue [SHELL.5] * RegSetValue [SHELL.5]
*/ */
LONG RegSetValue(HKEY k, LPCSTR s1, DWORD dw, LPCSTR s2, DWORD dw2) LONG RegSetValue(HKEY hKey, LPCSTR lpSubKey, DWORD dwType,
LPCSTR lpVal, DWORD dwIgnored)
{ {
fprintf(stderr, "RegSetValue : Empty Stub !!!\n"); HKEY hRetKey;
LPKEYSTRUCT lpKey;
LONG dwRet;
#ifdef DEBUG_REG
fprintf(stderr, "RegSetValue(%04X, '%s', %08X, '%s', %08X);\n",
hKey, lpSubKey, dwType, lpVal, dwIgnored);
#endif
if (lpSubKey == NULL) return ERROR_INVALID_PARAMETER;
if (lpVal == NULL) return ERROR_INVALID_PARAMETER;
if ((dwRet = RegOpenKey(hKey, lpSubKey, &hRetKey)) != ERROR_SUCCESS) {
#ifdef DEBUG_REG
fprintf(stderr, "RegSetValue // key not found ... so create it !\n");
#endif
if ((dwRet = RegCreateKey(hKey, lpSubKey, &hRetKey)) != ERROR_SUCCESS) {
fprintf(stderr, "RegSetValue // key creation error %04X !\n", dwRet);
return dwRet;
}
}
lpKey = (LPKEYSTRUCT)GlobalLock(hRetKey);
if (lpKey == NULL) return ERROR_BADKEY;
if (lpKey->lpValue != NULL) free(lpKey->lpValue);
lpKey->lpValue = malloc(strlen(lpVal) + 1);
strcpy(lpKey->lpValue, lpVal);
#ifdef DEBUG_REG
printf("RegSetValue // successful key='%s' val='%s' !\n", lpSubKey, lpVal);
#endif
return ERROR_SUCCESS;
} }
/************************************************************************* /*************************************************************************
* RegQueryValue [SHELL.6] * RegQueryValue [SHELL.6]
*/ */
LONG RegQueryValue(HKEY k, LPCSTR s, LPSTR s2, LONG FAR *p) LONG RegQueryValue(HKEY hKey, LPCSTR lpSubKey, LPSTR lpVal, LONG FAR *lpcb)
{ {
fprintf(stderr, "RegQueryValue : Empty Stub !!!\n"); HKEY hRetKey;
LPKEYSTRUCT lpKey;
LONG dwRet;
int size;
fprintf(stderr, "RegQueryValue(%04X, '%s', %08X, %08X);\n",
hKey, lpSubKey, lpVal, lpcb);
if (lpSubKey == NULL) return ERROR_INVALID_PARAMETER;
if (lpVal == NULL) return ERROR_INVALID_PARAMETER;
if (lpcb == NULL) return ERROR_INVALID_PARAMETER;
if ((dwRet = RegOpenKey(hKey, lpSubKey, &hRetKey)) != ERROR_SUCCESS) {
fprintf(stderr, "RegQueryValue // key not found !\n");
return dwRet;
}
lpKey = (LPKEYSTRUCT)GlobalLock(hRetKey);
if (lpKey == NULL) return ERROR_BADKEY;
if (lpKey->lpValue != NULL) {
size = min(strlen(lpKey->lpValue), *lpcb);
strncpy(lpVal, lpKey->lpValue, size);
*lpcb = (LONG)size;
}
else {
lpVal[0] = '\0';
*lpcb = (LONG)0;
}
printf("RegQueryValue // return '%s' !\n", lpVal);
return ERROR_SUCCESS;
} }
/************************************************************************* /*************************************************************************
* RegEnumKey [SHELL.7] * RegEnumKey [SHELL.7]
*/ */
LONG RegEnumKey(HKEY k, DWORD dw, LPSTR s, DWORD dw2) LONG RegEnumKey(HKEY hKey, DWORD dwSubKey, LPSTR lpBuf, DWORD dwSize)
{ {
fprintf(stderr, "RegEnumKey : Empty Stub !!!\n"); fprintf(stderr, "RegEnumKey : Empty Stub !!!\n");
return ERROR_INVALID_PARAMETER;
} }
/************************************************************************* /*************************************************************************
@ -118,9 +330,15 @@ BOOL DragQueryPoint(HDROP h, POINT FAR *p)
/************************************************************************* /*************************************************************************
* ShellExecute [SHELL.20] * ShellExecute [SHELL.20]
*/ */
HINSTANCE ShellExecute(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, int iShowCmd) HINSTANCE ShellExecute(HWND hWnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, int iShowCmd)
{ {
fprintf(stderr, "ShellExecute : Empty Stub !!!\n"); fprintf(stderr, "ShellExecute // hWnd=%04X\n", hWnd);
fprintf(stderr, "ShellExecute // lpOperation='%s'\n", lpOperation);
fprintf(stderr, "ShellExecute // lpFile='%s'\n", lpFile);
fprintf(stderr, "ShellExecute // lpParameters='%s'\n", lpParameters);
fprintf(stderr, "ShellExecute // lpDirectory='%s'\n", lpDirectory);
fprintf(stderr, "ShellExecute // iShowCmd=%04X\n", iShowCmd);
return 2; /* file not found */
} }
@ -198,6 +416,7 @@ HICON ExtractAssociatedIcon(HINSTANCE hInst,LPSTR lpIconPath, LPWORD lpiIcon)
int RegisterShellHook(void *ptr) int RegisterShellHook(void *ptr)
{ {
fprintf(stderr, "RegisterShellHook : Empty Stub !!!\n"); fprintf(stderr, "RegisterShellHook : Empty Stub !!!\n");
return 0;
} }

View File

@ -878,7 +878,9 @@ INT WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData)
return WSASYSNOTREADY; return WSASYSNOTREADY;
heap = (struct WinSockHeap *) GlobalLock(HeapHandle); heap = (struct WinSockHeap *) GlobalLock(HeapHandle);
#ifndef WINELIB
HEAP_Init(&MyHeap, heap, sizeof(struct WinSockHeap)); HEAP_Init(&MyHeap, heap, sizeof(struct WinSockHeap));
#endif
bcopy(&Winsock_data, lpWSAData, sizeof(Winsock_data)); bcopy(&Winsock_data, lpWSAData, sizeof(Winsock_data));
/* ipc stuff */ /* ipc stuff */

View File

@ -15,6 +15,8 @@
#include "msdos.h" #include "msdos.h"
#include "options.h" #include "options.h"
/* #define DEBUG_FIND /* */
static char Copyright[] = "copyright Erik Bos, 1993"; static char Copyright[] = "copyright Erik Bos, 1993";
WORD ExtendedError, CodePage = 437; WORD ExtendedError, CodePage = 437;
@ -366,20 +368,34 @@ static void SetFileAttributes(struct sigcontext_struct *context)
static void ioctlGetDeviceInfo(struct sigcontext_struct *context) static void ioctlGetDeviceInfo(struct sigcontext_struct *context)
{ {
WORD handle = EBX & 0xffff; WORD handle = EBX & 0xffff;
switch (handle) { switch (handle)
case 0: {
case 1: case 0:
case 2: case 1:
EDX = (EDX & 0xffff0000) | 0x80d3; case 2:
break; EDX = (EDX & 0xffff0000) | 0x80d3;
break;
default:
Barf(context); default:
EDX = (EDX & 0xffff0000) | 0x50; {
struct stat sbuf;
if (fstat(handle, &sbuf) < 0)
{
Barf(context);
EDX = (EDX & 0xffff0000) | 0x50;
SetCflag;
return;
}
/* This isn't the right answer, but should be close enough. */
EDX = (EDX & 0xffff0000) | 0x0943;
} }
ResetCflag; }
ResetCflag;
} }
static void ioctlGenericBlkDevReq(struct sigcontext_struct *context) static void ioctlGenericBlkDevReq(struct sigcontext_struct *context)
@ -542,8 +558,7 @@ static void OpenExistingFile(struct sigcontext_struct *context)
return; return;
} }
Error (0,0,0); Error (0,0,0);
EBX = (EBX & 0xffff0000L) | handle; EAX = (EAX & 0xffff0000L) | handle;
EAX = (EAX & 0xffffff00L) | NoError;
ResetCflag; ResetCflag;
} }
@ -705,13 +720,20 @@ static void FindNext(struct sigcontext_struct *context)
{ {
struct dosdirent *dp; struct dosdirent *dp;
dp = (struct dosdirent *)(dta + 0x0d); #ifdef DEBUG_FIND
fprintf(stderr, "FindNext: ");
#endif
dp = *(struct dosdirent **)(dta + 0x0d);
do { do {
if ((dp = DOS_readdir(dp)) == NULL) { if ((dp = DOS_readdir(dp)) == NULL) {
Error(NoMoreFiles, EC_MediaError , EL_Disk); Error(NoMoreFiles, EC_MediaError , EL_Disk);
EAX = (EAX & 0xffffff00L) | NoMoreFiles; EAX = (EAX & 0xffffff00L) | NoMoreFiles;
SetCflag; SetCflag;
#ifdef DEBUG_FIND
fprintf(stderr, "\n");
#endif
return; return;
} }
} while (*(dta + 0x0c) != dp->attribute); } while (*(dta + 0x0c) != dp->attribute);
@ -723,6 +745,12 @@ static void FindNext(struct sigcontext_struct *context)
EAX = (EAX & 0xffffff00L); EAX = (EAX & 0xffffff00L);
ResetCflag; ResetCflag;
#ifdef DEBUG_FIND
fprintf(stderr,
"DTA: drive %c, template %11.11s, size %d, name %-13.13s\n",
dta[0] + 'A', &dta[1], *(LONG *)(&dta[0x1a]), &dta[0x1e]);
#endif
return; return;
} }
@ -764,13 +792,8 @@ static void FindFirst(struct sigcontext_struct *context)
SetCflag; SetCflag;
return; return;
} }
/* strncpy(dta + 1, AsciizToFCB(dp->filemask), 11); */
/* *((BYTE *) ((void*)dta + 0x0d)) = (BYTE *) dp; */ memcpy(dta + 0x0d, &dp, sizeof(dp));
*((struct dosdirent *)(dta + 0x0d))
=
*dp;
FindNext(context); FindNext(context);
} }

View File

@ -12,6 +12,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <X11/Intrinsic.h> #include <X11/Intrinsic.h>
#include "gdi.h" #include "gdi.h"
#include "metafile.h"
extern const int DC_XROPfunction[]; extern const int DC_XROPfunction[];
@ -28,7 +29,15 @@ BOOL PatBlt( HDC hdc, short left, short top,
int x1, x2, y1, y2; int x1, x2, y1, y2;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return FALSE; if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
MF_MetaParam6(dc, META_PATBLT, left, top, width, height,
HIWORD(rop), LOWORD(rop));
return TRUE;
}
#ifdef DEBUG_GDI #ifdef DEBUG_GDI
printf( "PatBlt: %d %d,%d %dx%d %06x\n", printf( "PatBlt: %d %d,%d %dx%d %06x\n",
hdc, left, top, width, height, rop ); hdc, left, top, width, height, rop );

View File

@ -251,6 +251,16 @@ HBITMAP BITMAP_SelectObject( HDC hdc, DC * dc, HBITMAP hbitmap,
return prevHandle; return prevHandle;
} }
/***********************************************************************
* CreateDiscardableBitmap (GDI.156)
*/
HBITMAP CreateDiscardableBitmap(HDC hdc, short width, short height)
{
printf("CreateDiscardableBitmap(%04X, %d, %d); "
"// call CreateCompatibleBitmap() for now!\n",
hdc, width, height);
return CreateCompatibleBitmap(hdc, width, height);
}
/*********************************************************************** /***********************************************************************
* GetBitmapDimensionEx (GDI.468) * GetBitmapDimensionEx (GDI.468)

View File

@ -237,13 +237,13 @@ HBRUSH BRUSH_SelectObject( HDC hdc, DC * dc, HBRUSH hbrush, BRUSHOBJ * brush )
case BS_SOLID: case BS_SOLID:
case BS_HATCHED: case BS_HATCHED:
case BS_HOLLOW: case BS_HOLLOW:
if (!MF_CreateBrushIndirect(dc, &(brush->logbrush))) if (!MF_CreateBrushIndirect(dc, hbrush, &(brush->logbrush)))
return 0; return 0;
break; break;
case BS_PATTERN: case BS_PATTERN:
case BS_DIBPATTERN: case BS_DIBPATTERN:
if (!MF_CreatePatternBrush(dc, &(brush->logbrush))) if (!MF_CreatePatternBrush(dc, hbrush, &(brush->logbrush)))
return 0; return 0;
break; break;
} }

View File

@ -8,6 +8,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <stdio.h> #include <stdio.h>
#include "gdi.h" #include "gdi.h"
#include "metafile.h"
/*********************************************************************** /***********************************************************************
@ -131,7 +132,14 @@ int SelectVisRgn( HDC hdc, HRGN hrgn )
int OffsetClipRgn( HDC hdc, short x, short y ) int OffsetClipRgn( HDC hdc, short x, short y )
{ {
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR; if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return ERROR;
MF_MetaParam2(dc, META_OFFSETCLIPRGN, x, y);
return NULLREGION; /* ?? */
}
#ifdef DEBUG_CLIPPING #ifdef DEBUG_CLIPPING
printf( "OffsetClipRgn: %d %d,%d\n", hdc, x, y ); printf( "OffsetClipRgn: %d %d,%d\n", hdc, x, y );
#endif #endif
@ -219,7 +227,14 @@ int ExcludeClipRect( HDC hdc, short left, short top,
short right, short bottom ) short right, short bottom )
{ {
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR; if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return ERROR;
MF_MetaParam4(dc, META_EXCLUDECLIPRECT, left, top, right, bottom);
return NULLREGION; /* ?? */
}
#ifdef DEBUG_CLIPPING #ifdef DEBUG_CLIPPING
printf( "ExcludeClipRect: %d %dx%d,%dx%d\n", printf( "ExcludeClipRect: %d %dx%d,%dx%d\n",
hdc, left, top, right, bottom ); hdc, left, top, right, bottom );
@ -236,7 +251,14 @@ int IntersectClipRect( HDC hdc, short left, short top,
short right, short bottom ) short right, short bottom )
{ {
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR; if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return ERROR;
MF_MetaParam4(dc, META_INTERSECTCLIPRECT, left, top, right, bottom);
return NULLREGION; /* ?? */
}
#ifdef DEBUG_CLIPPING #ifdef DEBUG_CLIPPING
printf( "IntersectClipRect: %d %dx%d,%dx%d\n", printf( "IntersectClipRect: %d %dx%d,%dx%d\n",
hdc, left, top, right, bottom ); hdc, left, top, right, bottom );

View File

@ -663,8 +663,10 @@ int EnumFontFamilies(HDC hDC, LPSTR lpszFamily, FARPROC lpEnumFunc, LPSTR lpData
while (TRUE) { while (TRUE) {
if (lpLogFontList[i] == NULL) break; if (lpLogFontList[i] == NULL) break;
if (lpszFamily == NULL) { if (lpszFamily == NULL) {
if (lpLogFontList[i] == NULL) break;
for (j = 0; j < MAX_FONTS; j++) { for (j = 0; j < MAX_FONTS; j++) {
if (lpFaceList[j] == NULL) break; if (lpFaceList[j] == NULL) break;
if (lpLogFontList[i] == NULL) break;
if (strcmp(lpFaceList[j], lpLogFontList[i]->lfFaceName) == 0) { if (strcmp(lpFaceList[j], lpLogFontList[i]->lfFaceName) == 0) {
i++; j = 0; i++; j = 0;
} }

View File

@ -13,6 +13,11 @@ static char Copyright[] = "Copyright David W. Metcalfe, 1994";
#define DEBUG_METAFILE #define DEBUG_METAFILE
#define HTINCR 10 /* handle table allocation size increment */
static HANDLE hHT; /* handle of the handle table */
static int HTLen; /* allocated length of handle table */
/****************************************************************** /******************************************************************
* CreateMetafile GDI.125 * CreateMetafile GDI.125
*/ */
@ -22,6 +27,7 @@ HANDLE CreateMetaFile(LPSTR lpFilename)
HANDLE handle; HANDLE handle;
METAFILE *mf; METAFILE *mf;
METAHEADER *mh; METAHEADER *mh;
HANDLETABLE *ht;
#ifdef DEBUG_METAFILE #ifdef DEBUG_METAFILE
printf("CreateMetaFile: %s\n", lpFilename); printf("CreateMetaFile: %s\n", lpFilename);
@ -64,6 +70,12 @@ HANDLE CreateMetaFile(LPSTR lpFilename)
else /* memory based metafile */ else /* memory based metafile */
mh->mtType = 0; mh->mtType = 0;
/* create the handle table */
HTLen = HTINCR;
hHT = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT,
sizeof(HANDLETABLE) * HTLen);
ht = (HANDLETABLE *)GlobalLock(hHT);
GlobalUnlock(mf->hMetaHdr); GlobalUnlock(mf->hMetaHdr);
GlobalUnlock(dc->w.hMetaFile); GlobalUnlock(dc->w.hMetaFile);
return handle; return handle;
@ -94,9 +106,12 @@ HMETAFILE CloseMetaFile(HDC hdc)
/* Construct the end of metafile record - this is undocumented /* Construct the end of metafile record - this is undocumented
* but is created by MS Windows 3.1. * but is created by MS Windows 3.1.
*/ */
mr->rdSize = 3; if (!MF_MetaParam0(dc, META_EOF))
mr->rdFunction = META_EOF; {
MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2); GlobalFree(mf->hMetaHdr);
GlobalFree(dc->w.hMetaFile);
return 0;
}
if (mh->mtType == 1) /* disk based metafile */ if (mh->mtType == 1) /* disk based metafile */
{ {
@ -115,8 +130,12 @@ HMETAFILE CloseMetaFile(HDC hdc)
_lclose(mf->hFile); _lclose(mf->hFile);
} }
/* delete the handle table */
GlobalFree(hHT);
GlobalUnlock(mf->hMetaHdr); GlobalUnlock(mf->hMetaHdr);
hmf = dc->w.hMetaFile; hmf = dc->w.hMetaFile;
GlobalUnlock(hmf);
GDI_FreeObject(hdc); GDI_FreeObject(hdc);
return hmf; return hmf;
} }
@ -138,6 +157,292 @@ BOOL DeleteMetaFile(HMETAFILE hmf)
} }
/******************************************************************
* PlayMetafile GDI.123
*/
BOOL PlayMetaFile(HDC hdc, HMETAFILE hmf)
{
METAFILE *mf = (METAFILE *)GlobalLock(hmf);
METAHEADER *mh;
METARECORD *mr;
HANDLETABLE *ht;
char *buffer;
if (mf->wMagic != METAFILE_MAGIC)
return FALSE;
mh = (METAHEADER *)GlobalLock(mf->hMetaHdr);
if (mh->mtType == 1) /* disk based metafile */
{
mf->hFile = _lopen(mf->Filename, OF_READ);
mf->hBuffer = GlobalAlloc(GMEM_MOVEABLE, mh->mtMaxRecord * 2);
buffer = (char *)GlobalLock(mf->hBuffer);
_llseek(mf->hFile, mh->mtHeaderSize * 2, 0);
mf->MetaOffset = mh->mtHeaderSize * 2;
}
else if (mh->mtType == 0) /* memory based metafile */
mf->MetaOffset = mh->mtHeaderSize * 2;
else /* not a valid metafile type */
return FALSE;
/* create the handle table */
hHT = GlobalAlloc(GMEM_MOVEABLE, sizeof(HANDLETABLE) * mh->mtNoObjects);
ht = (HANDLETABLE *)GlobalLock(hHT);
/* loop through metafile playing records */
while (mf->MetaOffset < mh->mtSize * 2)
{
if (mh->mtType == 1) /* disk based metafile */
{
_lread(mf->hFile, buffer, sizeof(METARECORD));
mr = (METARECORD *)&buffer;
_lread(mf->hFile, (char *)(mr->rdParam + 1), (mr->rdSize * 2) -
sizeof(METARECORD));
mf->MetaOffset += mr->rdSize * 2;
}
else /* memory based metafile */
{
mr = (METARECORD *)((char *)mh + mf->MetaOffset);
mf->MetaOffset += mr->rdSize * 2;
}
PlayMetaFileRecord(hdc, ht, mr, mh->mtNoObjects);
}
/* close disk based metafile and free buffer */
if (mh->mtType == 1)
{
GlobalFree(mf->hBuffer);
_lclose(mf->hFile);
}
/* free handle table */
GlobalFree(hHT);
return TRUE;
}
/******************************************************************
* PlayMetaFileRecord GDI.176
*/
void PlayMetaFileRecord(HDC hdc, HANDLETABLE *ht, METARECORD *mr,
WORD nHandles)
{
short s1;
HANDLE hndl;
char *ptr;
BITMAPINFOHEADER *infohdr;
switch (mr->rdFunction)
{
case META_SETBKCOLOR:
SetBkColor(hdc, *(mr->rdParam));
break;
case META_SETBKMODE:
SetBkMode(hdc, *(mr->rdParam));
break;
case META_SETMAPMODE:
SetMapMode(hdc, *(mr->rdParam));
break;
case META_SETROP2:
SetROP2(hdc, *(mr->rdParam));
break;
case META_SETRELABS:
SetRelAbs(hdc, *(mr->rdParam));
break;
case META_SETPOLYFILLMODE:
SetPolyFillMode(hdc, *(mr->rdParam));
break;
case META_SETSTRETCHBLTMODE:
SetStretchBltMode(hdc, *(mr->rdParam));
break;
case META_SETTEXTCOLOR:
SetTextColor(hdc, MAKELONG(*(mr->rdParam), *(mr->rdParam + 1)));
break;
case META_SETWINDOWORG:
SetWindowOrg(hdc, *(mr->rdParam + 1), *(mr->rdParam));
break;
case META_SETWINDOWEXT:
SetWindowExt(hdc, *(mr->rdParam + 1), *(mr->rdParam));
break;
case META_SETVIEWPORTORG:
SetViewportOrg(hdc, *(mr->rdParam + 1), *(mr->rdParam));
break;
case META_SETVIEWPORTEXT:
SetViewportExt(hdc, *(mr->rdParam + 1), *(mr->rdParam));
break;
case META_OFFSETWINDOWORG:
OffsetWindowOrg(hdc, *(mr->rdParam + 1), *(mr->rdParam));
break;
case META_SCALEWINDOWEXT:
ScaleWindowExt(hdc, *(mr->rdParam + 3), *(mr->rdParam + 2),
*(mr->rdParam + 1), *(mr->rdParam));
break;
case META_OFFSETVIEWPORTORG:
OffsetViewportOrg(hdc, *(mr->rdParam + 1), *(mr->rdParam));
break;
case META_SCALEVIEWPORTEXT:
ScaleViewportExt(hdc, *(mr->rdParam + 3), *(mr->rdParam + 2),
*(mr->rdParam + 1), *(mr->rdParam));
break;
case META_LINETO:
LineTo(hdc, *(mr->rdParam + 1), *(mr->rdParam));
break;
case META_MOVETO:
MoveTo(hdc, *(mr->rdParam + 1), *(mr->rdParam));
break;
case META_EXCLUDECLIPRECT:
ExcludeClipRect(hdc, *(mr->rdParam + 3), *(mr->rdParam + 2),
*(mr->rdParam + 1), *(mr->rdParam));
break;
case META_INTERSECTCLIPRECT:
IntersectClipRect(hdc, *(mr->rdParam + 3), *(mr->rdParam + 2),
*(mr->rdParam + 1), *(mr->rdParam));
break;
case META_ARC:
Arc(hdc, *(mr->rdParam + 7), *(mr->rdParam + 6), *(mr->rdParam + 5),
*(mr->rdParam + 4), *(mr->rdParam + 3), *(mr->rdParam + 2),
*(mr->rdParam + 1), *(mr->rdParam));
break;
case META_ELLIPSE:
Ellipse(hdc, *(mr->rdParam + 3), *(mr->rdParam + 2),
*(mr->rdParam + 1), *(mr->rdParam));
break;
case META_FLOODFILL:
FloodFill(hdc, *(mr->rdParam + 3), *(mr->rdParam + 2),
MAKELONG(*(mr->rdParam + 1), *(mr->rdParam)));
break;
case META_PIE:
Pie(hdc, *(mr->rdParam + 7), *(mr->rdParam + 6), *(mr->rdParam + 5),
*(mr->rdParam + 4), *(mr->rdParam + 3), *(mr->rdParam + 2),
*(mr->rdParam + 1), *(mr->rdParam));
break;
case META_RECTANGLE:
Ellipse(hdc, *(mr->rdParam + 3), *(mr->rdParam + 2),
*(mr->rdParam + 1), *(mr->rdParam));
break;
case META_ROUNDRECT:
RoundRect(hdc, *(mr->rdParam + 5), *(mr->rdParam + 4),
*(mr->rdParam + 3), *(mr->rdParam + 2),
*(mr->rdParam + 1), *(mr->rdParam));
break;
case META_PATBLT:
PatBlt(hdc, *(mr->rdParam + 5), *(mr->rdParam + 4),
*(mr->rdParam + 3), *(mr->rdParam + 2),
MAKELONG(*(mr->rdParam), *(mr->rdParam + 1)));
break;
case META_SAVEDC:
SaveDC(hdc);
break;
case META_SETPIXEL:
SetPixel(hdc, *(mr->rdParam + 3), *(mr->rdParam + 2),
MAKELONG(*(mr->rdParam + 1), *(mr->rdParam)));
break;
case META_OFFSETCLIPRGN:
OffsetClipRgn(hdc, *(mr->rdParam + 1), *(mr->rdParam));
break;
case META_TEXTOUT:
s1 = *(mr->rdParam);
TextOut(hdc, *(mr->rdParam + ((s1 + 1) >> 1) + 2),
*(mr->rdParam + ((s1 + 1) >> 1) + 1),
(char *)(mr->rdParam + 1), s1);
break;
case META_POLYGON:
Polygon(hdc, (LPPOINT)(mr->rdParam + 1), *(mr->rdParam));
break;
case META_POLYLINE:
Polyline(hdc, (LPPOINT)(mr->rdParam + 1), *(mr->rdParam));
break;
case META_RESTOREDC:
RestoreDC(hdc, *(mr->rdParam));
break;
case META_SELECTOBJECT:
SelectObject(hdc, *(ht->objectHandle + *(mr->rdParam)));
break;
case META_CHORD:
Chord(hdc, *(mr->rdParam + 7), *(mr->rdParam + 6), *(mr->rdParam + 5),
*(mr->rdParam + 4), *(mr->rdParam + 3), *(mr->rdParam + 2),
*(mr->rdParam + 1), *(mr->rdParam));
break;
case META_CREATEPATTERNBRUSH:
switch (*(mr->rdParam))
{
case BS_PATTERN:
infohdr = (BITMAPINFOHEADER *)(mr->rdParam + 2);
MF_AddHandle(ht, nHandles,
CreatePatternBrush(CreateBitmap(infohdr->biWidth,
infohdr->biHeight,
infohdr->biPlanes,
infohdr->biBitCount,
(LPSTR)(mr->rdParam +
(sizeof(BITMAPINFOHEADER) / 2) + 4))));
break;
case BS_DIBPATTERN:
s1 = mr->rdSize * 2 - sizeof(METARECORD) - 2;
hndl = GlobalAlloc(GMEM_MOVEABLE, s1);
ptr = GlobalLock(hndl);
memcpy(ptr, mr->rdParam + 2, s1);
GlobalUnlock(hndl);
MF_AddHandle(ht, nHandles,
CreateDIBPatternBrush(hndl, *(mr->rdParam + 1)));
GlobalFree(hndl);
}
break;
case META_CREATEPENINDIRECT:
MF_AddHandle(ht, nHandles,
CreatePenIndirect((LOGPEN *)(&(mr->rdParam))));
break;
case META_CREATEBRUSHINDIRECT:
MF_AddHandle(ht, nHandles,
CreateBrushIndirect((LOGBRUSH *)(&(mr->rdParam))));
break;
default:
printf("PlayMetaFileRecord: Unknown record type %x\n",
mr->rdFunction);
}
}
/****************************************************************** /******************************************************************
* MF_WriteRecord * MF_WriteRecord
*/ */
@ -176,6 +481,71 @@ BOOL MF_WriteRecord(HMETAFILE hmf, METARECORD *mr, WORD rlen)
} }
/******************************************************************
* MF_AddHandle
*
* Add a handle to an external handle table and return the index
*/
int MF_AddHandle(HANDLETABLE *ht, WORD htlen, HANDLE hobj)
{
int i;
for (i = 0; i < htlen; i++)
{
if (*(ht->objectHandle + i) == 0)
{
*(ht->objectHandle + i) = hobj;
return i;
}
}
return -1;
}
/******************************************************************
* MF_AddHandleInternal
*
* Add a handle to the internal handle table and return the index
*/
int MF_AddHandleInternal(HANDLE hobj)
{
int i;
HANDLETABLE *ht = (HANDLETABLE *)GlobalLock(hHT);
for (i = 0; i < HTLen; i++)
{
if (*(ht->objectHandle + i) == 0)
{
*(ht->objectHandle + i) = hobj;
GlobalUnlock(hHT);
return i;
}
}
GlobalUnlock(hHT);
if (!(hHT = GlobalReAlloc(hHT, HTINCR, GMEM_MOVEABLE | GMEM_ZEROINIT)))
return -1;
HTLen += HTINCR;
ht = (HANDLETABLE *)GlobalLock(hHT);
*(ht->objectHandle + i) = hobj;
GlobalUnlock(hHT);
return i;
}
/******************************************************************
* MF_MetaParam0
*/
BOOL MF_MetaParam0(DC *dc, short func)
{
char buffer[8];
METARECORD *mr = (METARECORD *)&buffer;
mr->rdSize = 3;
mr->rdFunction = func;
return MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2);
}
/****************************************************************** /******************************************************************
* MF_MetaParam1 * MF_MetaParam1
*/ */
@ -274,16 +644,15 @@ BOOL MF_MetaParam8(DC *dc, short func, short param1, short param2,
/****************************************************************** /******************************************************************
* MF_CreateBrushIndirect * MF_CreateBrushIndirect
*/ */
BOOL MF_CreateBrushIndirect(DC *dc, LOGBRUSH *logbrush) BOOL MF_CreateBrushIndirect(DC *dc, HBRUSH hBrush, LOGBRUSH *logbrush)
{ {
int index;
BOOL rc;
char buffer[sizeof(METARECORD) - 2 + sizeof(LOGBRUSH)]; char buffer[sizeof(METARECORD) - 2 + sizeof(LOGBRUSH)];
METARECORD *mr = (METARECORD *)&buffer; METARECORD *mr = (METARECORD *)&buffer;
METAFILE *mf = (METAFILE *)GlobalLock(dc->w.hMetaFile); METAFILE *mf;
METAHEADER *mh = (METAHEADER *)GlobalLock(mf->hMetaHdr); METAHEADER *mh;
#ifdef DEBUG_METAFILE
printf("MF_CreateBrushIndirect\n");
#endif
mr->rdSize = (sizeof(METARECORD) + sizeof(LOGBRUSH) - 2) / 2; mr->rdSize = (sizeof(METARECORD) + sizeof(LOGBRUSH) - 2) / 2;
mr->rdFunction = META_CREATEBRUSHINDIRECT; mr->rdFunction = META_CREATEBRUSHINDIRECT;
memcpy(&(mr->rdParam), logbrush, sizeof(LOGBRUSH)); memcpy(&(mr->rdParam), logbrush, sizeof(LOGBRUSH));
@ -292,24 +661,37 @@ BOOL MF_CreateBrushIndirect(DC *dc, LOGBRUSH *logbrush)
mr->rdSize = sizeof(METARECORD) / 2; mr->rdSize = sizeof(METARECORD) / 2;
mr->rdFunction = META_SELECTOBJECT; mr->rdFunction = META_SELECTOBJECT;
*(mr->rdParam) = mh->mtNoObjects++; if ((index = MF_AddHandleInternal(hBrush)) == -1)
return MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2); return FALSE;
mf = (METAFILE *)GlobalLock(dc->w.hMetaFile);
mh = (METAHEADER *)GlobalLock(mf->hMetaHdr);
*(mr->rdParam) = index;
if (index >= mh->mtNoObjects)
mh->mtNoObjects++;
rc = MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2);
GlobalUnlock(mf->hMetaHdr);
GlobalUnlock(dc->w.hMetaFile);
return rc;
} }
/****************************************************************** /******************************************************************
* MF_CreatePatternBrush * MF_CreatePatternBrush
*/ */
BOOL MF_CreatePatternBrush(DC *dc, LOGBRUSH *logbrush) BOOL MF_CreatePatternBrush(DC *dc, HBRUSH hBrush, LOGBRUSH *logbrush)
{ {
DWORD len, bmSize, biSize; DWORD len, bmSize, biSize;
HANDLE hmr; HANDLE hmr;
METARECORD *mr; METARECORD *mr;
BITMAPOBJ *bmp; BITMAPOBJ *bmp;
BITMAPINFO *info; BITMAPINFO *info;
BITMAPINFOHEADER *infohdr;
int index;
BOOL rc;
char buffer[sizeof(METARECORD)]; char buffer[sizeof(METARECORD)];
METAFILE *mf = (METAFILE *)GlobalLock(dc->w.hMetaFile); METAFILE *mf;
METAHEADER *mh = (METAHEADER *)GlobalLock(mf->hMetaHdr); METAHEADER *mh;
switch (logbrush->lbStyle) switch (logbrush->lbStyle)
{ {
@ -317,7 +699,7 @@ BOOL MF_CreatePatternBrush(DC *dc, LOGBRUSH *logbrush)
bmp = (BITMAPOBJ *)GDI_GetObjPtr(logbrush->lbHatch, BITMAP_MAGIC); bmp = (BITMAPOBJ *)GDI_GetObjPtr(logbrush->lbHatch, BITMAP_MAGIC);
if (!bmp) return FALSE; if (!bmp) return FALSE;
len = sizeof(METARECORD) + sizeof(BITMAPINFOHEADER) + len = sizeof(METARECORD) + sizeof(BITMAPINFOHEADER) +
(bmp->bitmap.bmHeight * bmp->bitmap.bmWidthBytes) + 2; (bmp->bitmap.bmHeight * bmp->bitmap.bmWidthBytes) + 6;
if (!(hmr = GlobalAlloc(GMEM_MOVEABLE, len))) if (!(hmr = GlobalAlloc(GMEM_MOVEABLE, len)))
return FALSE; return FALSE;
mr = (METARECORD *)GlobalLock(hmr); mr = (METARECORD *)GlobalLock(hmr);
@ -325,7 +707,14 @@ BOOL MF_CreatePatternBrush(DC *dc, LOGBRUSH *logbrush)
mr->rdFunction = META_DIBCREATEPATTERNBRUSH; mr->rdFunction = META_DIBCREATEPATTERNBRUSH;
mr->rdSize = len / 2; mr->rdSize = len / 2;
*(mr->rdParam) = logbrush->lbStyle; *(mr->rdParam) = logbrush->lbStyle;
memcpy(mr->rdParam + (sizeof(BITMAPINFOHEADER) / 2) + 2, *(mr->rdParam + 1) = DIB_RGB_COLORS;
infohdr = (BITMAPINFOHEADER *)(mr->rdParam + 2);
infohdr->biSize = sizeof(BITMAPINFOHEADER);
infohdr->biWidth = bmp->bitmap.bmWidth;
infohdr->biHeight = bmp->bitmap.bmHeight;
infohdr->biPlanes = bmp->bitmap.bmPlanes;
infohdr->biBitCount = bmp->bitmap.bmBitsPixel;
memcpy(mr->rdParam + (sizeof(BITMAPINFOHEADER) / 2) + 4,
bmp->bitmap.bmBits, bmp->bitmap.bmBits,
bmp->bitmap.bmHeight * bmp->bitmap.bmWidthBytes); bmp->bitmap.bmHeight * bmp->bitmap.bmWidthBytes);
break; break;
@ -359,24 +748,33 @@ BOOL MF_CreatePatternBrush(DC *dc, LOGBRUSH *logbrush)
mr = (METARECORD *)&buffer; mr = (METARECORD *)&buffer;
mr->rdSize = sizeof(METARECORD) / 2; mr->rdSize = sizeof(METARECORD) / 2;
mr->rdFunction = META_SELECTOBJECT; mr->rdFunction = META_SELECTOBJECT;
(WORD)(*(mr->rdParam)) = mh->mtNoObjects++; if ((index = MF_AddHandleInternal(hBrush)) == -1)
return MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2); return FALSE;
mf = (METAFILE *)GlobalLock(dc->w.hMetaFile);
mh = (METAHEADER *)GlobalLock(mf->hMetaHdr);
*(mr->rdParam) = index;
if (index >= mh->mtNoObjects)
mh->mtNoObjects++;
rc = MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2);
GlobalUnlock(mf->hMetaHdr);
GlobalUnlock(dc->w.hMetaFile);
return rc;
} }
/****************************************************************** /******************************************************************
* MF_CreatePenIndirect * MF_CreatePenIndirect
*/ */
BOOL MF_CreatePenIndirect(DC *dc, LOGPEN *logpen) BOOL MF_CreatePenIndirect(DC *dc, HPEN hPen, LOGPEN *logpen)
{ {
int index;
BOOL rc;
char buffer[sizeof(METARECORD) - 2 + sizeof(LOGPEN)]; char buffer[sizeof(METARECORD) - 2 + sizeof(LOGPEN)];
METARECORD *mr = (METARECORD *)&buffer; METARECORD *mr = (METARECORD *)&buffer;
METAFILE *mf = (METAFILE *)GlobalLock(dc->w.hMetaFile); METAFILE *mf;
METAHEADER *mh = (METAHEADER *)GlobalLock(mf->hMetaHdr); METAHEADER *mh;
#ifdef DEBUG_METAFILE
printf("MF_CreatePenIndirect\n");
#endif
mr->rdSize = (sizeof(METARECORD) + sizeof(LOGPEN) - 2) / 2; mr->rdSize = (sizeof(METARECORD) + sizeof(LOGPEN) - 2) / 2;
mr->rdFunction = META_CREATEPENINDIRECT; mr->rdFunction = META_CREATEPENINDIRECT;
memcpy(&(mr->rdParam), logpen, sizeof(LOGPEN)); memcpy(&(mr->rdParam), logpen, sizeof(LOGPEN));
@ -385,8 +783,18 @@ BOOL MF_CreatePenIndirect(DC *dc, LOGPEN *logpen)
mr->rdSize = sizeof(METARECORD) / 2; mr->rdSize = sizeof(METARECORD) / 2;
mr->rdFunction = META_SELECTOBJECT; mr->rdFunction = META_SELECTOBJECT;
(WORD)(*(mr->rdParam)) = mh->mtNoObjects++; if ((index = MF_AddHandleInternal(hPen)) == -1)
return MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2); return FALSE;
mf = (METAFILE *)GlobalLock(dc->w.hMetaFile);
mh = (METAHEADER *)GlobalLock(mf->hMetaHdr);
*(mr->rdParam) = index;
if (index >= mh->mtNoObjects)
mh->mtNoObjects++;
rc = MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2);
GlobalUnlock(mf->hMetaHdr);
GlobalUnlock(dc->w.hMetaFile);
return rc;
} }
@ -400,7 +808,7 @@ BOOL MF_TextOut(DC *dc, short x, short y, LPSTR str, short count)
HANDLE hmr; HANDLE hmr;
METARECORD *mr; METARECORD *mr;
len = sizeof(METARECORD) + count + 4; len = sizeof(METARECORD) + (((count + 1) >> 1) * 2) + 4;
if (!(hmr = GlobalAlloc(GMEM_MOVEABLE, len))) if (!(hmr = GlobalAlloc(GMEM_MOVEABLE, len)))
return FALSE; return FALSE;
mr = (METARECORD *)GlobalLock(hmr); mr = (METARECORD *)GlobalLock(hmr);
@ -410,8 +818,8 @@ BOOL MF_TextOut(DC *dc, short x, short y, LPSTR str, short count)
mr->rdFunction = META_TEXTOUT; mr->rdFunction = META_TEXTOUT;
*(mr->rdParam) = count; *(mr->rdParam) = count;
memcpy(mr->rdParam + 1, str, count); memcpy(mr->rdParam + 1, str, count);
*(mr->rdParam + (count / 2) + 1) = y; *(mr->rdParam + ((count + 1) >> 1) + 1) = y;
*(mr->rdParam + (count / 2) + 2) = x; *(mr->rdParam + ((count + 1) >> 1) + 2) = x;
rc = MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2); rc = MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2);
GlobalFree(hmr); GlobalFree(hmr);
return rc; return rc;

View File

@ -64,7 +64,7 @@ HPEN PEN_SelectObject( DC * dc, HPEN hpen, PENOBJ * pen )
HPEN prevHandle = dc->w.hPen; HPEN prevHandle = dc->w.hPen;
if (dc->header.wMagic == METAFILE_DC_MAGIC) if (dc->header.wMagic == METAFILE_DC_MAGIC)
return MF_CreatePenIndirect(dc, &(pen->logpen)); return MF_CreatePenIndirect(dc, hpen, &(pen->logpen));
dc->w.hPen = hpen; dc->w.hPen = hpen;

View File

@ -18,6 +18,16 @@ CallLineDDAProc (FARPROC back, int x, int y, long lParam)
(*back)(x, y, lParam); (*back)(x, y, lParam);
} }
DWORD CallHookProc (HOOKPROC func, short code, WPARAM wParam, LPARAM lParam)
{
(*func)(code, wParam, lParam);
}
BOOL CallGrayStringProc (FARPROC func, HDC hdc, LPARAM lParam, INT cch)
{
return (*func) (hdc, lParam, cch);
}
/* /*
* Header loading routines for WineLib. * Header loading routines for WineLib.
*/ */

View File

@ -50,7 +50,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#define POP_0 "\tadd\t$4,%%esp\n" #define POP_0 "\tadd\t$4,%%esp\n"
#define POP_SS "\tpopw\t%%ss\n\tadd\t$2,%%esp\n" #define POP_SS "\tpopw\t%%ss\n\tadd\t$2,%%esp\n"
#define POP_ESP "\tpopl\t%%esp\n" #define POP_ESP "\tpopl\t%%esp\n"
#define POP_EFL "\tpopfl\n" #define POP_EFL "\tpopl\t%%gs:return_value\n"
#define POP_CS "\tpopw\t%%cs\n\tadd\t$2,%%esp\n" #define POP_CS "\tpopw\t%%cs\n\tadd\t$2,%%esp\n"
#define POP_EIP "\tpopl\t$0\n" #define POP_EIP "\tpopl\t$0\n"
#define POP_DS "\tpopw\t%%ds\n\tadd\t$2,%%esp\n" #define POP_DS "\tpopw\t%%ds\n\tadd\t$2,%%esp\n"
@ -728,6 +728,8 @@ main(int argc, char **argv)
if (add_count > 0) if (add_count > 0)
fprintf(fp, "\tadd\t$%d,%%esp\n", add_count); fprintf(fp, "\tadd\t$%d,%%esp\n", add_count);
fprintf(fp, "\tpushl\t%%gs:return_value\n\tpopfl\n");
fclose(fp); fclose(fp);
exit(0); exit(0);

View File

@ -293,7 +293,14 @@ int SaveDC( HDC hdc )
HDC hdcs; HDC hdcs;
DC * dc, * dcs; DC * dc, * dcs;
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0; dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return 0;
MF_MetaParam0(dc, META_SAVEDC);
return 1; /* ?? */
}
if (!(hdcs = GetDCState( hdc ))) return 0; if (!(hdcs = GetDCState( hdc ))) return 0;
dcs = (DC *) GDI_HEAP_ADDR( hdcs ); dcs = (DC *) GDI_HEAP_ADDR( hdcs );
dcs->header.hNext = dc->header.hNext; dcs->header.hNext = dc->header.hNext;
@ -315,7 +322,15 @@ BOOL RestoreDC( HDC hdc, short level )
#ifdef DEBUG_DC #ifdef DEBUG_DC
printf( "RestoreDC: %d %d\n", hdc, level ); printf( "RestoreDC: %d %d\n", hdc, level );
#endif #endif
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return FALSE; dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
if (level != -1) return FALSE;
MF_MetaParam1(dc, META_RESTOREDC, level);
return TRUE;
}
if (level == -1) level = dc->saveLevel; if (level == -1) level = dc->saveLevel;
if ((level < 1) || (level > (short)dc->saveLevel)) return FALSE; if ((level < 1) || (level > (short)dc->saveLevel)) return FALSE;

View File

@ -4,7 +4,7 @@
* Copyright 1993 Alexandre Julliard * Copyright 1993 Alexandre Julliard
*/ */
#define DEBUG_DIALOG /* */ /* #define DEBUG_DIALOG /* */
static char Copyright[] = "Copyright Alexandre Julliard, 1993"; static char Copyright[] = "Copyright Alexandre Julliard, 1993";

View File

@ -34,6 +34,7 @@ static XContext winContext = 0;
/* State variables */ /* State variables */
BOOL MouseButtonsStates[NB_BUTTONS] = { FALSE, FALSE, FALSE }; BOOL MouseButtonsStates[NB_BUTTONS] = { FALSE, FALSE, FALSE };
BOOL AsyncMouseButtonsStates[NB_BUTTONS] = { FALSE, FALSE, FALSE };
static WORD ALTKeyState; static WORD ALTKeyState;
static HWND captureWnd = 0; static HWND captureWnd = 0;
Window winHasCursor = 0; Window winHasCursor = 0;
@ -381,6 +382,7 @@ static void EVENT_ButtonPress( XButtonEvent *event )
if (buttonNum >= NB_BUTTONS) return; if (buttonNum >= NB_BUTTONS) return;
MouseButtonsStates[buttonNum] = TRUE; MouseButtonsStates[buttonNum] = TRUE;
AsyncMouseButtonsStates[buttonNum] = TRUE;
winHasCursor = event->window; winHasCursor = event->window;
hardware_event( messages[buttonNum], hardware_event( messages[buttonNum],
EVENT_XStateToKeyState( event->state ), 0L, EVENT_XStateToKeyState( event->state ), 0L,

View File

@ -7,8 +7,10 @@
static char Copyright[] = "Copyright Bob Amstadt, 1993"; static char Copyright[] = "Copyright Bob Amstadt, 1993";
#include "win.h" #include "win.h"
#include "windows.h"
extern BOOL MouseButtonsStates[3]; extern BOOL MouseButtonsStates[3];
extern BOOL AsyncMouseButtonsStates[3];
/********************************************************************** /**********************************************************************
* GetKeyState (USER.106) * GetKeyState (USER.106)
@ -26,3 +28,48 @@ int GetKeyState(int keycode)
return 0; return 0;
} }
} }
/**********************************************************************
*
* GetAsyncKeyState (USER.249)
*
* Determine if a key is or was pressed. retval has high-order
* byte set to 1 if currently pressed, low-order byte 1 if key has
* been pressed.
*
* This uses the variable AsyncMouseButtonsStates (set in event.c)
* which have the mouse button number set to true if the mouse had been
* depressed since the last call to GetAsyncKeyState.
*
* There should also be some keyboard stuff here... it isn't here
* yet.
*/
int GetAsyncKeyState(int nKey)
{
short retval;
switch (nKey) {
case VK_LBUTTON:
retval = AsyncMouseButtonsStates[0] |
(MouseButtonsStates[0] << 8);
break;
case VK_MBUTTON:
retval = AsyncMouseButtonsStates[1] |
(MouseButtonsStates[1] << 8);
break;
case VK_RBUTTON:
retval = AsyncMouseButtonsStates[2] |
MouseButtonsStates[2] << 8;
break;
default:
retval = 0;
break;
}
bzero(AsyncMouseButtonsStates, 3); /* all states to false */
return retval;
}

View File

@ -163,7 +163,23 @@ WORD SetMapMode( HDC hdc, WORD mode )
DWORD SetViewportExt( HDC hdc, short x, short y ) DWORD SetViewportExt( HDC hdc, short x, short y )
{ {
SIZE size; SIZE size;
if (!SetViewportExtEx( hdc, x, y, &size )) return 0; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
MF_MetaParam2(dc, META_SETVIEWPORTEXT, x, y);
return 0;
}
size.cx = dc->w.VportExtX;
size.cy = dc->w.VportExtY;
if ((dc->w.MapMode != MM_ISOTROPIC) && (dc->w.MapMode != MM_ANISOTROPIC))
return size.cx | (size.cy << 16);
if (!x || !y) return 0;
dc->w.VportExtX = x;
dc->w.VportExtY = y;
if (dc->w.MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
return size.cx | (size.cy << 16); return size.cx | (size.cy << 16);
} }
@ -196,7 +212,19 @@ BOOL SetViewportExtEx( HDC hdc, short x, short y, LPSIZE size )
DWORD SetViewportOrg( HDC hdc, short x, short y ) DWORD SetViewportOrg( HDC hdc, short x, short y )
{ {
POINT pt; POINT pt;
if (!SetViewportOrgEx( hdc, x, y, &pt )) return 0; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
MF_MetaParam2(dc, META_SETVIEWPORTORG, x, y);
return 0;
}
pt.x = dc->w.VportOrgX;
pt.y = dc->w.VportOrgY;
dc->w.VportOrgX = x;
dc->w.VportOrgY = y;
return pt.x | (pt.y << 16); return pt.x | (pt.y << 16);
} }
@ -225,7 +253,23 @@ BOOL SetViewportOrgEx( HDC hdc, short x, short y, LPPOINT pt )
DWORD SetWindowExt( HDC hdc, short x, short y ) DWORD SetWindowExt( HDC hdc, short x, short y )
{ {
SIZE size; SIZE size;
if (!SetWindowExtEx( hdc, x, y, &size )) return 0; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
MF_MetaParam2(dc, META_SETWINDOWEXT, x, y);
return 0;
}
size.cx = dc->w.WndExtX;
size.cy = dc->w.WndExtY;
if ((dc->w.MapMode != MM_ISOTROPIC) && (dc->w.MapMode != MM_ANISOTROPIC))
return size.cx | (size.cy << 16);
if (!x || !y) return 0;
dc->w.WndExtX = x;
dc->w.WndExtY = y;
if (dc->w.MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
return size.cx | (size.cy << 16); return size.cx | (size.cy << 16);
} }
@ -258,7 +302,19 @@ BOOL SetWindowExtEx( HDC hdc, short x, short y, LPSIZE size )
DWORD SetWindowOrg( HDC hdc, short x, short y ) DWORD SetWindowOrg( HDC hdc, short x, short y )
{ {
POINT pt; POINT pt;
if (!SetWindowOrgEx( hdc, x, y, &pt )) return 0; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
MF_MetaParam2(dc, META_SETWINDOWORG, x, y);
return 0;
}
pt.x = dc->w.WndOrgX;
pt.y = dc->w.WndOrgY;
dc->w.WndOrgX = x;
dc->w.WndOrgY = y;
return pt.x | (pt.y << 16); return pt.x | (pt.y << 16);
} }
@ -287,7 +343,19 @@ BOOL SetWindowOrgEx( HDC hdc, short x, short y, LPPOINT pt )
DWORD OffsetViewportOrg( HDC hdc, short x, short y ) DWORD OffsetViewportOrg( HDC hdc, short x, short y )
{ {
POINT pt; POINT pt;
if (!OffsetViewportOrgEx( hdc, x, y, &pt )) return 0; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
MF_MetaParam2(dc, META_OFFSETVIEWPORTORG, x, y);
return 0;
}
pt.x = dc->w.VportOrgX;
pt.y = dc->w.VportOrgY;
dc->w.VportOrgX += x;
dc->w.VportOrgY += y;
return pt.x | (pt.y << 16); return pt.x | (pt.y << 16);
} }
@ -316,7 +384,19 @@ BOOL OffsetViewportOrgEx( HDC hdc, short x, short y, LPPOINT pt )
DWORD OffsetWindowOrg( HDC hdc, short x, short y ) DWORD OffsetWindowOrg( HDC hdc, short x, short y )
{ {
POINT pt; POINT pt;
if (!OffsetWindowOrgEx( hdc, x, y, &pt )) return 0; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
MF_MetaParam2(dc, META_OFFSETWINDOWORG, x, y);
return 0;
}
pt.x = dc->w.WndOrgX;
pt.y = dc->w.WndOrgY;
dc->w.WndOrgX += x;
dc->w.WndOrgY += y;
return pt.x | (pt.y << 16); return pt.x | (pt.y << 16);
} }
@ -346,8 +426,25 @@ DWORD ScaleViewportExt( HDC hdc, short xNum, short xDenom,
short yNum, short yDenom ) short yNum, short yDenom )
{ {
SIZE size; SIZE size;
if (!ScaleViewportExtEx( hdc, xNum, xDenom, yNum, yDenom, &size )) DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
MF_MetaParam4(dc, META_SCALEVIEWPORTEXT, xNum, xDenom, yNum, yDenom);
return 0; return 0;
}
size.cx = dc->w.VportExtX;
size.cy = dc->w.VportExtY;
if ((dc->w.MapMode != MM_ISOTROPIC) && (dc->w.MapMode != MM_ANISOTROPIC))
return size.cx | (size.cy << 16);
if (!xNum || !xDenom || !xNum || !yDenom) return 0;
dc->w.VportExtX = (dc->w.VportExtX * xNum) / xDenom;
dc->w.VportExtY = (dc->w.VportExtY * yNum) / yDenom;
if (dc->w.VportExtX == 0) dc->w.VportExtX = 1;
if (dc->w.VportExtY == 0) dc->w.VportExtY = 1;
if (dc->w.MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
return size.cx | (size.cy << 16); return size.cx | (size.cy << 16);
} }
@ -384,8 +481,25 @@ DWORD ScaleWindowExt( HDC hdc, short xNum, short xDenom,
short yNum, short yDenom ) short yNum, short yDenom )
{ {
SIZE size; SIZE size;
if (!ScaleWindowExtEx( hdc, xNum, xDenom, yNum, yDenom, &size )) DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return FALSE;
MF_MetaParam4(dc, META_SCALEWINDOWEXT, xNum, xDenom, yNum, yDenom);
return 0; return 0;
}
size.cx = dc->w.WndExtX;
size.cy = dc->w.WndExtY;
if ((dc->w.MapMode != MM_ISOTROPIC) && (dc->w.MapMode != MM_ANISOTROPIC))
return size.cx | (size.cy << 16);
if (!xNum || !xDenom || !xNum || !yDenom) return FALSE;
dc->w.WndExtX = (dc->w.WndExtX * xNum) / xDenom;
dc->w.WndExtY = (dc->w.WndExtY * yNum) / yDenom;
if (dc->w.WndExtX == 0) dc->w.WndExtX = 1;
if (dc->w.WndExtY == 0) dc->w.WndExtY = 1;
if (dc->w.MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
return size.cx | (size.cy << 16); return size.cx | (size.cy << 16);
} }

View File

@ -10,6 +10,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "options.h"
#include "class.h" #include "class.h"
#include "win.h" #include "win.h"
#include "user.h" #include "user.h"
@ -370,12 +371,23 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
/* Only select focus events on top-level override-redirect windows */ /* Only select focus events on top-level override-redirect windows */
if (win_attr.override_redirect) win_attr.event_mask |= FocusChangeMask; if (win_attr.override_redirect) win_attr.event_mask |= FocusChangeMask;
} }
if (Options.nobackingstore)
win_attr.backing_store = NotUseful;
else
win_attr.backing_store = Always;
if (Options.nosaveunders)
win_attr.save_under = FALSE;
else
win_attr.save_under = TRUE;
wndPtr->window = XCreateWindow( display, parentPtr->window, wndPtr->window = XCreateWindow( display, parentPtr->window,
x + parentPtr->rectClient.left - parentPtr->rectWindow.left, x + parentPtr->rectClient.left - parentPtr->rectWindow.left,
y + parentPtr->rectClient.top - parentPtr->rectWindow.top, y + parentPtr->rectClient.top - parentPtr->rectWindow.top,
width, height, 0, width, height, 0,
CopyFromParent, InputOutput, CopyFromParent, CopyFromParent, InputOutput, CopyFromParent,
CWEventMask | CWOverrideRedirect | CWColormap, &win_attr ); CWEventMask | CWOverrideRedirect | CWColormap |
CWSaveUnder | CWBackingStore, &win_attr );
XStoreName( display, wndPtr->window, windowName ); XStoreName( display, wndPtr->window, windowName );
/* Send the WM_CREATE message */ /* Send the WM_CREATE message */