Release 951105
Fri Nov 3 20:08:17 1995 Alexandre Julliard <julliard@sunsite.unc.edu>
* [configure.in]
Attempt to check for -li386 on NetBSD. Please test this.
Mon Oct 30 12:40:32 EST 1995 Jim Peterson <jspeter@birch.ee.vt.edu>
* [*/*]
Eliminated various warnings with either explicit casts or more
accurate variable/parameter declarations (e.g. INT instead of short
or WORD).
Changed macros 'min' and 'max' to 'MIN' and 'MAX', since they're
macros.
* [controls/edit.c] [windows/defdlg.c]
Added '#ifdef SUPERFLUOUS_FUNCTIONS' wrappers around function
definition of EDIT_KeyVScrollDoc, EDIT_TextLineNumber, and
DEFDLG_FindDefButton to avoid warnings.
* [controls/button.c] [controls/scroll.c] [windows/defwnd.c]
[windows/message.c] [windows/nonclient.c]
Converted MAKEPOINT macro call to manual conversion.
* [include/windows.h]
For WINELIB32, structures POINT, SIZE, and RECT have LONG members
instead of INT. This also invalidates the macro MAKEPOINT(), which
is not supported in Win32. Also defined the POINTS structure (SHORT
members) and the MAKEPOINTS macro.
* [misc/commdlg.c]
Changed a lot of 'strcpy' calls to 'strncpy' calls. I'm desperate to
find this memory bug, and this should be done anyway.
* [controls/edit.c]
Well, the alteration mentioned above didn't do it, but #ifdef'ing out
a few lines in EDIT_ClearText did. This leads to bugs, but for now,
it's better than bizzare memory troubles.
* [toolkit/miscstubs.c]
Removed warning messages in GLOBAL_CreateBlock(), GLOBAL_FreeBlock(),
and RELAY32_GetEntryPoint(). These are the most popular warnings, and
their current implementation seems fine.
Sat Oct 28 09:39:18 1995 Jochen Karrer <cip307@wpax01.Physik.Uni-Wuerzburg.DE>
* [objects/cursoricon.c]
Fix for "broken" X servers that invert masked cursor colors.
Fri Oct 27 19:27:21 1995 Alex Korobka <alex@phm6.pharm.sunysb.edu>
* [windows/dialog.c] [windows/nonclient.c]
Remove unnecessary items from the system menu.
Thu Oct 26 05:03:03 MET 1995 Philippe De Muyter <phdm@info.ucl.ac.be>
* [objects/color.c] [objects/palette.c]
Make GetNearestColor return a RGB value instead of a pixel value.
Wed Oct 25 23:33:39 1995 Martin von Loewis <loewis@informatik.hu-berlin.de>
* [controls/desktop.c][controls/menu.c][include/menu.h]
Changed WORD parameters to UINT parameters.
* [include/wintypes.h]
Made UINT 32bit for WINELIB.
* [loader/main.c]
Disabled RELAY32_Init and MODULE_Init for WINELIB.
* [misc/main.c]
Assume CPU386 for WINELIB.
* [rc/winerc]
add_popup: set MF_POPUP flag on menu item.
* [toolkit/Makefile.in][toolkit/hello3.c][toolkit/hello3res.c]
Add resource demo hello3 for WINELIB.
New file README.resources.
* [toolkit/miscstubs.c]
Add a case for 17.
Tue Oct 17 15:13:10 IST 1995 Itai Nahshon <nahshon@vnet.ibm.com>
* [loader/module.c]
Do not append .exe if the file name already has an extension.
* [misc/profile.c]
Avoid creating a file with a junk name if a .ini file does not
exist.
* [if1632/gdi.spec] [if1632/user.spec] [if1632/dummy.c]
Added a lot of dummy stubs for Windows Hebrew version.
Tue Oct 17 01:03:24 1995 William Magro <wmagro@tc.cornell.edu>
* [controls/button.c]
Fix for buttons with no label.
* [controls/combo.c][controls/listbox.c]
Fixes for scrollbar positioning. Now disappears correctly
for short lists.
* [controls/edit.c]
Handle memory allocation differently when building as library.
* [controls/static]
Don't destroy old icon before drawing new icon. (Fixes landscape/
portrait toggle icon in print dialog.)
* [if1632/gdi.spec]
New functions SetMetaFileBits and GetMetaFileBits
* [include/sysmetrics.h] [windows/sysmetrics.c]
Add support for GetSystemMetrics(SM_CMETRICS) == SM_CMETRICS
* [include/windows.h]
META_EXTTEXTOUT, not META_SETTEXTOUT
define GetCurrentTime as GetTickCount (for wine library)
* [loader/main.c]
Don't initialize built-in modules in wine library
* [memory/local.c]
LocalReAlloc was defined incorrectly. Swap flags and size arguments.
* [misc/main.c]
Always report CPUTYPE=4 to wine library.
* [objects/dib.c]
RLE8 images were missing top line when decompressed.
* [objects/metafile.c]
SetMetaFileBits and GetMetaFileBits implemented. Works when called
from winhelp. More testing needed. Various memory leaks plugged.
Various other bug fixes. New metafile operations added in
PlayMetaFileRecord: CreatePalette, SetTextAlign, SelectPalette,
SetMapperFlags, RealizePalette, ExtTextOut, Escape. Testing needed.
* [toolkit/heap.c]
LocalUnLock changed to LocalUnlock
Sun Oct 15 21:55:33 1995 Anand Kumria <akumria@ozemail.com.au>
* [misc/winsock.c]
Return the correct error number, for host lookup operations.
Also, correct the problem with send_message.
Fri Oct 13 19:04:35 1995 Morten Welinder <terra@diku.dk>
* [Makefile.in]
Using nm's built-in sorting.
* [*/*.c]
Use xmalloc for malloc and xrealloc for realloc in all ungarded
cases.
* [debugger/dbg.y]
Handle C-like expressions. Clean-up.
* [debugger/debug.l]
Lots of new tokens for expressions.
* [debugger/info.c]
Implement "list" command for disassembling.
* [misc/ole2nls.c]
Implement more Danish stuff.
Fri Oct 6 10:39:39 1995 Ram'on Garc'ia <ramon@ie3.clubs.etsit.upm.es>
* [loader/module.c]
Updated self-loading modules to support for new 32 bit
stack frames.
diff --git a/toolkit/Makefile.in b/toolkit/Makefile.in
index 73f8746..55745dd 100644
--- a/toolkit/Makefile.in
+++ b/toolkit/Makefile.in
@@ -19,9 +19,21 @@
hello2: hello2.o ../winelib.a
gcc -g -o hello2 hello2.o ../winelib.a -lm $(X_LIBS) -lXpm $(XLIB)
+hello3: hello3res.o hello3.o
+ gcc -g -o hello3 hello3.o hello3res.o ../winelib.a -lm $(X_LIBS) -lXpm $(XLIB)
+
+hello3.o: hello3res.o
+
+hello3res.o: hello3res.rc
+ echo "#include \"windows.h\"" >hello3res.rct
+ echo WINDOWS_H_ENDS_HERE >>hello3res.rct
+ cat hello3res.rc >>hello3res.rct
+ $(CC) $(ALLCFLAGS) -E -x c -P hello3res.rct | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | ../rc/winerc -o hello3res -v -p hello3
+ gcc -c hello3res.c
+
@MAKE_RULES@
clean::
- $(RM) hello hello2
+ $(RM) hello hello2 hello3
### Dependencies:
diff --git a/toolkit/README.resources b/toolkit/README.resources
new file mode 100644
index 0000000..2ceb5a7
--- /dev/null
+++ b/toolkit/README.resources
@@ -0,0 +1,91 @@
+This is a short discussion of resources in WineLib.
+
+Introduction
+Resources are used to store dialogs, menus, bitmaps, icons,
+version information, strings, fonts, and accelerators.
+In a Win3.1 programming environment, there are three file formats for
+resources:
+- the RC script, which is human-readable and can be processed by a resource
+compiler
+- the .RES file, which is the output of the resource compiler
+- the .EXE and .DLL files, which store resources as a part of the NE
+file format
+For WineLib, only a part of this is supported. In particular, there is no
+.RES file, the executable is not a NE file (as it is a native Unix executable),
+and some resource types are not implemented: icons, version information,
+strings, and fonts.
+
+Building a WineLib application
+The build process assumes that the C source files and the resource script
+is available. At the moment, a single resource script is recommended.
+This script is processed by winerc:
+1) the preprocessor is used to resolve symbolic style name (LBS_STANDARD, ...)
+into numbers. This involves processing windows.h
+2) the unused parts of windows.h (type definitions) are removed. This would
+not be necessary if Wine's windows.h would use the RC_INVOKED macro.
+3) winerc is invoked to create a binary representation of the resources.
+This representation is stored as C source code (arrays).
+4) gcc is used to compile the generated C code.
+Now, each resource is available as a C array to the application. As the
+executable is not in the NE format, it is not possible to retrieve resource
+locations in the executable via name. Instead, the resources have to be
+referenced with their generated C array names. The linker then resolves
+these names in the compiled resource file.
+5) The program sources are compiled and linked with the output of step 4.
+A sample build process is in toolkit/Makefile:hello3.
+
+Required changes to the program sources
+Because loading the resources from an instance handle is not possible,
+the *Indirect functions have to be used to load a resource. The C arrays
+can be directly passed to the *Indirect functions. So, instead of writing
+
+ hMenu=LoadMenu(hInstance,"MAIN");
+
+write
+
+ hMenu=LoadMenuIndirect(hello3_MENU_MAIN.bytes);
+
+Fortunately, the Windows API has the following functions available:
+DialogBoxIndirect
+CreateDialogIndirect
+DialogBoxIndirectParam
+CreateDialogIndirectParam
+
+LoadMenuIndirect
+SetDIBitsToDevice
+
+Sample code is available in hello3.c. hello3res.c contains the corresponding
+resources.
+
+Keeping a common source
+Clearly, changing the sources is not very desirable, and suggestions how
+to reduce the amount of work are welcome. In the meantime, two approaches
+allow at least to remain a common source between the Win3.1 code and the
+WineLib code:
+1) conditional compiles:
+When compiling a WineLib application, WINELIB is defined. This can be used
+to select Wine-specific code.
+2) usage of winerc for Windows: The *Indirect functions are available on
+plain Win3.1, and the resource format is fully compatible. Thus, recompiling
+sources modified for WineLib on Win3.1 is possible and known to work.
+
+Open problems
+1) Icons and cursors: For these resources, there is no *Indirect function
+documented. In addition, both are implemented by a set of two resources.
+This is the reason why they are not supported by winerc.
+2) Accelerators: Although winerc supports accelerators, there is no
+LoadAcceleratorIndirect function. A work-around would be to define one.
+3) Fonts: Font resources are not supported by Wine at all.
+4) String tables: Although string tables are not supported by winerc, there
+is no reason not to add such support. Again, some indirect loading would
+be necessary.
+5) API requires loading by name: At some places, the name of a resource
+is passed instead of a handle. The WNDCLASS structure contains the name
+of a menu resource, and the icon in a dialog box is referenced by its name.
+(Are there some more places?)
+Clearly, loading the resource by name would be highly desirable. The
+resource compiler currently creates a structure containing all resources
+defined in an RC file. However, it is not clear how WINELIB could find the
+location of this structure, especially, when there is more than one RC file.
+
+
diff --git a/toolkit/atom.c b/toolkit/atom.c
index 26ae445..48fbfbe 100644
--- a/toolkit/atom.c
+++ b/toolkit/atom.c
@@ -10,6 +10,7 @@
#include <ctype.h>
#include "windows.h"
+#include "xmalloc.h"
#ifdef CONFIG_IPC
#include "dde_atom.h"
@@ -90,7 +91,7 @@
}
if(!FirstUnused)
{
- *tableptr = malloc(sizeof(ATOMtoHANDLEtable));
+ *tableptr = xmalloc(sizeof(ATOMtoHANDLEtable));
(*tableptr)->next = NULL;
for(i=0; i<16; i++)
{
diff --git a/toolkit/heap.c b/toolkit/heap.c
index 370f7c6..75faefc 100644
--- a/toolkit/heap.c
+++ b/toolkit/heap.c
@@ -8,9 +8,11 @@
/* #ifndef __STDC__ */
#include <malloc.h>
+#include <stdio.h>
#include <string.h>
/* #endif */
#include "windows.h"
+#include "xmalloc.h"
#ifdef WINELIB16
@@ -39,7 +41,7 @@
}
/* No free slots */
- last->next = malloc (sizeof (handle_table_t));
+ last->next = xmalloc (sizeof (handle_table_t));
table = last->next;
memset (table, 0, sizeof (handle_table_t));
i = 0;
@@ -131,7 +133,7 @@
{
void **m = HEAP_FindSlot (hMem);
- realloc (*m, bytes);
+ xrealloc (*m, bytes);
}
WORD LocalSize (HANDLE hMem)
@@ -140,7 +142,7 @@
}
-BOOL LocalUnLock (HANDLE hMem)
+BOOL LocalUnlock (HANDLE hMem)
{
return 0;
}
@@ -162,7 +164,7 @@
BOOL GlobalUnlock (HANDLE hMem)
{
- return LocalUnLock (hMem);
+ return LocalUnlock (hMem);
}
WORD GlobalFlags (HANDLE hMem)
@@ -208,9 +210,47 @@
#endif
#else /* WINELIB16 */
+
+#ifdef DEBUG_HEAP
+static void* LastTwenty[20]={ 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0 };
+
+void CheckMem(void* f)
+{
+ int i;
+
+ for(i=0; i<20; i++)
+ {
+ if(LastTwenty[i]==f)
+ LastTwenty[i]=NULL;
+ else if(LastTwenty[i])
+ if( *((int*)LastTwenty[i]) != 0x12345678 ||
+ *(((int*)LastTwenty[i])+1) != 0x0fedcba9 )
+ fprintf(stderr,"memory corrupted at %p\n",LastTwenty[i]);
+ }
+ fflush(stderr);
+}
+
+void NewMem(void* n)
+{
+ int i;
+ for(i=0; i<20; i++)
+ if(!LastTwenty[i])
+ {
+ LastTwenty[i]=n;
+ return;
+ }
+ for(i=0; i<20; i++)
+ LastTwenty[i]=LastTwenty[i+1];
+ LastTwenty[4]=n;
+}
+#endif
+
HANDLE LocalAlloc (WORD flags, WORD bytes)
{
HANDLE m;
+#ifdef DEBUG_HEAP
+ bytes+=2*sizeof(int);
+#endif
if (flags & LMEM_WINE_ALIGN)
m = memalign (4, bytes);
@@ -220,6 +260,14 @@
if (flags & LMEM_ZEROINIT)
bzero (m, bytes);
}
+#ifdef DEBUG_HEAP
+ CheckMem(NULL);
+ *((int*) m)=0x12345678;
+ *(((int*) m)+1)=0x0fedcba9;
+ fprintf(stderr,"%p malloc'd\n",m); fflush(stderr);
+ NewMem(m);
+ return (HANDLE) (((int*)m)+2);
+#endif
return m;
}
@@ -235,7 +283,24 @@
HANDLE LocalFree (HANDLE hMem)
{
+#ifdef DEBUG_HEAP
+ hMem=(HANDLE) (((int*)hMem)-2);
+ CheckMem(hMem);
+ fprintf(stderr,"%p free-ing...",hMem);
+ if( *((int*)hMem) != 0x12345678 ||
+ *(((int*)hMem)+1) != 0x0fedcba9 )
+ fprintf(stderr,"memory corrupted...");
+ else
+ {
+ *((int*)hMem) = 0x9abcdef0;
+ *(((int*)hMem)+1) = 0x87654321;
+ }
+ fflush(stderr);
+#endif
free(hMem);
+#ifdef DEBUG_HEAP
+ fprintf(stderr,"free'd\n"); fflush(stderr);
+#endif
return 0;
}
@@ -251,8 +316,11 @@
HANDLE LocalReAlloc (HANDLE hMem, WORD flags, WORD bytes)
{
- realloc(hMem, bytes);
- return hMem;
+#ifdef DEBUG_HEAP
+ LocalFree(hMem);
+ return LocalAlloc(flags,bytes);
+#endif
+ return realloc(hMem, bytes);
}
WORD LocalSize (HANDLE hMem)
@@ -262,7 +330,7 @@
}
-BOOL LocalUnLock (HANDLE hMem)
+BOOL LocalUnlock (HANDLE hMem)
{
return 0;
}
@@ -284,7 +352,7 @@
BOOL GlobalUnlock (HANDLE hMem)
{
- return LocalUnLock (hMem);
+ return LocalUnlock (hMem);
}
WORD GlobalFlags (HANDLE hMem)
diff --git a/toolkit/hello3.c b/toolkit/hello3.c
new file mode 100644
index 0000000..c688cec
--- /dev/null
+++ b/toolkit/hello3.c
@@ -0,0 +1,85 @@
+#include <windows.h>
+#include "hello3res.h"
+
+BOOL CALLBACK DlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
+{
+ switch(msg)
+ {
+ case WM_INITDIALOG:
+ return 1;
+ case WM_COMMAND:
+ if(wParam==100)
+ DestroyWindow(hWnd);
+ return 0;
+ }
+ return 0;
+}
+
+LRESULT WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l)
+{
+ switch (msg){
+
+ case WM_COMMAND:
+ switch(w){
+ case 100:
+ CreateDialogIndirect(0,hello3_DIALOG_DIADEMO.bytes,wnd,(WNDPROC)DlgProc);
+ return 0;
+ case 101:
+ {
+ BITMAPINFO *bm=hello3_BITMAP_BITDEMO.bytes;
+ char *bits=bm;
+ HDC hdc=GetDC(wnd);
+ bits+=bm->bmiHeader.biSize;
+ bits+=(1<<bm->bmiHeader.biBitCount)*sizeof(RGBQUAD);
+ SetDIBitsToDevice(hdc,0,0,bm->bmiHeader.biWidth,
+ bm->bmiHeader.biHeight,0,0,0,bm->bmiHeader.biHeight,
+ bits,bm,DIB_RGB_COLORS);
+ ReleaseDC(wnd,hdc);
+ return 0;
+ }
+ default:
+ return DefWindowProc (wnd, msg, w, l);
+ }
+ case WM_DESTROY:
+ PostQuitMessage (0);
+ break;
+
+ default:
+ return DefWindowProc (wnd, msg, w, l);
+ }
+ return 0l;
+}
+
+int PASCAL WinMain (HANDLE inst, HANDLE prev, LPSTR cmdline, int show)
+{
+ HWND wnd;
+ MSG msg;
+ WNDCLASS class;
+
+ if (!prev){
+ class.style = CS_HREDRAW | CS_VREDRAW;
+ class.lpfnWndProc = WndProc;
+ class.cbClsExtra = 0;
+ class.cbWndExtra = 0;
+ class.hInstance = inst;
+ class.hIcon = LoadIcon (0, IDI_APPLICATION);
+ class.hCursor = LoadCursor (0, IDC_ARROW);
+ class.hbrBackground = GetStockObject (WHITE_BRUSH);
+ class.lpszMenuName = 0;
+ class.lpszClassName = (SEGPTR)"class";
+ }
+ if (!RegisterClass (&class))
+ return FALSE;
+
+ wnd = CreateWindow ("class", "Test app", WS_OVERLAPPEDWINDOW,
+ CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
+ LoadMenuIndirect(hello3_MENU_MAIN.bytes), inst, 0);
+ ShowWindow (wnd, show);
+ UpdateWindow (wnd);
+
+ while (GetMessage (&msg, 0, 0, 0)){
+ TranslateMessage (&msg);
+ DispatchMessage (&msg);
+ }
+ return 0;
+}
diff --git a/toolkit/hello3res.rc b/toolkit/hello3res.rc
new file mode 100644
index 0000000..23f29c5
--- /dev/null
+++ b/toolkit/hello3res.rc
@@ -0,0 +1,32 @@
+MAIN MENU
+{
+ POPUP "Menu demo" {
+ MENUITEM "Dialog Demo", 100
+ MENUITEM "Bitmap Demo", 101
+ }
+}
+
+DIADEMO DIALOG 20, 20, 179, 118
+STYLE DS_MODALFRAME | WS_CAPTION | WS_POPUP | WS_VISIBLE | WS_SYSMENU
+CAPTION "Dialog demo"
+FONT 8, "Helv"
+BEGIN
+ CONTROL "Pushbutton", 100, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 14, 92, 52, 13
+ CONTROL "Checkbox", 101, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 19, 76, 47, 12
+ CONTROL "Static text", 102, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 17, 60, 39, 10
+#if 0
+ /* Edit controls don't work, yet */
+ CONTROL "Edit control", 103, "EDIT", ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 18, 41, 44, 13
+#endif
+ CONTROL "Radio button", 104, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 17, 23, 58, 12
+ CONTROL "Checkbox", 101, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 19, 76, 47, 12
+#if 0
+ CONTROL "", 106, "COMBOBOX", CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 86, 23, 86, 85
+#else
+ CONTROL "", 106, "LISTBOX", LBS_STANDARD | LBS_DISABLENOSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 86, 23, 86, 85
+#endif
+END
+
+
+BITDEMO BITMAP "../rc/winelogo.bmp"
+
diff --git a/toolkit/miscstubs.c b/toolkit/miscstubs.c
index 5db9016..ddeeb49 100644
--- a/toolkit/miscstubs.c
+++ b/toolkit/miscstubs.c
@@ -11,6 +11,7 @@
#include "windows.h"
#include "global.h"
#include "debug.h"
+#include "xmalloc.h"
int CallTo32_LargeStack( int (*func)(), int nbargs, ...)
{
@@ -32,6 +33,8 @@
a[7],a[8],a[9],a[10]);
case 14: return func(a[0],a[1],a[2],a[3],a[4],a[5],a[6],
a[7],a[8],a[9],a[10],a[11],a[12],a[13]);
+ case 17: return func(a[0],a[1],a[2],a[3],a[4],a[5],a[6],
+ a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15],a[16]);
default: fprintf(stderr,"JBP: CallTo32_LargeStack called with unsupported "
"number of arguments (%d). Ignored.\n",nbargs);
return 0;
@@ -40,25 +43,6 @@
WORD CallTo16_word_ ( FARPROC func, WORD arg ) { return func(arg); }
-/* typedef void* ATOM; */
-/* ATOM GlobalAddAtom(char *n) */
-/* { */
-/* return strdup(n); */
-/* } */
-/* GlobalDeleteAtom(ATOM n) */
-/* { */
-/* free(n); */
-/* } */
-/* GlobalFindAtom(char*n) */
-/* { */
-/* fprintf(stderr,"JBP: GlobalFindAtom() ignored.\n"); */
-/* return 0; */
-/* } */
-/* char *GlobalGetAtomName(ATOM a) */
-/* { */
-/* return a; */
-/* } */
-
void GlobalFreeAll(HANDLE owner)
{
fprintf(stderr,"JBP: GlobalFreeAll() ignored.\n");
@@ -70,123 +54,36 @@
}
-
-#if 0
-typedef WORD* HLOCAL;
-
-int IsValidHLOCAL(HLOCAL handle)
-{
- return *(handle-1) + *(handle-2) == 0; /* Valid HLOCAL's sum to 0 */
-}
-
-/***********************************************************************
- * LOCAL_Free
- *
- */
HLOCAL LOCAL_Free( WORD ds, HLOCAL handle )
{
- if (!IsValidHLOCAL(handle)) return handle; /* couldn't free it */
- free(handle-2);
- return 0;
-}
-
-
-/***********************************************************************
- * LOCAL_Alloc
- *
- */
-HLOCAL LOCAL_Alloc( WORD ds, WORD flags, WORD size )
-{
- HLOCAL handle;
-
- handle = malloc(size + 2*sizeof(WORD));
- handle += 2;
- *(handle-2) = size;
- *(handle-1) = -size;
- return handle;
-}
-
-
-/***********************************************************************
- * LOCAL_ReAlloc
- *
- */
-HLOCAL LOCAL_ReAlloc( WORD ds, HLOCAL handle, WORD size, WORD flags )
-{
- HLOCAL newhandle;
-
- if(!IsValidHLOCAL(handle))return 0;
- newhandle = realloc(handle-2, size+2*sizeof(WORD));
- newhandle += 2;
- *(newhandle-2) = size;
- *(newhandle-1) = -size;
- return newhandle;
-}
-
-
-/***********************************************************************
- * LOCAL_Lock
- */
-WORD LOCAL_Lock( WORD ds, HLOCAL handle )
-{
- if(!IsValidHLOCAL(handle))return 0;
- return handle;
-}
-
-
-/***********************************************************************
- * LOCAL_Unlock
- */
-BOOL LOCAL_Unlock( WORD ds, HLOCAL handle )
-{
- return TRUE;
-}
-
-
-/***********************************************************************
- * LOCAL_Size
- *
- */
-WORD LOCAL_Size( WORD ds, HLOCAL handle )
-{
- return *(handle-2);
-}
-#endif
-
-HLOCAL LOCAL_Free( WORD ds, HLOCAL handle )
-{
- fprintf(stderr,"JBP: LOCAL_*() ignored.\n");
- return 0;
+ return LocalFree(handle);
}
HLOCAL LOCAL_Alloc( WORD ds, WORD flags, WORD size )
{
- fprintf(stderr,"JBP: LOCAL_*() ignored.\n");
- return 0;
+ return LocalAlloc(flags,size);
}
HLOCAL LOCAL_ReAlloc( WORD ds, HLOCAL handle, WORD size, WORD flags )
{
- fprintf(stderr,"JBP: LOCAL_*() ignored.\n");
- return 0;
+ return LocalReAlloc(handle,size,flags);
}
-WORD LOCAL_Lock( WORD ds, HLOCAL handle )
+NPVOID LOCAL_Lock( WORD ds, HLOCAL handle )
{
- fprintf(stderr,"JBP: LOCAL_*() ignored.\n");
- return 0;
+ return LocalLock(handle);
}
BOOL LOCAL_Unlock( WORD ds, HLOCAL handle )
{
- fprintf(stderr,"JBP: LOCAL_*() ignored.\n");
- return 1;
+ fprintf(stderr,"JBP: LOCAL_Unlock() ignored.\n");
+ return 1;
}
WORD LOCAL_Size( WORD ds, HLOCAL handle )
{
- fprintf(stderr,"JBP: LOCAL_*() ignored.\n");
- return 0;
+ fprintf(stderr,"JBP: LOCAL_Size() ignored.\n");
+ return 0;
}
void FarSetOwner(HANDLE a, WORD b)
@@ -240,17 +137,17 @@
BOOL is32Bit, BOOL isReadOnly,
SHMDATA *shmdata)
{
- fprintf(stderr,"JBP: GLOBAL_CreateBlock() faked.\n");
+/* fprintf(stderr,"JBP: GLOBAL_CreateBlock() faked.\n");*/
return ptr;
}
BOOL GLOBAL_FreeBlock( HGLOBAL handle )
{
- fprintf(stderr,"JBP: GLOBAL_FreeBlock() ignored.\n");
+/* fprintf(stderr,"JBP: GLOBAL_FreeBlock() ignored.\n");*/
return 1;
}
-DWORD GlobalHandle(WORD a)
+HGLOBAL GlobalHandle(LPCVOID a)
{
fprintf(stderr,"JBP: GlobalHandle() ignored.\n");
return 0;
@@ -258,7 +155,7 @@
void *RELAY32_GetEntryPoint(char *dll_name, char *item, int hint)
{
- fprintf(stderr,"JBP: RELAY32_GetEntryPoint() ignored.\n");
+/* fprintf(stderr,"JBP: RELAY32_GetEntryPoint() ignored.\n");*/
return NULL;
}
diff --git a/toolkit/winmain.c b/toolkit/winmain.c
index 1982f6b..f132725 100644
--- a/toolkit/winmain.c
+++ b/toolkit/winmain.c
@@ -11,10 +11,13 @@
extern void TASK_Reschedule(void);
extern int USER_InitApp(HINSTANCE);
+char* progname=NULL;
+
int _WinMain (int argc, char *argv [])
{
HINSTANCE hInstance;
+ progname=*argv;
if(!MAIN_Init()) return 0; /* JBP: Needed for DosDrives[] structure, etc. */
hInstance = WinExec( *argv, SW_SHOWNORMAL );
TASK_Reschedule();