Commit 066d1e09 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 0.0.3

WHAT'S NEW with version 0.0.3: - Fixed bug with sector sizes. - Registers at program startup are now set correctly. - Segment fixups for relocatable-segment internal entry points. - Fixed bug in DOS PSP structure. - Some resource loading is done. - Added "return" ordinal type to build program. - Added comment capability to build program.
parent 2c25c3e9
CFLAGS=-g
CFLAGS=-g -DDEBUG_RESOURCE
######################################################################
# FILES:
......@@ -11,12 +11,15 @@ CFLAGS=-g
DLL_LENGTH=256
BUILDOBJS=dll_kernel.o dll_user.o dll_gdi.o dll_unixlib.o \
dll_kernel_tab.o dll_user_tab.o dll_gdi_tab.o dll_unixlib_tab.o
dll_win87em.o dll_shell.o \
dll_kernel_tab.o dll_user_tab.o dll_gdi_tab.o dll_unixlib_tab.o \
dll_win87em_tab.o dll_shell_tab.o
MUST_BE_LINKED_FIRST=if1632.o $(BUILDOBJS)
OBJS=$(MUST_BE_LINKED_FIRST) \
dump.o heap.o ldt.o kernel.o relay.o selector.o user.o wine.o
dump.o heap.o ldt.o kernel.o relay.o resource.o \
selector.o user.o wine.o
TARGET=wine
LIBS=-lldt
......@@ -47,3 +50,9 @@ dll_gdi.S dll_gdi_tab.c: build gdi.spec
dll_unixlib.S dll_unixlib_tab.c: build unixlib.spec
build unixlib.spec
dll_win87em.S dll_win87em_tab.c: build win87em.spec
build win87em.spec
dll_shell.S dll_shell_tab.c: build shell.spec
build shell.spec
......@@ -2,9 +2,19 @@ Copyright Robert J. Amstadt, 1993. All code is provided without
warranty. It is my intent to cover this code with the Gnu Public
License.
So here goes release 0.0.2 of the Windows loader. It will do some
relocations and then run the program. The program test.exe is a
Windows executable. Try the command "wine test.exe".
So here goes release 0.0.3 of the Windows loader. It will do some
relocations and then run the program. I have successfully loaded
the Windows solitaire game. Try it. It currently stops a call to
GetObject().
WHAT'S NEW with version 0.0.3:
- Fixed bug with sector sizes.
- Registers at program startup are now set correctly.
- Segment fixups for relocatable-segment internal entry points.
- Fixed bug in DOS PSP structure.
- Some resource loading is done.
- Added "return" ordinal type to build program.
- Added comment capability to build program.
WHAT'S NEW with version 0.0.2:
......@@ -34,10 +44,12 @@ TODO:
- Make changes to the kernel to allow more than 32 LDT entries.
- Trap and handle DOS and DPMI calls.
- Windows emulation library (connect to Peter MacDonald's library).
- Set registers correctly when starting Windows program.
- Allowing loading of 16-bit DLLs for use with program.
- global memory allocation
- complete and improve local heap allocation
- global memory allocation.
- complete and improve local heap allocation.
- Handle self-loading applications.
- Deal with callback functions.
- Resource loading
INSTALLATION:
......
File deleted
......@@ -8,12 +8,18 @@ ORDINAL FUNCTYPE EXPORTNAME([ARGTYPE [ARGTYPE [...]]])
HANDLERNAME([ARGNUM [ARGNUM [...]]])
ORDINAL equate EXPORTNAME DATA
ORDINAL return EXPORTNAME ARGLENGTH RETVALUE
# COMMENT_TEXT
--------------------
General:
"name", "id" and "length" fields are mandatory. Specific ordinal
declarations are optional, but the default handler will print an
error message.
error message. Lines whose first character is a '#' will be ignored
as comments.
Variable ordinals:
......
/*
* Copyright Robert J. Amstadt, 1993
*/
static char RCSId[] = "$Id: build.c,v 1.2 1993/06/30 14:24:33 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -17,6 +17,7 @@
#define FUNCTYPE_REG 19
#define EQUATETYPE_ABS 18
#define TYPE_RETURN 20
#define MAX_ORDINALS 1024
......@@ -45,6 +46,12 @@ typedef struct ordinal_function_definition_s
int arg_indices_32[16];
} ORDFUNCDEF;
typedef struct ordinal_return_definition_s
{
int arg_size;
int ret_value;
} ORDRETDEF;
ORDDEF OrdinalDefinitions[MAX_ORDINALS];
char LowerDLLName[80];
......@@ -146,16 +153,26 @@ GetToken(void)
ParseBuffer = malloc(512);
ParseNext = ParseBuffer;
Line++;
while (1)
{
if (fgets(ParseBuffer, 511, SpecFp) == NULL)
return NULL;
if (ParseBuffer[0] != '#')
break;
}
}
while ((token = GetTokenInLine()) == NULL)
{
ParseNext = ParseBuffer;
Line++;
while (1)
{
if (fgets(ParseBuffer, 511, SpecFp) == NULL)
return NULL;
if (ParseBuffer[0] != '#')
break;
}
}
return token;
......@@ -388,6 +405,50 @@ ParseEquate(int ordinal)
}
int
ParseReturn(int ordinal)
{
ORDDEF *odp;
ORDRETDEF *rdp;
char *token;
char *endptr;
int value;
if (ordinal >= MAX_ORDINALS)
{
fprintf(stderr, "%d: Ordinal number too large\n", Line);
exit(1);
}
rdp = malloc(sizeof(*rdp));
odp = &OrdinalDefinitions[ordinal];
strcpy(odp->export_name, GetToken());
odp->valid = 1;
odp->type = TYPE_RETURN;
odp->additional_data = rdp;
token = GetToken();
rdp->arg_size = strtol(token, &endptr, 0);
if (endptr == NULL || *endptr != '\0')
{
fprintf(stderr, "%d: Expected number value, got '%s'\n", Line,
token);
exit(1);
}
token = GetToken();
rdp->ret_value = strtol(token, &endptr, 0);
if (endptr == NULL || *endptr != '\0')
{
fprintf(stderr, "%d: Expected number value, got '%s'\n", Line,
token);
exit(1);
}
return 0;
}
int
ParseOrdinal(int ordinal)
{
char *token;
......@@ -415,6 +476,8 @@ ParseOrdinal(int ordinal)
return ParseExportFunction(ordinal, FUNCTYPE_REG);
else if (stricmp(token, "equate") == 0)
return ParseEquate(ordinal);
else if (stricmp(token, "return") == 0)
return ParseReturn(ordinal);
else
{
fprintf(stderr,
......@@ -509,6 +572,7 @@ main(int argc, char **argv)
{
ORDDEF *odp;
ORDFUNCDEF *fdp;
ORDRETDEF *rdp;
FILE *fp;
char filename[80];
char buffer[80];
......@@ -553,6 +617,7 @@ main(int argc, char **argv)
else
{
fdp = odp->additional_data;
rdp = odp->additional_data;
switch (odp->type)
{
......@@ -573,6 +638,18 @@ main(int argc, char **argv)
OutputVariableCode(fp, ".long", odp);
break;
case TYPE_RETURN:
fprintf(fp, "_%s_Ordinal_%d:\n", UpperDLLName, i);
fprintf(fp, "\tmovw\t$%d,%%ax\n", rdp->ret_value & 0xffff);
fprintf(fp, "\tmovw\t$%d,%%dx\n",
(rdp->ret_value >> 16) & 0xffff);
fprintf(fp, "\t.byte\t0x66\n");
if (rdp->arg_size != 0)
fprintf(fp, "\tlret\t$%d\n", rdp->arg_size);
else
fprintf(fp, "\tlret\n");
break;
case FUNCTYPE_REG:
fprintf(fp, "_%s_Ordinal_%d:\n", UpperDLLName, i);
fprintf(fp, "\tpushw\t%%ax\n");
......
/* $Id$
/* $Id: dlls.h,v 1.1 1993/06/29 15:55:18 root Exp $
*/
/*
* Copyright Robert J. Amstadt, 1993
......@@ -52,5 +52,7 @@ extern struct dll_table_entry_s KERNEL_table[];
extern struct dll_table_entry_s USER_table[];
extern struct dll_table_entry_s GDI_table[];
extern struct dll_table_entry_s UNIXLIB_table[];
extern struct dll_table_entry_s WIN87EM_table[];
extern struct dll_table_entry_s SHELL_table[];
#endif /* DLLS_H */
/* $Id$
*/
static char RCSId[] = "$Id: dump.c,v 1.1 1993/06/29 15:55:18 root Exp $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
/*
* Copyright Robert J. Amstadt, 1993
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
......
This diff is collapsed. Click to expand it.
# $Id: gdi.spec,v 1.2 1993/06/30 14:24:33 root Exp root $
#
name gdi
id 3
length 256
length 490
static char RCSId[] = "$Id$";
static char RCSId[] = "$Id: heap.c,v 1.1 1993/06/29 15:55:18 root Exp $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
......@@ -34,7 +34,7 @@ HEAP_LocalAlloc(int flags, int bytes)
MDESC *m, *m_new;
#ifdef HEAP_DEBUG
fprintf(stderr, "LocalAlloc: flags %x, bytes %d, ", flags, bytes);
printf("LocalAlloc: flags %x, bytes %d, ", flags, bytes);
#endif
/*
......@@ -63,7 +63,7 @@ HEAP_LocalAlloc(int flags, int bytes)
m->length -= (m_new->length + sizeof(MDESC));
#ifdef HEAP_DEBUG
fprintf(stderr, "Returning %x\n", (int) (m + 1));
printf("Returning %x\n", (int) (m + 1));
#endif
return (void *) (m + 1);
}
......@@ -80,13 +80,13 @@ HEAP_LocalAlloc(int flags, int bytes)
m->next->prev = m->prev;
#ifdef HEAP_DEBUG
fprintf(stderr, "Returning %x\n", (int) (m + 1));
printf("Returning %x\n", (int) (m + 1));
#endif
return (void *) (m + 1);
}
#ifdef HEAP_DEBUG
fprintf(stderr, "Returning 0\n");
printf("Returning 0\n");
#endif
return 0;
}
......
......@@ -36,7 +36,7 @@ offset:
.text
/**********************************************************************
* int CallTo16(unsigned long csip, unsigned long sssp,
* int CallToInit16(unsigned long csip, unsigned long sssp,
* unsigned short ds)
*
* Stack: 0 ebp
......@@ -48,8 +48,8 @@ offset:
* 16 target ds
*/
.align 4
.globl _CallTo16
_CallTo16:
.globl _CallToInit16
_CallToInit16:
pushl %ebp
movl %esp,%ebp
......@@ -76,13 +76,17 @@ _CallTo16:
movl %ebp,saved_ebp
/*
* Load ds, es, sp, ss & bp
* Load initial registers
*/
movl $0,%eax
movw _WIN_StackSize,%bx
movw _WIN_HeapSize,%cx
movl $0,%esi
xorl %eax,%eax
movw _PSPSelector,%ax
movw %ax,%es
movw 16(%ebp),%ax
movw %ax,%ds
movl %eax,%edi
xorl %eax,%eax
movw 12(%ebp),%ax
movl %eax,%esp
......@@ -257,6 +261,8 @@ _KERNEL_InitTask:
popl saved_16esp
popw %es
/* movw _PSPSelector,%ax
movw %ax,%es */
popw %ds
.align 2,0x90
......@@ -283,12 +289,11 @@ noargs_2:
/*
* Last, we need to load the return values.
*/
movl $0,%esi
movw $1,%ax
movw %gs:_WIN_StackSize,%cx
movw $1,%dx
movw 0x80,%bx
movl $0,%esi
movl $1,%edi
.byte 0x66
lret
1 1 93ce FATALEXIT exported, shared data
2 1 9d6f EXITKERNEL exported
3 3 07c6 GETVERSION exported
4 2 28b7 LOCALINIT exported
5 1 0543 LOCALALLOC exported
6 1 0587 LOCALREALLOC exported
7 1 055f LOCALFREE exported
8 1 0573 LOCALLOCK exported
9 1 05bd LOCALUNLOCK exported
10 1 05a9 LOCALSIZE exported
11 1 8d6a LOCALHANDLE exported
12 1 05d1 LOCALFLAGS exported
13 1 8d85 LOCALCOMPACT exported
14 2 0278 LOCALNOTIFY exported
15 1 022b GLOBALALLOC exported
16 1 028c GLOBALREALLOC exported
17 1 0247 GLOBALFREE exported
18 1 0278 GLOBALLOCK exported
19 1 02cb GLOBALUNLOCK exported
20 1 02b7 GLOBALSIZE exported
21 1 0264 GLOBALHANDLE exported
22 1 02e8 GLOBALFLAGS exported
23 1 03b3 LOCKSEGMENT exported
24 1 03c7 UNLOCKSEGMENT exported
25 1 1105 GLOBALCOMPACT exported
26 1 0e39 GLOBALFREEALL exported
28 1 1190 GLOBALMASTERHANDLE exported
29 1 7d21 YIELD exported
30 1 7ca8 WAITEVENT exported
31 1 7d92 POSTEVENT exported
32 1 7df0 SETPRIORITY exported
33 1 81e5 LOCKCURRENTTASK exported
34 1 7de3 SETTASKQUEUE exported
35 1 7d9d GETTASKQUEUE exported
36 1 842c GETCURRENTTASK exported
37 3 024e GETCURRENTPDB exported
38 1 7dc5 SETTASKSIGNALPROC exported
41 1 9c8e ENABLEDOS exported
42 1 9c8f DISABLEDOS exported
45 2 0244 LOADMODULE exported
46 2 0176 FREEMODULE exported
47 2 01bb GETMODULEHANDLE exported
48 2 01d2 GETMODULEUSAGE exported
49 2 01e6 GETMODULEFILENAME exported
50 2 019e GETPROCADDRESS exported
51 3 00a8 MAKEPROCINSTANCE exported
52 3 00c5 FREEPROCINSTANCE exported
53 1 4927 CALLPROCINSTANCE exported
54 2 0219 GETINSTANCEDATA exported
55 3 08ee CATCH exported
56 3 0928 THROW exported
57 1 0663 GETPROFILEINT exported, shared data
58 1 0689 GETPROFILESTRING exported, shared data
59 1 0763 WRITEPROFILESTRING exported, shared data
60 3 0008 FINDRESOURCE exported
61 1 0126 LOADRESOURCE exported
62 1 018b LOCKRESOURCE exported
63 1 0177 FREERESOURCE exported
64 1 0140 ACCESSRESOURCE exported
65 1 019f SIZEOFRESOURCE exported
66 1 015d ALLOCRESOURCE exported
67 3 002e SETRESOURCEHANDLER exported
68 3 041a INITATOMTABLE exported
69 1 4942 FINDATOM exported
70 1 493f ADDATOM exported
71 1 01b9 DELETEATOM exported
72 1 01cd GETATOMNAME exported
73 1 01fd GETATOMHANDLE exported
74 1 05e5 OPENFILE exported
75 3 04be OPENPATHNAME exported
76 3 04b6 DELETEPATHNAME exported
77 1 83cd RESERVED1 exported
78 1 83ca RESERVED2 exported
79 1 83c4 RESERVED3 exported
80 1 83c7 RESERVED4 exported
81 1 046e _LCLOSE exported
82 1 04e6 _LREAD exported
83 1 048d _LCREAT exported
84 1 04b8 _LLSEEK exported
85 1 0443 _LOPEN exported
86 1 0516 _LWRITE exported
87 1 838e RESERVED5 exported
88 1 836f LSTRCPY exported
89 1 837f LSTRCAT exported
90 1 82f6 LSTRLEN exported
91 2 268d INITTASK exported
92 3 0508 GETTEMPDRIVE exported
93 1 48fa GETCODEHANDLE exported
94 3 03ce DEFINEHANDLETABLE exported
95 2 022d LOADLIBRARY exported
96 2 018a FREELIBRARY exported
97 3 00dc GETTEMPFILENAME exported
98 1 5c17 GETLASTDISKCHANGE exported
99 1 0bc5 GETLPERRMODE exported
100 2 2ab7 VALIDATECODESEGMENTS exported
101 1 1d92 NOHOOKDOSCALL exported
102 1 1d98 DOS3CALL exported
103 1 9e19 NETBIOSCALL exported
104 1 03db GETCODEINFO exported
105 3 07d9 GETEXEVERSION exported
106 1 2ede SETSWAPAREASIZE exported
107 3 0132 SETERRORMODE exported
108 1 11c6 SWITCHSTACKTO exported
109 1 123c SWITCHSTACKBACK exported
110 1 7bac PATCHCODEHANDLE exported
111 1 02fc GLOBALWIRE exported
112 1 0310 GLOBALUNWIRE exported
113 254 0003 __AHSHIFT exported
114 254 0008 __AHINCR exported
115 1 999b OUTPUTDEBUGSTRING exported
116 2 2797 INITLIB exported
117 1 7d3e OLDYIELD exported
118 1 7da7 GETTASKQUEUEDS exported
119 1 7db5 GETTASKQUEUEES exported
120 1 72d4 UNDEFDYNLINK exported
121 1 8db0 LOCALSHRINK exported
122 1 81ff ISTASKLOCKED exported
123 1 4638 KBDRST exported
124 1 9c90 ENABLEKERNEL exported
125 1 9c91 DISABLEKERNEL exported
126 1 2ea7 MEMORYFREED exported
127 1 06d7 GETPRIVATEPROFILEINT exported, shared data
128 1 0709 GETPRIVATEPROFILESTRING exported, shared data
129 1 0795 WRITEPRIVATEPROFILESTRING exported, shared data
130 3 0888 FILECDR exported
131 3 08ce GETDOSENVIRONMENT exported
132 3 07ab GETWINFLAGS exported
133 1 4e78 GETEXEPTR exported
134 3 0054 GETWINDOWSDIRECTORY exported
135 3 007e GETSYSTEMDIRECTORY exported
136 3 0675 GETDRIVETYPE exported
137 1 0211 FATALAPPEXIT exported
138 2 1e4d GETHEAPSPACES exported
139 1 612c DOSIGNAL exported
140 3 068c SETSIGHANDLER exported
141 1 8014 INITTASK1 exported
150 1 7cff DIRECTEDYIELD exported
151 3 07e6 WINOLDAPCALL exported
152 3 08e2 GETNUMTASKS exported
154 1 034c GLOBALNOTIFY exported
155 1 119f GETTASKDS exported
156 1 4632 LIMITEMSPAGES exported
157 1 4639 GETCURPID exported
158 1 7e3e ISWINOLDAPTASK exported
159 1 0ec5 GLOBALHANDLENORIP exported
160 1 a940 EMSCOPY exported
161 2 29c9 LOCALCOUNTFREE exported
162 2 2a01 LOCALHEAPSIZE exported
163 1 0338 GLOBALLRUOLDEST exported
164 1 0324 GLOBALLRUNEWEST exported
165 1 9e0c A20PROC exported
166 2 028f WINEXEC exported
167 1 4f02 GETEXPWINVER exported
168 1 84b8 DIRECTRESALLOC exported
169 1 0404 GETFREESPACE exported
170 1 00d0 ALLOCCSTODSALIAS exported
171 1 00e4 ALLOCDSTOCSALIAS exported
172 1 21fb ALLOCALIAS exported
173 254 f000 __ROMBIOS exported
174 254 a000 __A000H exported
175 1 1d9e ALLOCSELECTOR exported
176 1 00f8 FREESELECTOR exported
177 1 010c PRESTOCHANGOSELECTOR exported
178 254 0001 __WINFLAGS exported
179 254 d000 __D000H exported
180 1 26b9 LONGPTRADD exported
181 254 b000 __B000H exported
182 254 b800 __B800H exported
183 254 0000 __0000H exported
184 1 139a GLOBALDOSALLOC exported
185 1 13d4 GLOBALDOSFREE exported
186 1 2252 GETSELECTORBASE exported
187 1 2725 SETSELECTORBASE exported
188 1 2755 GETSELECTORLIMIT exported
189 1 276d SETSELECTORLIMIT exported
190 254 e000 __E000H exported
191 1 0363 GLOBALPAGELOCK exported
192 1 0377 GLOBALPAGEUNLOCK exported
193 254 0040 __0040H exported
194 254 f000 __F000H exported
195 254 c000 __C000H exported
196 1 279b SELECTORACCESSRIGHTS exported
197 1 038b GLOBALFIX exported
198 1 039f GLOBALUNFIX exported
199 1 0647 SETHANDLECOUNT exported
200 1 3e4e VALIDATEFREESPACES exported
201 1 9ada REPLACEINST exported
202 3 081d REGISTERPTRACE exported
203 1 946e DEBUGBREAK exported
204 3 014e SWAPRECORDING exported
205 1 97e0 CVWBREAK exported
206 1 1df5 ALLOCSELECTORARRAY exported
207 1 8425 ISDBCSLEADBYTE exported
310 2 2a0c LOCALHANDLEDELTA exported
311 1 9eaf GETSETKERNELDOSPROC exported
314 1 9835 DEBUGDEFINESEGMENT exported
315 1 708b WRITEOUTPROFILES exported, shared data
316 1 127e GETFREEMEMINFO exported
318 1 9ecf FATALEXITHOOK exported
319 1 52fc FLUSHCACHEDFILEHANDLE exported
320 1 7e50 ISTASK exported
323 2 1e9b ISROMMODULE exported
324 1 94cf LOGERROR exported, shared data
325 1 94f2 LOGPARAMERROR exported, shared data
326 2 1ea0 ISROMFILE exported
327 1 949b K327 exported
328 1 94ce _DEBUGOUTPUT exported
329 1 94c5 K329 exported
332 4 0218 THHOOK exported
334 1 4b62 ISBADREADPTR exported
335 1 4b83 ISBADWRITEPTR exported
336 1 4c28 ISBADCODEPTR exported
337 1 4c4e ISBADSTRINGPTR exported
338 1 4c72 HASGPHANDLER exported
339 1 a70e DIAGQUERY exported
340 1 a71d DIAGOUTPUT exported
341 3 084c TOOLHELPHOOK exported
342 1 a820 __GP exported, shared data
343 2 0689 REGISTERWINOLDAPHOOK exported
344 2 06f3 GETWINOLDAPHOOKS exported
345 1 4d39 ISSHAREDSELECTOR exported
346 1 4ba5 ISBADHUGEREADPTR exported
347 1 4be5 ISBADHUGEWRITEPTR exported
348 1 4d5c HMEMCPY exported
349 1 4dec _HREAD exported
350 1 4df1 _HWRITE exported
351 1 5e92 BUNNY_351 exported
353 1 831f LSTRCPYN exported
354 1 9eeb GETAPPCOMPATFLAGS exported
355 1 9f2a GETWINDEBUGINFO exported, shared data
356 1 9f36 SETWINDEBUGINFO exported, shared data
403 1 29f1 K403 exported
404 1 29ae K404 exported
static char RCSId[] = "$Id$";
static char RCSId[] = "$Id: kernel.c,v 1.1 1993/06/29 15:55:18 root Exp $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
......@@ -28,7 +28,7 @@ KERNEL_LockSegment(int segment)
segment = *(Stack16Frame + 6);
#ifdef RELAY_DEBUG
fprintf(stderr, "LockSegment: segment %x\n", segment);
printf("LockSegment: segment %x\n", segment);
#endif
return segment;
......@@ -44,7 +44,7 @@ KERNEL_UnlockSegment(int segment)
segment = *(Stack16Frame + 6);
#ifdef RELAY_DEBUG
fprintf(stderr, "UnlockSegment: segment %x\n", segment);
printf("UnlockSegment: segment %x\n", segment);
#endif
return segment;
......@@ -57,7 +57,7 @@ int
KERNEL_WaitEvent(int task)
{
#ifdef RELAY_DEBUG
fprintf(stderr, "WaitEvent: task %d\n", task);
printf("WaitEvent: task %d\n", task);
#endif
return 0;
}
......@@ -68,7 +68,7 @@ int
KERNEL_GetModuleFileName(int module, char *filename, int bytes)
{
#ifdef RELAY_DEBUG
fprintf(stderr, "GetModuleFileName: module %d, filename %x, bytes %d\n",
printf("GetModuleFileName: module %d, filename %x, bytes %d\n",
module, filename, bytes);
#endif
......
# $Id: kernel.spec,v 1.2 1993/06/30 14:24:33 root Exp root $
#
name kernel
id 1
length 256
length 410
3 pascal GetVersion() KERNEL_GetVersion()
3 return GetVersion 0 0x301
5 pascal LocalAlloc(word word) HEAP_LocalAlloc(1 2)
23 pascal LockSegment(s_word) KERNEL_LockSegment(1)
24 pascal UnlockSegment(s_word) KERNEL_UnlockSegment(1)
......
/* $Id$
*/
/*
* Copyright Robert J. Amstadt, 1993
*/
static char RCSId[] = "$Id: ldt.c,v 1.1 1993/06/29 15:55:18 root Exp $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
......
/* $Id$
*/
/*
* Copyright Robert J. Amstadt, 1993
*/
static char RCSId[] = "$Id: ldtlib.c,v 1.1 1993/06/29 15:55:18 root Exp $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
......
/* $Id: neexe.h,v 1.1 1993/06/09 03:28:10 root Exp root $
/* $Id: neexe.h,v 1.3 1993/06/30 14:24:33 root Exp root $
*/
/*
* Copyright Robert J. Amstadt, 1993
......@@ -143,9 +143,9 @@ struct dos_psp_s
unsigned short pspNextParagraph;
unsigned char pspReserved1;
unsigned char pspDispatcher[5];
unsigned long pspTerminateVector;
unsigned long pspControlCVector;
unsigned long pspCritErrorVector;
unsigned short pspTerminateVector[2];
unsigned short pspControlCVector[2];
unsigned short pspCritErrorVector[2];
unsigned short pspReserved2[11];
unsigned short pspEnvironment;
unsigned short pspReserved3[23];
......@@ -155,4 +155,63 @@ struct dos_psp_s
unsigned char pspCommandTail[128];
};
/*
* Entry table structures.
*/
struct entry_tab_header_s
{
unsigned char n_entries;
unsigned char seg_number;
};
struct entry_tab_movable_s
{
unsigned char flags;
unsigned char int3f[2];
unsigned char seg_number;
unsigned short offset;
};
struct entry_tab_fixed_s
{
unsigned char flags;
unsigned char offset[2];
};
/*
* Resource table structures.
*/
struct resource_nameinfo_s
{
unsigned short offset;
unsigned short length;
unsigned short flags;
unsigned short id;
unsigned short handle;
unsigned short usage;
};
struct resource_typeinfo_s
{
unsigned short type_id; /* Type identifier */
unsigned short count; /* Number of resources of this type */
unsigned long reserved;
/*
* Name info array.
*/
};
#define NE_RSCTYPE_ACCELERATOR 0x8009
#define NE_RSCTYPE_BITMAP 0x8002
#define NE_RSCTYPE_CURSOR 0x8001
#define NE_RSCTYPE_DIALOG 0x8005
#define NE_RSCTYPE_FONT 0x8008
#define NE_RSCTYPE_FONTDIR 0x8007
#define NE_RSCTYPE_GROUP_CURSOR 0x800c
#define NE_RSCTYPE_GROUP_ICON 0x800e
#define NE_RSCTYPE_ICON 0x8003
#define NE_RSCTYPE_MENU 0x8004
#define NE_RSCTYPE_RCDATA 0x800a
#define NE_RSCTYPE_STRING 0x8006
#endif /* NEEXE_H */
/* $Id$
/* $Id: prototypes.h,v 1.1 1993/06/29 15:55:18 root Exp $
*/
/*
* Copyright Robert J. Amstadt, 1993
......@@ -26,7 +26,14 @@ extern int FixupSegment(int fd, struct mz_header_s * mz_header,
struct segment_descriptor_s *selecetor_table,
int segment_num);
extern struct dll_table_entry_s *FindDLLTable(char *dll_name);
extern unsigned int GetEntryPointFromOrdinal(int fd,
struct mz_header_s *mz_header,
struct ne_header_s *ne_header,
int ordinal);
extern char WIN_CommandLine[];
extern struct mz_header_s *CurrentMZHeader;
extern struct ne_header_s *CurrentNEHeader;
extern int CurrentNEFile;
#endif /* PROTOTYPES_H */
/* $Id$
*/
/*
* Copyright Robert J. Amstadt, 1993
*/
static char RCSId[] = "$Id: relay.c,v 1.1 1993/06/29 15:55:18 root Exp $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
......@@ -20,12 +17,16 @@
#include "prototypes.h"
#include "dlls.h"
struct dll_name_table_entry_s dll_builtin_table[4] =
#define N_BUILTINS 6
struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] =
{
{ "KERNEL", KERNEL_table, 256, 1 },
{ "USER", USER_table, 256, 2 },
{ "GDI", GDI_table, 256, 3 },
{ "UNIXLIB", UNIXLIB_table, 256, 4 },
{ "KERNEL", KERNEL_table, 410, 1 },
{ "USER", USER_table, 540, 2 },
{ "GDI", GDI_table, 490, 3 },
{ "UNIXLIB", UNIXLIB_table, 10, 4 },
{ "WIN87EM", WIN87EM_table, 10, 5 },
{ "SHELL", SHELL_table, 256, 6 },
};
unsigned short *Stack16Frame;
......@@ -170,7 +171,7 @@ FindDLLTable(char *dll_name)
{
int i;
for (i = 0; i < 4; i++)
for (i = 0; i < N_BUILTINS; i++)
if (strcmp(dll_builtin_table[i].dll_name, dll_name) == 0)
return dll_builtin_table[i].dll_table;
......@@ -185,11 +186,11 @@ FindOrdinalFromName(struct dll_table_entry_s *dll_table, char *func_name)
{
int i, limit;
for (i = 0; i < 4; i++)
for (i = 0; i < N_BUILTINS; i++)
if (dll_table == dll_builtin_table[i].dll_table)
break;
if (i == 4)
if (i == N_BUILTINS)
return 0;
limit = dll_builtin_table[i].dll_table_length;
......
static char RCSId[] = "$Id: resource.c,v 1.3 1993/06/30 14:24:33 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
#include "prototypes.h"
#include "neexe.h"
#define MIN(a,b) ((a) < (b) ? (a) : (b))
typedef struct resource_data_s
{
int resource_type;
void *resource_data;
} RSCD;
RSCD *Resources;
int ResourceArraySize;
/**********************************************************************
* AddResource
*/
int
AddResource(int type, void *data)
{
RSCD *r;
int i;
int j;
/*
* Find free resource id.
*/
r = Resources;
for (i = 0; i < ResourceArraySize; i++, r++)
if (r->resource_type == 0)
break;
/*
* Do we need to add more resource slots?
*/
if (i == ResourceArraySize)
{
if (ResourceArraySize > 0)
r = realloc(Resources, (ResourceArraySize + 32) * sizeof(RSCD));
else
r = malloc(32 * sizeof(RSCD));
if (r == NULL)
return 0;
for (j = ResourceArraySize; j < ResourceArraySize + 32; j++)
r[j].resource_type = 0;
ResourceArraySize += 32;
Resources = r;
r = &Resources[i];
}
/*
* Add new resource to list.
*/
r->resource_type = type;
r->resource_data = data;
/*
* Return a unique handle.
*/
return i + 1;
}
/**********************************************************************
* FindResourceByNumber
*/
int
FindResourceByNumber(struct resource_nameinfo_s *result_p,
int type_id, int resource_id)
{
struct resource_typeinfo_s typeinfo;
struct resource_nameinfo_s nameinfo;
unsigned short size_shift;
int i;
/*
* Move to beginning of resource table.
*/
lseek(CurrentNEFile, (CurrentMZHeader->ne_offset +
CurrentNEHeader->resource_tab_offset), SEEK_SET);
/*
* Read block size.
*/
if (read(CurrentNEFile, &size_shift, sizeof(size_shift)) !=
sizeof(size_shift))
{
return -1;
}
/*
* Find resource.
*/
typeinfo.type_id = 0xffff;
while (typeinfo.type_id != 0)
{
if (read(CurrentNEFile, &typeinfo, sizeof(typeinfo)) !=
sizeof(typeinfo))
{
return -1;
}
if (typeinfo.type_id != 0)
{
for (i = 0; i < typeinfo.count; i++)
{
if (read(CurrentNEFile, &nameinfo, sizeof(nameinfo)) !=
sizeof(nameinfo))
{
return -1;
}
#if defined(DEBUG_RESOURCE) && defined(VERBOSE_DEBUG)
if (type_id == typeinfo.type_id)
{
printf("FindResource: type id = %d, resource id = %x\n",
type_id, nameinfo.id);
}
#endif
if ((type_id == -1 || typeinfo.type_id == type_id) &&
nameinfo.id == resource_id)
{
memcpy(result_p, &nameinfo, sizeof(nameinfo));
return size_shift;
}
}
}
}
return -1;
}
/**********************************************************************
* RSC_LoadString
*/
int
RSC_LoadString(int instance, int resource_id, char *buffer, int buflen)
{
struct resource_nameinfo_s nameinfo;
unsigned short target_id;
unsigned char string_length;
int size_shift;
int string_num;
int i;
#ifdef DEBUG_RESOURCE
printf("LoadString: instance = %04x, id = %d, "
"buffer = %08x, length = %d\n",
instance, resource_id, buffer, buflen);
#endif
/*
* Find string entry.
*/
target_id = (resource_id >> 4) + 0x8001;
string_num = resource_id & 0x000f;
size_shift = FindResourceByNumber(&nameinfo, NE_RSCTYPE_STRING, target_id);
if (size_shift == -1)
return 0;
lseek(CurrentNEFile, (int) nameinfo.offset << size_shift, SEEK_SET);
for (i = 0; i < string_num; i++)
{
read(CurrentNEFile, &string_length, 1);
lseek(CurrentNEFile, string_length, SEEK_CUR);
}
read(CurrentNEFile, &string_length, 1);
i = MIN(string_length, buflen - 1);
read(CurrentNEFile, buffer, i);
buffer[i] = '\0';
#ifdef DEBUG_RESOURCE
printf(" '%s'\n", buffer);
#endif
return i;
}
/**********************************************************************
* RSC_LoadBitmap
*/
int
RSC_LoadBitmap(int instance, char *bmp_name)
{
struct resource_nameinfo_s nameinfo;
void *image;
int image_size;
int size_shift;
#ifdef DEBUG_RESOURCE
printf("LoadBitmap: instance = %04x, name = %08x\n",
instance, bmp_name);
#endif
/*
* Built-in bitmaps
*/
if (instance == 0)
{
return 0;
}
/*
* Get bitmap by ordinal
*/
else if (((int) bmp_name & 0xffff0000) == 0)
{
size_shift = FindResourceByNumber(&nameinfo, NE_RSCTYPE_BITMAP,
(int) bmp_name | 0x8000);
}
/*
* Get bitmap by name
*/
else
{
size_shift = -1;
}
if (size_shift == -1)
return 0;
/*
* Read bitmap.
*/
lseek(CurrentNEFile, ((int) nameinfo.offset << size_shift), SEEK_SET);
image_size = nameinfo.length << size_shift;
image = malloc(image_size);
if (image == NULL || read(CurrentNEFile, image, image_size) != image_size)
{
free(image);
return 0;
}
/*
* Add to resource list.
*/
return AddResource(NE_RSCTYPE_BITMAP, image);
}
/* $Id$
/* $Id: segmem.h,v 1.1 1993/06/29 15:55:18 root Exp $
*/
/*
* Copyright Robert J. Amstadt, 1993
......
/* $Id: exedump.c,v 1.1 1993/06/09 03:28:10 root Exp root $
*/
/*
* Copyright Robert J. Amstadt, 1993
*/
static char RCSId[] = "$Id: selector.c,v 1.1 1993/06/29 15:55:18 root Exp $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
......@@ -29,6 +26,78 @@ unsigned short PSPSelector;
extern void KERNEL_Ordinal_102();
extern void UNIXLIB_Ordinal_0();
/**********************************************************************
* GetEntryPointFromOrdinal
*/
unsigned int
GetEntryPointFromOrdinal(int fd, struct mz_header_s *mz_header,
struct ne_header_s *ne_header, int ordinal)
{
struct entry_tab_header_s eth;
struct entry_tab_movable_s etm;
struct entry_tab_fixed_s etf;
int current_ordinal;
int i;
/*
* Move to the beginning of the entry table.
*/
lseek(fd, mz_header->ne_offset + ne_header->entry_tab_offset, SEEK_SET);
/*
* Let's walk through the table until we get to our entry.
*/
current_ordinal = 1;
while (1)
{
/*
* Read header for this bundle.
*/
if (read(fd, &eth, sizeof(eth)) != sizeof(eth))
myerror("Error reading entry table");
if (eth.n_entries == 0)
return 0;
if (eth.seg_number == 0)
{
current_ordinal++;
continue;
}
/*
* Read each of the bundle entries.
*/
for (i = 0; i < eth.n_entries; i++, current_ordinal++)
{
if (eth.seg_number >= 0xfe)
{
if (read(fd, &etm, sizeof(etm)) != sizeof(etm))
myerror("Error reading entry table");
if (current_ordinal == ordinal)
{
return ((unsigned int)
(SelectorTable[etm.seg_number - 1].base_addr +
etm.offset));
}
}
else
{
if (read(fd, &etf, sizeof(etf)) != sizeof(etf))
myerror("Error reading entry table");
if (current_ordinal == ordinal)
{
return ((unsigned int)
(SelectorTable[eth.seg_number - 1].base_addr +
(int) etf.offset[0] +
((int) etf.offset[1] << 8)));
}
}
}
}
}
/**********************************************************************
* GetDOSEnvironment
......@@ -113,9 +182,12 @@ CreatePSP(int sel_idx, struct segment_descriptor_s *s, FILE *zfile)
usp = (unsigned short *) &psp->pspDispatcher[1];
*usp = (unsigned short) KERNEL_Ordinal_102;
*(usp + 1) = 0x23;
psp->pspTerminateVector = 0x00230000 | ((int) UNIXLIB_Ordinal_0 & 0xffff);
psp->pspControlCVector = 0x00230000 | ((int) UNIXLIB_Ordinal_0 & 0xffff);
psp->pspCritErrorVector = 0x00230000 | ((int) UNIXLIB_Ordinal_0 & 0xffff);
psp->pspTerminateVector[0] = (unsigned short) UNIXLIB_Ordinal_0;
psp->pspTerminateVector[1] = 0x0023;
psp->pspControlCVector[0] = (unsigned short) UNIXLIB_Ordinal_0;
psp->pspControlCVector[1] = 0x0023;
psp->pspCritErrorVector[0] = (unsigned short) UNIXLIB_Ordinal_0;
psp->pspCritErrorVector[1] = 0x0023;
psp->pspEnvironment = SelectorTable[EnvironmentSelectorIdx].selector;
psp->pspCommandTailCount = 1;
strcpy(psp->pspCommandTail, "\r");
......@@ -161,6 +233,14 @@ CreateSelectors(int fd, struct ne_segment_table_entry_s *seg_table,
zfile = fopen("/dev/zero","r");
for (i = 0; i < ne_header->n_segment_tab; i++, s++)
{
#ifdef DEBUG_SEGMENT
printf(" %2d: OFFSET %04.4x, LENGTH %04.4x, ",
i + 1, seg_table[i].seg_data_offset,
seg_table[i].seg_data_length);
printf("FLAGS %04.4x, MIN ALLOC %04.4x\n",
seg_table[i].seg_flags, seg_table[i].min_alloc);
#endif
/*
* Store the flags in our table.
*/
......@@ -231,7 +311,8 @@ CreateSelectors(int fd, struct ne_segment_table_entry_s *seg_table,
/*
* Image in file.
*/
status = lseek(fd, seg_table[i].seg_data_offset * 512, SEEK_SET);
status = lseek(fd, seg_table[i].seg_data_offset *
(1 << ne_header->align_shift_count), SEEK_SET);
if(read(fd, s->base_addr, old_length) != old_length)
myerror("Unable to read segment from file");
}
......
# $Id: shell.spec,v 1.2 1993/06/30 14:24:33 root Exp root $
#
name shell
id 5
length 256
File deleted
# $Id: unixlib.spec,v 1.2 1993/06/30 14:24:33 root Exp root $
#
name unixlib
id 4
length 256
length 10
1 c _DebugPrintString(ptr) DebugPrintString(1)
This diff is collapsed. Click to expand it.
static char RCSId[] = "$Id$";
static char RCSId[] = "$Id: user.c,v 1.1 1993/06/29 15:55:18 root Exp $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
......
# $Id: user.spec,v 1.2 1993/06/30 14:24:33 root Exp root $
#
name user
id 2
length 256
length 540
5 pascal InitApp(word) USER_InitApp(1)
175 pascal LoadBitmap(word ptr) RSC_LoadBitmap(1 2)
176 pascal LoadString(word word ptr s_word) RSC_LoadString(1 2 3 4)
# $Id: win87em.spec,v 1.2 1993/06/30 14:24:33 root Exp root $
#
name win87em
id 5
length 10
#ifndef WINDOWS_H
#define WINDOWS_H
typedef struct tagRGBQUAD
{
unsigned char rgbBlue;
unsigned char rgbGreen;
unsigned char rgbRed;
unsigned char rgbReserved;
};
typedef struct tagBITMAPINFOHEADER
{
unsigned long biSize;
unsigned long biWidth;
unsigned long biHeight;
unsigned short biPlanes;
unsigned short biBitCount;
unsigned long biCompression;
unsigned long biSizeImage;
unsigned long biXPelsPerMeter;
unsigned long biYPelsPerMeter;
unsigned long biClrUsed;
unsigned long biClrImportant;
} BITMAPINFOHEADER;
#endif
File deleted
/* $Id: exedump.c,v 1.1 1993/06/09 03:28:10 root Exp root $
*/
/*
* Copyright Robert J. Amstadt, 1993
*/
static char RCSId[] = "$Id: wine.c,v 1.1 1993/06/29 15:55:18 root Exp $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
......@@ -20,13 +17,18 @@
#include "prototypes.h"
#include "dlls.h"
extern int CallTo16(unsigned long csip, unsigned long sssp, unsigned short ds);
extern int CallToInit16(unsigned long csip, unsigned long sssp,
unsigned short ds);
extern void CallTo32();
unsigned short WIN_StackSize;
unsigned short WIN_HeapSize;
char **Argv;
int Argc;
struct mz_header_s *CurrentMZHeader;
struct ne_header_s *CurrentNEHeader;
int CurrentNEFile;
/**********************************************************************
* DebugPrintString
......@@ -34,7 +36,7 @@ int Argc;
int
DebugPrintString(char *str)
{
fprintf(stderr, "%s", str);
printf("%s", str);
return 0;
}
......@@ -119,8 +121,12 @@ main(int argc, char **argv)
if (ne_header->header_type[0] != 'N' || ne_header->header_type[1] != 'E')
myerror("This is not a Windows program");
WIN_StackSize = ne_header->stack_length;
CurrentMZHeader = mz_header;
CurrentNEHeader = ne_header;
CurrentNEFile = fd;
WIN_StackSize = ne_header->stack_length;
WIN_HeapSize = ne_header->local_heap_length;
/*
* Create segment selectors.
......@@ -146,7 +152,6 @@ main(int argc, char **argv)
}
}
close(fd);
/*
* Fixup stack and jump to start.
*/
......@@ -156,7 +161,7 @@ main(int argc, char **argv)
ss_reg = selector_table[ne_header->ss-1].selector;
sp_reg = ne_header->sp;
rv = CallTo16(cs_reg << 16 | ip_reg, ss_reg << 16 | sp_reg, ds_reg);
rv = CallToInit16(cs_reg << 16 | ip_reg, ss_reg << 16 | sp_reg, ds_reg);
printf ("rv = %x\n", rv);
}
......@@ -244,7 +249,8 @@ FixupSegment(int fd, struct mz_header_s * mz_header,
if (i == 0)
i = 0x10000;
status = lseek(fd, seg->seg_data_offset * 512 + i, SEEK_SET);
status = lseek(fd, seg->seg_data_offset *
(1 << ne_header->align_shift_count) + i, SEEK_SET);
n_entries = 0;
read(fd, &n_entries, sizeof(short int));
rep = (struct relocation_entry_s *)
......@@ -273,6 +279,15 @@ FixupSegment(int fd, struct mz_header_s * mz_header,
}
dll_table = FindDLLTable(dll_name);
if (dll_table == NULL)
{
char s[80];
sprintf(s, "Bad DLL name '%s'", dll_name);
myerror(s);
return -1;
}
ordinal = rep->target2;
selector = dll_table[ordinal].selector;
address = (unsigned int) dll_table[ordinal].address;
......@@ -289,6 +304,14 @@ FixupSegment(int fd, struct mz_header_s * mz_header,
return -1;
}
dll_table = FindDLLTable(dll_name);
if (dll_table == NULL)
{
char s[80];
sprintf(s, "Bad DLL name '%s'", dll_name);
myerror(s);
return -1;
}
if (GetImportedName(fd, mz_header, ne_header,
rep->target2, func_name) == NULL)
......@@ -305,7 +328,48 @@ FixupSegment(int fd, struct mz_header_s * mz_header,
break;
case NE_RELTYPE_INTERNAL:
if (rep->target1 == 0x00ff)
{
address = GetEntryPointFromOrdinal(fd, mz_header, ne_header,
rep->target2);
selector = (address >> 16) & 0xffff;
address &= 0xffff;
}
else
{
selector = selector_table[rep->target1-1].selector;
address = rep->target2;
}
#ifdef DEBUG_FIXUP
printf("%d: %04.4x:%04.4x\n", i + 1, selector, address);
#endif
break;
case 7:
/* Relocation type 7:
*
* These appear to be used as fixups for the Windows
* floating point emulator. Let's just ignore them and
* try to use the hardware floating point. Linux should
* successfully emulate the coprocessor if it doesn't
* exist.
*/
#ifdef DEBUG_FIXUP
printf("%d: ADDR TYPE %d, TYPE %d, OFFSET %04.4x, ",
i + 1, rep->address_type, rep->relocation_type,
rep->offset);
printf("TARGET %04.4x %04.4x\n", rep->target1, rep->target2);
#endif
continue;
default:
#ifdef DEBUG_FIXUP
printf("%d: ADDR TYPE %d, TYPE %d, OFFSET %04.4x, ",
i + 1, rep->address_type, rep->relocation_type,
rep->offset);
printf("TARGET %04.4x %04.4x\n", rep->target1, rep->target2);
#endif
free(rep1);
return -1;
}
......@@ -337,7 +401,23 @@ FixupSegment(int fd, struct mz_header_s * mz_header,
break;
case NE_RADDR_SELECTOR:
do {
next_addr = *sp;
*sp = (unsigned short) selector;
sp = (unsigned short *) ((char *) sel->base_addr + next_addr);
}
while (next_addr != 0xffff);
break;
default:
#ifdef DEBUG_FIXUP
printf("%d: ADDR TYPE %d, TYPE %d, OFFSET %04.4x, ",
i + 1, rep->address_type, rep->relocation_type,
rep->offset);
printf("TARGET %04.4x %04.4x\n", rep->target1, rep->target2);
#endif
free(rep1);
return -1;
}
......
/* MAIN.C
*
* PURPOSE:
*
* FUNCTIONS:
* WinMain() - Initializes app, calls all other functions.
*/
#include <windows.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
/*
* Globals
*/
char szAppName[] = "WineTest";
extern long FAR PASCAL WineTestWndProc(HWND hwnd, unsigned message,
WORD wParam, LONG lParam);
/* extern void FAR __cdecl DebugPrintString(const char FAR *str); */
/* WinMain
*/
int PASCAL
WinMain(HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpszCmdLine, int cmdShow)
{
DebugPrintString("Hello\n");
return 0;
#if 0
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
if (hPrevInstance)
{
MessageBox(NULL, "This application is already running.", szAppName,
MB_OK | MB_ICONEXCLAMATION | MB_SYSTEMMODAL);
return NULL;
}
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WineTestWndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = "MainMenu";
wndclass.lpszClassName = szAppName;
RegisterClass(&wndclass);
hwnd = CreateWindow(szAppName, "Wine Tester",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(hwnd, cmdShow);
UpdateWindow(hwnd);
while (GetMessage(&msg, NULL, NULL, NULL))
{
TranslateMessage((LPMSG) &msg);
DispatchMessage((LPMSG) &msg);
}
return msg.wParam;
#endif /* 0 */
}
/* WineTestWndProc
*/
long FAR PASCAL
WineTestWndProc(HWND hwnd, unsigned message, WORD wParam, LONG lParam)
{
static HANDLE hInstance;
FARPROC DlgProcInst;
LONG parm;
switch (message)
{
case WM_CREATE:
hInstance = ((LPCREATESTRUCT) lParam)->hInstance;
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
####################################################################
#
# PPI standard windows makefile
#
####################################################################
####################################################################
#
# Compiler options
#
AFLAGS=/ML /LA
CFLAGS=-AM -Ozaxb2 -Gr -G2 -Zpei -W3 -DWINVER=0x0301
LFLAGS=/CO
####################################################################
#
# Object files and target
#
OBJS=main.obj
DIALOGS=
TARGET=winetest
####################################################################
#
# Standard rules
#
ROOTS=$(OBJS:.obj=)
all: $(TARGET).exe
version:
coall -r$(RELEASE)
$(MAKE) all
$(TARGET).res: $(TARGET).rc $(TARGET).h $(DIALOGS)
rc -r $(TARGET).rc
$(TARGET).exe: $(TARGET).res $(TARGET).def $(TARGET).h $(OBJS)
link @<<
$(ROOTS) /NOD $(LFLAGS)
$@
$(TARGET) /MAP:FULL
libw slibcewn oldnames
$(TARGET).def
<<
rc -30 $(TARGET).res
NAME WINETEST
DESCRIPTION 'Wine Tester'
EXETYPE WINDOWS
STUB 'WINSTUB.EXE'
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE SINGLE
HEAPSIZE 8192
STACKSIZE 8192
EXPORTS WineTestWndProc
IMPORTS UNIXLIB._DebugPrintString
#include <windows.h>
MainMenu MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit", 100
MENUITEM SEPARATOR
MENUITEM "&About...", 101
END
END
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment