initial comit

svn path=/trunk/; revision=2773
This commit is contained in:
Robert Kopferl 2002-03-23 19:23:28 +00:00
parent e23995664a
commit aea2b71437
16 changed files with 2595 additions and 0 deletions

32
os2/apps/bepslep/Makefile Normal file
View file

@ -0,0 +1,32 @@
# $Id: Makefile,v 1.1 2002/03/23 19:23:27 robertk Exp $
#
# To run it in Win32 console mode, undefine __SUBSYSTEM_WINDOWS__
# and pass "console" in the ld's --subsystem option.
#
#
PATH_TO_TOP=../../../..
PATH_TO_OS2_TOP=../..
TARGET_NAME=bepslep
CFLAGS=-D__SUBSYSTEM_WINDOWS__
OBJECTS=$(TARGET_NAME).o
LIBRARIES=\
$(PATH_TO_OS2_TOP)/dll/doscalls.dll
$(TARGET_NAME): $(OBJECTS) $(LIBRARIES)
$(CC) \
$(CFLAGS) \
$(OBJECTS) \
$(LIBRARIES)\
-o $@ \
-Wl,--subsystem,windows\
-nostartfiles \
-nostdlib
include $(PATH_TO_TOP)/rules.mak
# EOF

View file

@ -0,0 +1,19 @@
#include "../../dll/doscalls/doscalls.h"
void Eingang()
{
DosBeep(3000,300);
DosSleep(1000);
DosBeep(4000,200);
DosExit(0,0);
}
void WinMainCRTStartup()
{
int a, b;
a= b+3;
b=a+3;
Eingang();
}

View file

@ -0,0 +1,20 @@
; Def for doscalls.dll - part of the OS/2-sub system
; for ReactOS. Provides Access to OS/2 kernel services.
LIBRARY doscalls.dll
DESCRIPTION "Part of the ReactOS OS/2 sub system, provides base kernel services to OS/2-apps"
EXPORTS
; FIXME: fill in all exports
Dos32Sleep=Dos32Sleep@4 @229
Dos32Close=Dos32Close@4 @257
Dos32Open=Dos32Open@32 @273
Dos32Read=Dos32Read@16 @281
Dos32Write=Dos32Write@16 @282
Dos32DevIOCtl=Dos32DevIOCtl@36 @284
Dos32Beep=Dos32Beep@8 @286
Dos32Exit=Dos32Exit@8 @234
Dos32CreateThread=Dos32CreateThread@20 @311

View file

@ -0,0 +1,38 @@
#include <defines.h>
#include <reactos/resource.h>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO VERSIONINFO
FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", RES_STR_COMPANY_NAME
VALUE "FileDescription", "OS2 subsystem base services\0"
VALUE "FileVersion", RES_STR_FILE_VERSION
VALUE "InternalName", "doscalls\0"
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
VALUE "OriginalFilename", "doscalls.dll\0"
VALUE "ProductName", RES_STR_PRODUCT_NAME
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

File diff suppressed because it is too large Load diff

39
os2/lib/doscalls/makefile Normal file
View file

@ -0,0 +1,39 @@
# $Id: makefile,v 1.1 2002/03/23 19:23:28 robertk Exp $
PATH_TO_TOP = ../../../..
TARGET_TYPE = dynlink
TARGET_NAME = doscalls
TARGET_BASE = 0x30000000
TARGET_CFLAGS = -DDOSCALLS_BASE=$(TARGET_DLLBASE)
TARGET_LFLAGS = -nostartfiles
TARGET_SDKLIBS = ntdll.a
TARGET_GCCLIBS = gcc
TARGET_OBJECTS = $(TARGET_NAME).o
TARGET_CLEAN = file/*.o vio/*.o sync/*.o mem/*.o \
misc/*.o mou/*.o kbd/*.o run/*.o
TARGET_DEFONLY=yes
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
MISC_OBJECTS = misc/doscalls.o
#SYNC_OBJECTS =
OBJECTS = $(MISC_OBJECTS)
$(TARGET_NAME).o: $(OBJECTS)
$(LD) -r $(OBJECTS) -o $(TARGET_NAME).o

View file

@ -0,0 +1,245 @@
/* $ ld $
*/
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* FILE: dll/doscalls.c
* PURPOSE: Kernelservices for OS/2 apps
* PROGRAMMER: Robert K. robertk@mok.lvcm.com
* REVISION HISTORY:
* 13-03-2002 Created
*/
#include <ddk/ntddk.h>
#include "doscalls.h"
/* Process variables. This section conains
per process variables that are used for caching or
other stuff. */
DWORD PROC_Pid; // contains the current processes pid. (or is it also in PEB)
/* Implementation of the system calls */
APIRET APIENTRY Dos32Sleep(ULONG msec)
{
NTSTATUS stat;
TIME Interv;
Interv.QuadPart= -(10000 * msec);
stat = NtDelayExecution( TRUE, &Interv );
return 0;
}
APIRET APIENTRY Dos32CreateThread(PTID ptid, PFNTHREAD pfn,
ULONG param, ULONG flag, ULONG cbStack)
{
return 0;
}
APIRET APIENTRY Dos32Open(PSZ pszFileName, PHFILE pHf,
PULONG pulAction, ULONG cbFile,
ULONG ulAttribute, ULONG fsOpenFlags,
ULONG fsOpenMode, PVOID reserved ) //ULONGPEAOP2 peaop2)
{
/* NTAPI
ZwCreateFile(
OUT PHANDLE FileHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes,
OUT PIO_STATUS_BLOCK IoStatusBlock,
IN PLARGE_INTEGER AllocationSize OPTIONAL,
IN ULONG FileAttributes,
IN ULONG ShareAccess,
IN ULONG CreateDisposition,
IN ULONG CreateOptions,
IN PVOID EaBuffer OPTIONAL,
IN ULONG EaLength
);*/
return 0;
}
/* close a Handle. seems finished */
APIRET APIENTRY Dos32Close(HFILE hFile)
{
NTSTATUS nErrCode;
nErrCode = NtClose( (HANDLE)hFile );
switch( nErrCode )
{
case STATUS_SUCCESS:
return NO_ERROR;
case STATUS_INVALID_HANDLE:
return ERROR_INVALID_HANDLE;
case STATUS_HANDLE_NOT_CLOSABLE:
return ERROR_FILE_NOT_FOUND;
}
return nErrCode;
}
APIRET APIENTRY Dos32Read(HFILE hFile, PVOID pBuffer,
ULONG cbRead, PULONG pcbActual)
{
NTSTATUS nErrCode;
IO_STATUS_BLOCK isbStatus;
// read data from file
nErrCode = NtReadFile( (HANDLE)hFile, NULL, NULL, NULL,
&isbStatus, pBuffer, cbRead,
NULL, NULL );
// contains the # bytes actually read.
*pcbActual = isbStatus.Information;
switch(nErrCode)
{
case STATUS_INVALID_HANDLE:
return ERROR_INVALID_HANDLE;
// FIXME: complete this
}
return NO_ERROR;
}
/* Generic write to a stream given by hFile */
APIRET APIENTRY Dos32Write(HFILE hFile, PVOID pBuffer,
ULONG cbWrite, PULONG pcbActual)
{
NTSTATUS nErrCode;
IO_STATUS_BLOCK StatusBlk;
nErrCode = NtWriteFile( (HANDLE)hFile, NULL, NULL, NULL,
&StatusBlk, pBuffer, cbWrite, 0, NULL );
*pcbActual = StatusBlk.Information;
// do an errorcode translation FIXME: correct
switch(nErrCode)
{
case STATUS_SUCCESS:
case STATUS_PENDING:
case STATUS_ACCESS_DENIED:
case STATUS_INVALID_HANDLE:
case STATUS_FILE_LOCK_CONFLICT:
return 0;
}
return 0;
}
/*******************************************/
/* DosDevIOCtl performs control functions */
/* on a device specified by an opened */
/* device handle. */
/*******************************************/
/*HFILE hDevice; Device handle returned by DosOpen, or a standard (open) device handle. */
/*ULONG category; Device category. */
/*ULONG function; Device-specific function code. */
/*PVOID pParams; Address of the command-specific argument list. */
/*ULONG cbParmLenMax; Length, in bytes, of pParams. */
/*PULONG pcbParmLen; Pointer to the length of parameters. */
/*PVOID pData; Address of the data area. */
/*ULONG cbDataLenMax; Length, in bytes, of pData. */
/*PULONG pcbDataLen; Pointer to the length of data. */
/*APIRET ulrc; Return Code.
ulrc (APIRET) - returns
Return Code.
DosDevIOCtl returns one of the following values:
0 NO_ERROR
1 ERROR_INVALID_FUNCTION
6 ERROR_INVALID_HANDLE
15 ERROR_INVALID_DRIVE
31 ERROR_GEN_FAILURE
87 ERROR_INVALID_PARAMETER
111 ERROR_BUFFER_OVERFLOW
115 ERROR_PROTECTION_VIOLATION
117 ERROR_INVALID_CATEGORY
119 ERROR_BAD_DRIVER_LEVEL
163 ERROR_UNCERTAIN_MEDIA
165 ERROR_MONITORS_NOT_SUPPORTED
*/
APIRET APIENTRY Dos32DevIOCtl(HFILE hDevice, ULONG category, ULONG function,
PVOID pParams,ULONG cbParmLenMax,PULONG pcbParmLen,
PVOID pData,ULONG cbDataLenMax,PULONG pcbDataLen)
{
return 0;
}
APIRET APIENTRY Dos32Beep(ULONG freq, ULONG dur)
{
if( freq<0x25 || freq>0x7FFF )
return 395; // ERROR_INVALID_FREQUENCY
/* HANDLE hBeep;
BEEP_SET_PARAMETERS BeepSetParameters;
DWORD dwReturned;
hBeep = Dos32Open("\\\\.\\Beep",
FILE_GENERIC_READ | FILE_GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
if (hBeep == INVALID_HANDLE_VALUE)
return FALSE;
*/
// Set beep data
/* BeepSetParameters.Frequency = dwFreq;
BeepSetParameters.Duration = dwDuration;
DeviceIoControl(hBeep,
IOCTL_BEEP_SET,
&BeepSetParameters,
sizeof(BEEP_SET_PARAMETERS),
NULL,
0,
&dwReturned,
NULL);
CloseHandle (hBeep);
return TRUE;
*/
return 0;
}
/* Terminates the current thread or the current Process.
Decission is made by action
FIXME: move this code to OS2.EXE */
VOID APIENTRY Dos32Exit(ULONG action, ULONG result)
{
// decide what to do
if( action == EXIT_THREAD)
{
NtTerminateThread( NULL, result );
}
else // EXIT_PROCESS
{
NtTerminateProcess( NULL, result );
}
}
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
switch (ul_reason_for_call)
{
case 1://DLL_PROCESS_ATTACH:
case 2://DLL_THREAD_ATTACH:
case 3://DLL_THREAD_DETACH:
case 0://DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

View file

@ -0,0 +1,84 @@
/* $ $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* FILE: dll/doscalls.h
* PURPOSE: Kernelservices for OS/2 apps
* PROGRAMMER: Robert K. robertk@mok.lvcm.com
* REVISION HISTORY:
* 13-03-2002 Created
*/
#include "os2def.h"
// FIXME: use ib headers
#define EXIT_THREAD 0
#define EXIT_PROCESS 1
#define NO_ERROR 0
#define ERROR_INVALID_HANDLE 5
#define ERROR_FILE_NOT_FOUND 6
// for this
// Give the user nicer names that the internal ones
#define DosSleep Dos32Sleep
#define DosCreateThread Dos32CreateThread
#define DosOpen Dos32Open
#define DosClose Dos32Close
#define DosRead Dos32Read
#define DosWrite Dos32Write
#define DosBeep Dos32Beep
#define DosExit Dos32Exit
APIRET APIENTRY Dos32Sleep(ULONG msec);
APIRET APIENTRY Dos32CreateThread(PTID ptid,
PFNTHREAD pfn,
ULONG param,
ULONG flag,
ULONG cbStack);
APIRET APIENTRY Dos32Open(PSZ pszFileName,
PHFILE pHf,
PULONG pulAction,
ULONG cbFile,
ULONG ulAttribute,
ULONG fsOpenFlags,
ULONG fsOpenMode,
PVOID reserved ); //ULONGPEAOP2 peaop2)
APIRET APIENTRY Dos32Close(HFILE hFile);
APIRET APIENTRY Dos32Read(HFILE hFile,
PVOID pBuffer,
ULONG cbRead,
PULONG pcbActual);
APIRET APIENTRY Dos32Write(HFILE hFile,
PVOID pBuffer,
ULONG cbWrite,
PULONG pcbActual);
APIRET APIENTRY Dos32DevIOCtl(HFILE hDevice, ULONG category, ULONG function,
PVOID pParams,ULONG cbParmLenMax,PULONG pcbParmLen,
PVOID pData,ULONG cbDataLenMax,PULONG pcbDataLen);
APIRET APIENTRY Dos32Beep(ULONG freq,
ULONG dur);
VOID APIENTRY Dos32Exit(ULONG action,
ULONG result);

View file

@ -0,0 +1,287 @@
/* $ld$
*/
/* some header*/
#include <os2errores>
#include <nt's status.h>
/* This file defines a big array of #defines that are
used to translate OS/2 errorcodes to ntdll error codes. */
/* OS/2 to NTDLL error mapping */
#define NO_ERROR STATUS_SUCCESS
#define ERROR_INVALID_FUNCTION STATUS_ILLEGAL_FUNCTION
#define ERROR_FILE_NOT_FOUND 2 /* MSG%FILE_NOT_FOUND */
#define ERROR_PATH_NOT_FOUND 3 /* MSG%PATH_NOT_FOUND */
#define ERROR_TOO_MANY_OPEN_FILES 4 /* MSG%OUT_OF_HANDLES */
#define ERROR_ACCESS_DENIED 5 /* MSG%ACCESS_DENIED */
#define ERROR_INVALID_HANDLE 6 /* MSG%INVALID_HANDLE */
#define ERROR_ARENA_TRASHED 7 /* MSG%MEMORY_BLOCKS_BAD */
#define ERROR_NOT_ENOUGH_MEMORY 8 /* MSG%NO_MEMORY */
#define ERROR_INVALID_BLOCK 9 /* MSG%INVALID_MEM_ADDR */
#define ERROR_BAD_ENVIRONMENT 10 /* MSG%INVALID_ENVIRON */
#define ERROR_BAD_FORMAT 11 /* MSG%INVALID_FORMAT */
#define ERROR_INVALID_ACCESS 12 /* MSG%INVALID_ACC_CODE */
#define ERROR_INVALID_DATA 13 /* MSG%INVALID_DATA */
#define ERROR_INVALID_DRIVE 15 /* MSG%INVALID_DRIVE */
#define ERROR_CURRENT_DIRECTORY 16 /* MSG%ATT_RD_CURDIR */
#define ERROR_NOT_SAME_DEVICE 17 /* MSG%NOT_SAME_DEVICE */
#define ERROR_NO_MORE_FILES 18 /* MSG%NO_MORE_FILES */
#define ERROR_WRITE_PROTECT 19 /* MSG%ATT_WRITE_PROT */
#define ERROR_BAD_UNIT 20 /* MSG%UNKNOWN_UNIT */
#define ERROR_NOT_READY 21 /* MSG%DRIVE_NOT_READY */
#define ERROR_BAD_COMMAND 22 /* MSG%UNKNOWN_COMMAND */
#define ERROR_CRC 23 /* MSG%DATA_ERROR */
#define ERROR_BAD_LENGTH 24 /* MSG%BAD_REQ_STRUCTURE */
#define ERROR_SEEK 25 /* MSG%SEEK_ERROR */
#define ERROR_NOT_DOS_DISK 26 /* MSG%UNKNOWN_MEDIA */
#define ERROR_SECTOR_NOT_FOUND 27 /* MSG%SECTOR_NOT_FOUND */
#define ERROR_OUT_OF_PAPER 28 /* MSG%OUT_OF_PAPER */
#define ERROR_WRITE_FAULT 29 /* MSG%WRITE_FAULT */
#define ERROR_READ_FAULT 30 /* MSG%READ_FAULT */
#define ERROR_GEN_FAILURE 31 /* MSG%GENERAL_FAILURE */
#define ERROR_SHARING_VIOLATION 32 /* MSG%SHARING_VIOLATION */
/* 32%msg%SHAR_VIOLAT_FIND */
#define ERROR_LOCK_VIOLATION 33 /* MSG%LOCK_VIOLATION */
#define ERROR_WRONG_DISK 34 /* MSG%INVALID_DISK_CHANGE */
#define ERROR_FCB_UNAVAILABLE 35 /* MSG%35 */
#define ERROR_SHARING_BUFFER_EXCEEDED 36 /* MSG%SHARING_BUFF_OFLOW */
#define ERROR_CODE_PAGE_MISMATCHED 37 /* MSG%ERROR_WRITE_PROTECT */
#define ERROR_HANDLE_EOF 38 /* MSG%ERROR_BAD_UNIT */
#define ERROR_HANDLE_DISK_FULL 39 /* MSG%ERROR_NOT_READY */
/* 40%msg%ERROR_BAD_COMMAND */
/* 41%msg%ERROR_CRC */
/* 42%msg%ERROR_BAD_LENGTH */
/* 43%msg%ERROR_SEEK */
/* 44%msg%ERROR_NOT_DOS_DISK */
/* 45%msg%ERROR_SECTOR_NOT_FOUND */
/* 46%msg%ERROR_OUT_OF_PAPER */
/* 47%msg%ERROR_WRITE_FAULT */
/* 48%msg%ERROR_READ_FAULT */
/* 49%msg%ERROR_GEN_FAILURE */
#define ERROR_NOT_SUPPORTED 50 /* MSG%NET_REQ_NOT_SUPPORT */
#define ERROR_REM_NOT_LIST 51 /* MSG%NET_REMOTE_NOT_ONLINE */
#define ERROR_DUP_NAME 52 /* MSG%NET_DUP_FILENAME */
#define ERROR_BAD_NETPATH 53 /* MSG%NET_PATH_NOT_FOUND */
#define ERROR_NETWORK_BUSY 54 /* MSG%NET_BUSY */
#define ERROR_DEV_NOT_EXIST 55 /* MSG%NET_DEV_NOT_INSTALLED */
#define ERROR_TOO_MANY_CMDS 56 /* MSG%NET_BIOS_LIMIT_REACHED */
#define ERROR_ADAP_HDW_ERR 57 /* MSG%NET_ADAPT_HRDW_ERROR */
#define ERROR_BAD_NET_RESP 58 /* MSG%NET_INCORRECT_RESPONSE */
#define ERROR_UNEXP_NET_ERR 59 /* MSG%NET_UNEXPECT_ERROR */
#define ERROR_BAD_REM_ADAP 60 /* MSG%NET_REMOT_ADPT_INCOMP */
#define ERROR_PRINTQ_FULL 61 /* MSG%NET_PRINT_Q_FULL */
#define ERROR_NO_SPOOL_SPACE 62 /* MSG%NET_NO_SPACE_TO_PRINT_FL */
#define ERROR_PRINT_CANCELLED 63 /* MSG%NET_PRINT_FILE_DELETED */
#define ERROR_NETNAME_DELETED 64 /* MSG%NET_NAME_DELETED */
#define ERROR_NETWORK_ACCESS_DENIED 65 /* MSG%NET_ACCESS_DENIED */
#define ERROR_BAD_DEV_TYPE 66 /* MSG%NET_DEV_TYPE_INVALID */
#define ERROR_BAD_NET_NAME 67 /* MSG%NET_NAME_NOT_FOUND */
#define ERROR_TOO_MANY_NAMES 68 /* MSG%NET_NAME_LIMIT_EXCEED */
#define ERROR_TOO_MANY_SESS 69 /* MSG%NET_BIOS_LIMIT_EXCEED */
#define ERROR_SHARING_PAUSED 70 /* MSG%NET_TEMP_PAUSED */
#define ERROR_REQ_NOT_ACCEP 71 /* MSG%NET_REQUEST_DENIED */
#define ERROR_REDIR_PAUSED 72 /* MSG%NET_PRT_DSK_REDIR_PAUSE */
#define ERROR_SBCS_ATT_WRITE_PROT 73 /* Attempted write on protected disk */
#define ERROR_SBCS_GENERAL_FAILURE 74 /* General failure */
#define ERROR_XGA_OUT_MEMORY 75 /* MSG%XGA_OUT_MEMORY */
#define ERROR_FILE_EXISTS 80 /* MSG%FILE_EXISTS */
#define ERROR_DUP_FCB 81 /* MSG%none */
#define ERROR_CANNOT_MAKE 82 /* MSG%CANNOT_MAKE */
#define ERROR_FAIL_I24 83 /* MSG%NET_FAIL_INT_TWO_FOUR */
#define ERROR_OUT_OF_STRUCTURES 84 /* MSG%NET_TOO_MANY_REDIRECT */
#define ERROR_ALREADY_ASSIGNED 85 /* MSG%NET_DUP_REDIRECTION */
#define ERROR_INVALID_PASSWORD 86 /* MSG%NET_INVALID_PASSWORD */
#define ERROR_INVALID_PARAMETER 87 /* MSG%NET_INCORR_PARAMETER */
#define ERROR_NET_WRITE_FAULT 88 /* MSG%NET_DATA_FAULT */
#define ERROR_NO_PROC_SLOTS 89 /* MSG%NO_PROC_SLOTS */
#define ERROR_NOT_FROZEN 90 /* MSG%none */
#define ERROR_SYS_COMP_NOT_LOADED ERROR_NOT_FROZEN
#define ERR_TSTOVFL 91 /* MSG%none */
#define ERR_TSTDUP 92 /* MSG%none */
#define ERROR_NO_ITEMS 93 /* MSG%none */
#define ERROR_INTERRUPT 95 /* MSG%none */
#define ERROR_DEVICE_IN_USE 99 /* MSG%DEVICE_IN_USE */
#define ERROR_TOO_MANY_SEMAPHORES 100 /* MSG%TOO_MANY_SEMAPHORES */
#define ERROR_EXCL_SEM_ALREADY_OWNED 101 /* MSG%EXCL_SEM_ALREADY_OWNED */
#define ERROR_SEM_IS_SET 102 /* MSG%SEM_IS_SET */
#define ERROR_TOO_MANY_SEM_REQUESTS 103 /* MSG%TOO_MANY_SEM_REQUESTS */
#define ERROR_INVALID_AT_INTERRUPT_TIME 104 /* MSG%INVALID_AT_INTERRUPT_TIME */
#define ERROR_SEM_OWNER_DIED 105 /* MSG%SEM_OWNER_DIED */
#define ERROR_SEM_USER_LIMIT 106 /* MSG%ERROR_DISK_CHANGE */
#define ERROR_DISK_CHANGE 107 /* MSG%DISK_CHANGE */
#define ERROR_DRIVE_LOCKED 108 /* MSG%DRIVE_LOCKED */
#define ERROR_BROKEN_PIPE 109 /* MSG%BROKEN_PIPE */
#define ERROR_OPEN_FAILED 110 /* MSG%ERROR_OPEN_FAILED */
#define ERROR_BUFFER_OVERFLOW 111 /* MSG%ERROR_FILENAME_LONG */
#define ERROR_DISK_FULL 112 /* MSG%DISK_FULL */
#define ERROR_NO_MORE_SEARCH_HANDLES 113 /* MSG%NO_SEARCH_HANDLES */
#define ERROR_INVALID_TARGET_HANDLE 114 /* MSG%ERR_INV_TAR_HANDLE */
#define ERROR_PROTECTION_VIOLATION 115 /* MSG%none */
#define ERROR_VIOKBD_REQUEST 116 /* MSG%none */
#define ERROR_INVALID_CATEGORY 117 /* MSG%INVALID_CATEGORY */
#define ERROR_INVALID_VERIFY_SWITCH 118 /* MSG%INVALID_VERIFY_SWITCH */
#define ERROR_BAD_DRIVER_LEVEL 119 /* MSG%BAD_DRIVER_LEVEL */
#define ERROR_CALL_NOT_IMPLEMENTED 120 /* MSG%BAD_DYNALINK */
#define ERROR_SEM_TIMEOUT 121 /* MSG%SEM_TIMEOUT */
#define ERROR_INSUFFICIENT_BUFFER 122 /* MSG%INSUFFICIENT_BUFFER */
#define ERROR_INVALID_NAME 123 /* MSG%INVALID_NAME */
/* 123%msg%HPFS_INVALID_VOLUME_CHAR */
#define ERROR_INVALID_LEVEL 124 /* MSG%INVALID_LEVEL */
#define ERROR_NO_VOLUME_LABEL 125 /* MSG%NO_VOLUME_LABEL */
#define ERROR_MOD_NOT_FOUND 126 /* MSG%MOD_NOT_FOUND */
#define ERROR_PROC_NOT_FOUND 127 /* MSG%PROC_NOT_FOUND */
#define ERROR_WAIT_NO_CHILDREN 128 /* MSG%none */
#define ERROR_CHILD_NOT_COMPLETE 129 /* MSG%PROT_MODE_ONLY */
#define ERROR_DIRECT_ACCESS_HANDLE 130 /* MSG%APPL_SINGLEFRAMECHAR */
#define ERROR_NEGATIVE_SEEK 131 /* MSG%APPL_DOUBLEFRAMECHAR */
#define ERROR_SEEK_ON_DEVICE 132 /* MSG%APPL_ARROWCHAR */
#define ERROR_IS_JOIN_TARGET 133 /* MSG%JOIN_ON_DRIV_IS_TAR */
#define ERROR_IS_JOINED 134 /* MSG%JOIN_DRIVE_IS */
#define ERROR_IS_SUBSTED 135 /* MSG%SUB_DRIVE_IS */
#define ERROR_NOT_JOINED 136 /* MSG%DRIVE_IS_NOT_JOINED */
#define ERROR_NOT_SUBSTED 137 /* MSG%DRIVE_NOT_SUBSTED */
#define ERROR_JOIN_TO_JOIN 138 /* MSG%JOIN_CANNOT_JOIN_DRIVE */
#define ERROR_SUBST_TO_SUBST 139 /* MSG%SUB_CANNOT_SUBST_DRIVE */
#define ERROR_JOIN_TO_SUBST 140 /* MSG%JOIN_CANNOT_SUB_DRIVE */
#define ERROR_SUBST_TO_JOIN 141 /* MSG%SUB_CANNOT_JOIN_DRIVE */
#define ERROR_BUSY_DRIVE 142 /* MSG%DRIVE_IS_BUSY */
#define ERROR_SAME_DRIVE 143 /* MSG%JOIN_SUB_SAME_DRIVE */
#define ERROR_DIR_NOT_ROOT 144 /* MSG%DIRECT_IS_NOT_SUBDIR */
#define ERROR_DIR_NOT_EMPTY 145 /* MSG%DIRECT_IS_NOT_EMPTY */
#define ERROR_IS_SUBST_PATH 146 /* MSG%PATH_USED_SUBST_JOIN */
#define ERROR_IS_JOIN_PATH 147 /* MSG%NO_NEEDED_RESOURCES */
#define ERROR_PATH_BUSY 148 /* MSG%PATH_BUSY */
#define ERROR_IS_SUBST_TARGET 149 /* MSG%SUB_ON_DRIVE_IS_JOIN */
#define ERROR_SYSTEM_TRACE 150 /* MSG%SYSTEM_TRACE */
#define ERROR_INVALID_EVENT_COUNT 151 /* MSG%INVALID_EVENT_COUNT */
#define ERROR_TOO_MANY_MUXWAITERS 152 /* MSG%TOO_MANY_MUXWAITERS */
#define ERROR_INVALID_LIST_FORMAT 153 /* MSG%INVALID_LIST_FORMAT */
#define ERROR_LABEL_TOO_LONG 154 /* MSG%VOLUME_TOO_LONG */
/* 154%msg%HPFS_VOL_LABEL_LONG */
#define ERROR_TOO_MANY_TCBS 155 /* MSG%TOO_MANY_TCBS */
#define ERROR_SIGNAL_REFUSED 156 /* MSG%SIGNAL_REFUSED */
#define ERROR_DISCARDED 157 /* MSG%DISCARDED */
#define ERROR_NOT_LOCKED 158 /* MSG%NOT_LOCKED */
#define ERROR_BAD_THREADID_ADDR 159 /* MSG%BAD_THREADID_ADDR */
#define ERROR_BAD_ARGUMENTS 160 /* MSG%BAD_ARGUMENTS */
#define ERROR_BAD_PATHNAME 161 /* MSG%none */
#define ERROR_SIGNAL_PENDING 162 /* MSG%SIGNAL_PENDING */
#define ERROR_UNCERTAIN_MEDIA 163 /* MSG%none */
#define ERROR_MAX_THRDS_REACHED 164 /* MSG%MAX_THRDS_REACHED */
#define ERROR_MONITORS_NOT_SUPPORTED 165 /* MSG%none */
#define ERROR_UNC_DRIVER_NOT_INSTALLED 166 /* MSG%UNC_DRIVER_NOT_INSTALLED */
#define ERROR_LOCK_FAILED 167 /* MSG%LOCK_FAILED */
#define ERROR_SWAPIO_FAILED 168 /* MSG%SWAPIO_FAILED */
#define ERROR_SWAPIN_FAILED 169 /* MSG%SWAPIN_ATTEMPT_FAILED */
#define ERROR_BUSY 170 /* MSG%SEGMENT_BUSY */
/* 171%msg%INT_TOO_LONG */
#define ERROR_CANCEL_VIOLATION 173 /* MSG%UNLOCK_VIOLATION */
#define ERROR_ATOMIC_LOCK_NOT_SUPPORTED 174 /* MSG%none */
#define ERROR_READ_LOCKS_NOT_SUPPORTED 175 /* MSG%none */
#define ERROR_INVALID_SEGMENT_NUMBER 180 /* MSG%INVALID_SEGMENT_NUM */
#define ERROR_INVALID_CALLGATE 181 /* MSG%none */
#define ERROR_INVALID_ORDINAL 182 /* MSG%INVALID_ORDINAL */
#define ERROR_ALREADY_EXISTS 183 /* MSG%none */
#define ERROR_NO_CHILD_PROCESS 184 /* MSG%none */
#define ERROR_CHILD_ALIVE_NOWAIT 185 /* MSG%none */
#define ERROR_INVALID_FLAG_NUMBER 186 /* MSG%INVALID_FLAG_NUMBER */
#define ERROR_SEM_NOT_FOUND 187 /* MSG%SEM_NOT_FOUND */
#define ERROR_INVALID_STARTING_CODESEG 188 /* MSG%INVALID_STARTING_CODESEG */
#define ERROR_INVALID_STACKSEG 189 /* MSG%INVALID_STACKSEG */
#define ERROR_INVALID_MODULETYPE 190 /* MSG%INVALID_MODULETYPE */
#define ERROR_INVALID_EXE_SIGNATURE 191 /* MSG%INVALID_EXE_SIGNATURE */
#define ERROR_EXE_MARKED_INVALID 192 /* MSG%EXE_MARKED_INVALID */
#define ERROR_BAD_EXE_FORMAT 193 /* MSG%BAD_EXE_FORMAT */
#define ERROR_ITERATED_DATA_EXCEEDS_64k 194 /* MSG%ITERATED_DATA_EXCEEDS_64K */
#define ERROR_INVALID_MINALLOCSIZE 195 /* MSG%INVALID_MINALLOCSIZE */
#define ERROR_DYNLINK_FROM_INVALID_RING 196 /* MSG%DYNLINK_FROM_INVALID_RING */
#define ERROR_IOPL_NOT_ENABLED 197 /* MSG%IOPL_NOT_ENABLED */
#define ERROR_INVALID_SEGDPL 198 /* MSG%INVALID_SEGDPL */
#define ERROR_AUTODATASEG_EXCEEDS_64k 199 /* MSG%AUTODATASEG_EXCEEDS_64K */
#define ERROR_RING2SEG_MUST_BE_MOVABLE 200 /* MSG%CODESEG_CANNOT_BE_64K */
#define ERROR_RELOC_CHAIN_XEEDS_SEGLIM 201 /* MSG%RELOC_CHAIN_XEEDS_SEGMENT */
#define ERROR_INFLOOP_IN_RELOC_CHAIN 202 /* MSG%INFLOOP_IN_RELOC_CHAIN */
#define ERROR_ENVVAR_NOT_FOUND 203 /* MSG%ENVVAR_NOT_FOUND */
#define ERROR_NOT_CURRENT_CTRY 204 /* MSG%none */
#define ERROR_NO_SIGNAL_SENT 205 /* MSG%SIGNAL_NOT_SENT */
#define ERROR_FILENAME_EXCED_RANGE 206 /* MSG%NAME_TOO_LONG */
#define ERROR_RING2_STACK_IN_USE 207 /* MSG%RING2_STACK_IN_USE */
#define ERROR_META_EXPANSION_TOO_LONG 208 /* MSG%WILD_CARD_NAME */
#define ERROR_INVALID_SIGNAL_NUMBER 209 /* MSG%INVALID_SIGNAL_NUMBER */
#define ERROR_THREAD_1_INACTIVE 210 /* MSG%THREAD_1_INACTIVE */
#define ERROR_INFO_NOT_AVAIL 211 /* MSG%none */
#define ERROR_LOCKED 212 /* MSG%LOCKED */
#define ERROR_BAD_DYNALINK 213 /* MSG%none */
#define ERROR_TOO_MANY_MODULES 214 /* MSG%TOO_MANY_MODULES */
#define ERROR_NESTING_NOT_ALLOWED 215 /* MSG%none */
#define ERROR_CANNOT_SHRINK 216 /* MSG%CANNOT_SHRINK */
#define ERROR_ZOMBIE_PROCESS 217 /* MSG%none */
#define ERROR_STACK_IN_HIGH_MEMORY 218 /* MSG%none */
#define ERROR_INVALID_EXITROUTINE_RING 219 /* MSG%INVALID_EXITROUTINE_RING */
#define ERROR_GETBUF_FAILED 220 /* MSG%none */
#define ERROR_FLUSHBUF_FAILED 221 /* MSG%none */
#define ERROR_TRANSFER_TOO_LONG 222 /* MSG%none */
#define ERROR_FORCENOSWAP_FAILED 223 /* MSG%none */
#define ERROR_SMG_NO_TARGET_WINDOW 224 /* PM ID can't be selected */
#define ERROR_NO_CHILDREN 228 /* MSG%NO_CHILDREN */
#define ERROR_INVALID_SCREEN_GROUP 229 /* MSG%none */
#define ERROR_BAD_PIPE 230 /* MSG%ERROR_BAD_PIPE */
#define ERROR_PIPE_BUSY 231 /* MSG%ERROR_PIPE_BUSY */
#define ERROR_NO_DATA 232 /* MSG%ERROR_NO_DATA */
#define ERROR_PIPE_NOT_CONNECTED 233 /* MSG%ERROR_PIPE_NOT_CONNECTED */
#define ERROR_MORE_DATA 234 /* MSG%ERROR_MORE_DATA */
#define ERROR_VC_DISCONNECTED 240 /* MSG%ERROR_VC_DISCONNECTED */
#define ERROR_CIRCULARITY_REQUESTED 250 /* MSG%CIRCULARITY_REQUESTED */
#define ERROR_DIRECTORY_IN_CDS 251 /* MSG%DIRECTORY_IN_CDS */
#define ERROR_INVALID_FSD_NAME 252 /* MSG%INVALID_FSD_NAME */
#define ERROR_INVALID_PATH 253 /* MSG%INVALID_PATH */
#define ERROR_INVALID_EA_NAME 254 /* MSG%INVALID_EA_NAME */
#define ERROR_EA_LIST_INCONSISTENT 255 /* MSG%EA_LIST_INCONSISTENT */
#define ERROR_EA_LIST_TOO_LONG 256 /* MSG%EA_LIST_TOO_LONG */
#define ERROR_NO_META_MATCH 257 /* MSG%NO_META_MATCH */
#define ERROR_FINDNOTIFY_TIMEOUT 258 /* MSG%FINDNOTIFY_TIMEOUT */
#define ERROR_NO_MORE_ITEMS 259 /* MSG%NO_MORE_ITEMS */
#define ERROR_SEARCH_STRUC_REUSED 260 /* MSG%SEARCH_STRUC_REUSED */
#define ERROR_CHAR_NOT_FOUND 261 /* MSG%CHAR_NOT_FOUND */
#define ERROR_TOO_MUCH_STACK 262 /* MSG%TOO_MUCH_STACK */
#define ERROR_INVALID_ATTR 263 /* MSG%INVALID_ATTR */
#define ERROR_INVALID_STARTING_RING 264 /* MSG%INVALID_STARTING_RING */
#define ERROR_INVALID_DLL_INIT_RING 265 /* MSG%INVALID_DLL_INIT_RING */
#define ERROR_CANNOT_COPY 266 /* MSG%CANNOT_COPY */
#define ERROR_DIRECTORY 267 /* MSG%DIRECTORY */
#define ERROR_OPLOCKED_FILE 268 /* MSG%OPLOCKED_FILE */
#define ERROR_OPLOCK_THREAD_EXISTS 269 /* MSG%OPLOCK_THREAD_EXISTS */
#define ERROR_VOLUME_CHANGED 270 /* MSG%none */
#define ERROR_FINDNOTIFY_HANDLE_IN_USE 271 /* MSG%none */
#define ERROR_FINDNOTIFY_HANDLE_CLOSED 272 /* MSG%none */
#define ERROR_NOTIFY_OBJECT_REMOVED 273 /* MSG%none */
#define ERROR_ALREADY_SHUTDOWN 274 /* MSG%none */
#define ERROR_EAS_DIDNT_FIT 275 /* MSG%none */
#define ERROR_EA_FILE_CORRUPT 276 /* MSG%ERROR_EAS_CORRUPT */
#define ERROR_EA_TABLE_FULL 277 /* MSG%EA_TABLE_FULL */
#define ERROR_INVALID_EA_HANDLE 278 /* MSG%INVALID_EA_HANDLE */
#define ERROR_NO_CLUSTER 279 /* MSG%NO_CLUSTER */
#define ERROR_CREATE_EA_FILE 280 /* MSG%ERROR_CREATE_EA_FILE */
#define ERROR_CANNOT_OPEN_EA_FILE 281 /* MSG%CANNOT_OPEN_FILE */
#define ERROR_EAS_NOT_SUPPORTED 282 /* MSG%EAS_NOT_SUPPORTED */
#define ERROR_NEED_EAS_FOUND 283 /* MSG%NEED_EAS_FOUND */
#define ERROR_DUPLICATE_HANDLE 284 /* MSG%EAS_DISCARDED */
#define ERROR_DUPLICATE_NAME 285 /* MSG%DUPLICATE_SEM_NAME */
#define ERROR_EMPTY_MUXWAIT 286 /* MSG%EMPTY_MUXWAIT_SEM */
#define ERROR_MUTEX_OWNED 287 /* MSG%MUTEX_SEM_OWNED */
#define ERROR_NOT_OWNER 288 /* MSG%NOT_MUTEX_SEM_OWNER */
#define ERROR_PARAM_TOO_SMALL 289 /* MSG%QUERY_MUX_PARAM_TOO_SMALL */
#define ERROR_TOO_MANY_HANDLES 290 /* MSG%TOO_MANY_SEM_HANDLES */
#define ERROR_TOO_MANY_OPENS 291 /* MSG%TOO_MANY_SEM_OPENS */
#define ERROR_WRONG_TYPE 292 /* MSG%SEM_WRONG_TYPE */
#define ERROR_UNUSED_CODE 293 /* MSG%none */
#define ERROR_THREAD_NOT_TERMINATED 294 /* MSG%none */
#define ERROR_INIT_ROUTINE_FAILED 295 /* MSG%none */
#define ERROR_MODULE_IN_USE 296 /* MSG%none */
#define ERROR_NOT_ENOUGH_WATCHPOINTS 297 /* MSG%none */
#define ERROR_TOO_MANY_POSTS 298 /* MSG%TOO_MANY_EVENT_SEM_POSTS */
#define ERROR_ALREADY_POSTED 299 /* MSG%EVENT_SEM_ALREADY_POSTED */
#define ERROR_ALREADY_RESET 300 /* MSG%EVENT_SEM_ALREADY_RESET */
#define ERROR_SEM_BUSY 301 /* MSG%SEM_BUSY */

View file

@ -0,0 +1,53 @@
/* This file conains common OS/2 types that are needed to build this dll */
/* this file should have temporal character until a better idea is born */
#ifndef __OS2DEF__
#define __OS2DEF__
typedef unsigned long APIRET;
#define APIENTRY
typedef char *PSZ;
typedef char *NPSZ;
typedef char *NPCH;
#define VOID void
//
/* define these types only when ntdll is not included */
#if( !defined( __INCLUDE_NTDEF_H ))
#define CHAR char
#define SHORT short
#define LONG long
typedef char BYTE;
typedef unsigned char UCHAR;
typedef unsigned short USHORT;
typedef unsigned long ULONG;
typedef CHAR *PCHAR;
typedef SHORT *PSHORT;
typedef LONG *PLONG;
typedef UCHAR *PUCHAR;
typedef USHORT *PUSHORT;
typedef ULONG *PULONG;
typedef VOID *PVOID;
#endif
//typedef char *PCH;
//typedef const char *PCSZ;
typedef unsigned long LHANDLE;
typedef LHANDLE HMODULE; /* hmod */
typedef LHANDLE PID; /* pid */
typedef LHANDLE TID; /* tid */
typedef LHANDLE HFILE;
typedef HFILE *PHFILE;
typedef HMODULE *PHMODULE;
typedef PID *PPID;
typedef TID *PTID;
typedef VOID APIENTRY FNTHREAD(ULONG);
typedef FNTHREAD *PFNTHREAD;
#endif //__OS2DEF__

View file

@ -0,0 +1,17 @@
/* Terminates the current thread or the current Process.
Decission is made by action
FIXME: move this code to OS2.EXE */
VOID APIENTRY Dos32Exit(ULONG action, ULONG result)
{
// decide what to do
if( action == EXIT_THREAD)
{
NtTerminateThread( NULL, result );
}
else // EXIT_PROCESS
{
NtTerminateProcess( NULL, result );
}
}

29
os2/server/makefile Normal file
View file

@ -0,0 +1,29 @@
# $Id: makefile,v 1.1 2002/03/23 19:23:28 robertk Exp $
PATH_TO_TOP = ../../..
TARGET_TYPE = program
TARGET_APPTYPE = native
TARGET_NAME = os2ss
TARGET_INSTALLDIR = system32
TARGET_CFLAGS = -D__NTAPP__
#OBJECTS_API =
OBJECTS_MISC = \
$(TARGET_NAME).o
TARGET_OBJECTS = \
$(OBJECTS_API)
# \
# $(OBJECTS_MISC)
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

115
os2/server/os2ss.cpp Normal file
View file

@ -0,0 +1,115 @@
/* $Id: os2ss.cpp,v 1.1 2002/03/23 19:23:28 robertk Exp $
*
* reactos/subsys/csrss/api/process.c
*
* "\windows\ApiPort" port process management functions
*
* ReactOS Operating System
*/
// TODO: Rewrite the whole file. This is just a copy
#include <ddk/ntddk.h>
#include <ntdll/rtl.h>
/* server variables */
int NumProcesses;
/* Native image's entry point */
void NtProcessStartup (PPEB Peb)
{
PRTL_USER_PROCESS_PARAMETERS ProcParams;
PWSTR ArgBuffer;
PWSTR *argv;
ULONG argc = 0;
int i = 0;
int afterlastspace = 0;
OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE CsrssInitEvent;
UNICODE_STRING UnicodeString;
NTSTATUS Status;
ProcParams = RtlNormalizeProcessParams (Peb->ProcessParameters);
argv = (PWSTR *)RtlAllocateHeap (Peb->ProcessHeap,
0, 512 * sizeof(PWSTR));
ArgBuffer = (PWSTR)RtlAllocateHeap (Peb->ProcessHeap,
0,
ProcParams->CommandLine.Length + sizeof(WCHAR));
memcpy (ArgBuffer,
ProcParams->CommandLine.Buffer,
ProcParams->CommandLine.Length + sizeof(WCHAR));
while (ArgBuffer[i])
{
if (ArgBuffer[i] == L' ')
{
argc++;
ArgBuffer[i] = L'\0';
argv[argc-1] = &(ArgBuffer[afterlastspace]);
i++;
while (ArgBuffer[i] == L' ')
i++;
afterlastspace = i;
}
else
{
i++;
}
}
if (ArgBuffer[afterlastspace] != L'\0')
{
argc++;
ArgBuffer[i] = L'\0';
argv[argc-1] = &(ArgBuffer[afterlastspace]);
}
RtlInitUnicodeString(&UnicodeString,
L"\\CsrssInitDone");
InitializeObjectAttributes(&ObjectAttributes,
&UnicodeString,
EVENT_ALL_ACCESS,
0,
NULL);
Status = NtOpenEvent(&CsrssInitEvent,
EVENT_ALL_ACCESS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
DbgPrint("CSR: Failed to open csrss notification event\n");
}
if (CsrServerInitialization (argc, argv) == TRUE)
{
NtSetEvent(CsrssInitEvent,
NULL);
RtlFreeHeap (Peb->ProcessHeap,
0, argv);
RtlFreeHeap (Peb->ProcessHeap,
0,
ArgBuffer);
/* terminate the current thread only */
NtTerminateThread( NtCurrentThread(), 0 );
}
else
{
DisplayString( L"CSR: Subsystem initialization failed.\n" );
RtlFreeHeap (Peb->ProcessHeap,
0, argv);
RtlFreeHeap (Peb->ProcessHeap,
0,
ArgBuffer);
/*
* Tell SM we failed.
*/
NtTerminateProcess( NtCurrentProcess(), 0 );
}

558
os2/utils/EXE386.H Normal file
View file

@ -0,0 +1,558 @@
#ifndef __LX_EXE__
#define __LX_EXE__
#pragma pack(1) /* Force byte alignment */
/*_________________________________________________________________*
| |
| |
| OS/2 .EXE FILE HEADER DEFINITION - 386 version 0:32 |
| |
|_________________________________________________________________|
* */
#define BITPERWORD 16
#define BITPERBYTE 8
#define OBJPAGELEN 4096
#define E32MAGIC 0x584c /* New magic number "LX" */
#define E32RESBYTES1 0 /* First bytes reserved */
#define E32RESBYTES2 0 /* Second bytes reserved */
#define E32RESBYTES3 20 /* Third bytes reserved */
#define E32LEBO 0x00 /* Little Endian Byte Order */
#define E32BEBO 0x01 /* Big Endian Byte Order */
#define E32LEWO 0x00 /* Little Endian Word Order */
#define E32BEWO 0x01 /* Big Endian Word Order */
#define E32LEVEL 0L /* 32-bit EXE format level */
#define E32CPU286 0x001 /* Intel 80286 or upwardly compatibile */
#define E32CPU386 0x002 /* Intel 80386 or upwardly compatibile */
#define E32CPU486 0x003 /* Intel 80486 or upwardly compatibile */
struct lx_exe /* New 32-bit .EXE header for OS/2 EXEs and DLLs*/
{
unsigned short magic; /* Magic number E32_MAGIC */
unsigned char border; /* The byte ordering for the .EXE */
unsigned char worder; /* The word ordering for the .EXE */
unsigned long level; /* The EXE format level for now = 0 */
unsigned short cpu; /* The CPU type */
unsigned short os; /* The OS type */
unsigned long ver; /* Module version */
unsigned long mflags; /* Module flags */
unsigned long mpages; /* Module # pages */
unsigned long startobj; /* Object # for instruction pointer */
unsigned long eip; /* Extended instruction pointer */
unsigned long stackobj; /* Object # for stack pointer */
unsigned long esp; /* Extended stack pointer */
unsigned long pagesize; /* .EXE page size */
unsigned long pageshift; /* Page alignment shift in .EXE */
unsigned long fixupsize; /* Fixup section size */
unsigned long fixupsum; /* Fixup section checksum */
unsigned long ldrsize; /* Loader section size */
unsigned long ldrsum; /* Loader section checksum */
unsigned long objtab; /* Object table offset */
unsigned long objcnt; /* Number of objects in module */
unsigned long objmap; /* Object page map offset */
unsigned long itermap; /* Object iterated data map offset */
unsigned long rsrctab; /* Offset of Resource Table */
unsigned long rsrccnt; /* Number of resource entries */
unsigned long restab; /* Offset of resident name table */
unsigned long enttab; /* Offset of Entry Table */
unsigned long dirtab; /* Offset of Module Directive Table */
unsigned long dircnt; /* Number of module directives */
unsigned long fpagetab; /* Offset of Fixup Page Table */
unsigned long frectab; /* Offset of Fixup Record Table */
unsigned long impmod; /* Offset of Import Module Name Table */
unsigned long impmodcnt; /* Number of entries in Import Module Name Table */
unsigned long impproc; /* Offset of Import Procedure Name Table */
unsigned long pagesum; /* Offset of Per-Page Checksum Table */
unsigned long datapage; /* Offset of Enumerated Data Pages */
unsigned long preload; /* Number of preload pages */
unsigned long nrestab; /* Offset of Non-resident Names Table */
unsigned long cbnrestab; /* Size of Non-resident Name Table */
unsigned long nressum; /* Non-resident Name Table Checksum */
unsigned long autodata; /* Object # for automatic data object */
unsigned long debuginfo; /* Offset of the debugging information */
unsigned long debuglen; /* The length of the debugging info. in bytes */
unsigned long instpreload;/* Number of instance pages in preload section of .EXE file */
unsigned long instdemand; /* Number of instance pages in demand load section of .EXE file */
unsigned long heapsize; /* Size of heap - for 16-bit apps */
unsigned long stacksize; /* Size of stack */
unsigned char res3[E32RESBYTES3];
/* Pad structure to 196 bytes */
};
/*
* Format of lx_exe.mflags:
*
* Low word has the following format:
*
* 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 - bit no
* | | | | | | | |
* | | | | | | | +------- Per-Process Library Initialization
* | | | | | | +--------- SystemDLL (internal fixups discarded)
* | | | | | +----------- No Internal Fixups for Module in .EXE
* | | | | +------------- No External Fixups for Module in .EXE
* | | | +------------------- Incompatible with PM Windowing
* | | +--------------------- Compatible with PM Windowing
* | | Uses PM Windowing API
* | +-------------------------------- Module not Loadable
* +-------------------------------------- Library Module
*/
#define E32NOTP 0x8000L /* Library Module - used as NENOTP */
#define E32NOLOAD 0x2000L /* Module not Loadable */
#define E32PMAPI 0x0300L /* Uses PM Windowing API */
#define E32PMW 0x0200L /* Compatible with PM Windowing */
#define E32NOPMW 0x0100L /* Incompatible with PM Windowing */
#define E32NOEXTFIX 0x0020L /* NO External Fixups in .EXE */
#define E32NOINTFIX 0x0010L /* NO Internal Fixups in .EXE */
#define E32SYSDLL 0x0008L /* System DLL, Internal Fixups discarded*/
#define E32LIBINIT 0x0004L /* Per-Process Library Initialization */
#define E32LIBTERM 0x40000000L /* Per-Process Library Termination */
#define E32APPMASK 0x0300L /* Application Type Mask */
/*
* Format of E32_MFLAGS(x):
*
* High word has the following format:
*
* 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 - bit no
* | |
* | +--- Protected memory library module
* +----- Device driver
*/
#define E32PROTDLL 0x10000L /* Protected memory library module */
#define E32DEVICE 0x20000L /* Device driver */
#define E32MODEXE 0x00000L /* .EXE module */
#define E32MODDLL 0x08000L /* .DLL module */
#define E32MODPROTDLL 0x18000L /* Protected memory library module */
#define E32MODPDEV 0x20000L /* Physical device driver */
#define E32MODVDEV 0x28000L /* Virtual device driver */
#define E32MODMASK 0x38000L /* Module type mask */
/*
* RELOCATION DEFINITIONS - RUN-TIME FIXUPS
*/
typedef union _offset
{
unsigned short offset16;
unsigned long offset32;
}
offset; /* 16-bit or 32-bit offset */
/***ET+ r32_rlc - Relocation item */
struct r32_rlc /* Relocation item */
{
unsigned char nr_stype; /* Source type - field shared with new_rlc */
unsigned char nr_flags; /* Flag byte - field shared with new_rlc */
short r32_soff; /* Source offset */
unsigned short r32_objmod; /* Target object number or Module ordinal */
union targetid
{
offset intref; /* Internal fixup */
union extfixup
{
offset proc; /* Procedure name offset */
unsigned long ord; /* Procedure odrinal */
}
extref; /* External fixup */
struct addfixup
{
unsigned short entry; /* Entry ordinal */
offset addval; /* Value added to the address */
}
addfix; /* Additive fixup */
}
r32_target; /* Target data */
unsigned short r32_srccount; /* Number of chained fixup records */
unsigned short r32_chain; /* Chain head */
};
/*
* In 32-bit .EXE file run-time relocations are written as varying size
* records, so we need many size definitions.
*/
#define RINTSIZE16 8
#define RINTSIZE32 10
#define RORDSIZE 8
#define RNAMSIZE16 8
#define RNAMSIZE32 10
#define RADDSIZE16 10
#define RADDSIZE32 12
#if FALSE
/*
* Access macros defined in NEWEXE.H !!!
*/
#define NR_STYPE(x) (x).nr_stype
#define NR_FLAGS(x) (x).nr_flags
#endif
#define R32_SOFF(x) (x).r32_soff
#define R32_OBJNO(x) (x).r32_objmod
#define R32_MODORD(x) (x).r32_objmod
#define R32_OFFSET16(x) (x).r32_target.intref.offset16
#define R32_OFFSET32(x) (x).r32_target.intref.offset32
#define R32_PROCOFF16(x) (x).r32_target.extref.proc.offset16
#define R32_PROCOFF32(x) (x).r32_target.extref.proc.offset32
#define R32_PROCORD(x) (x).r32_target.extref.ord
#define R32_ENTRY(x) (x).r32_target.addfix.entry
#define R32_ADDVAL16(x) (x).r32_target.addfix.addval.offset16
#define R32_ADDVAL32(x) (x).r32_target.addfix.addval.offset32
#define R32_SRCCNT(x) (x).r32_srccount
#define R32_CHAIN(x) (x).r32_chain
/*
* Format of NR_STYPE(x)
*
* 7 6 5 4 3 2 1 0 - bit no
* | | | | | |
* | | +-+-+-+--- Source type
* | +----------- Fixup to 16:16 alias
* +------------- List of source offset follows fixup record
*/
#if FALSE
/* DEFINED in newexe.h !!! */
#define NRSTYP 0x0f /* Source type mask */
#define NRSBYT 0x00 /* lo byte (8-bits)*/
#define NRSSEG 0x02 /* 16-bit segment (16-bits) */
#define NRSPTR 0x03 /* 16:16 pointer (32-bits) */
#define NRSOFF 0x05 /* 16-bit offset (16-bits) */
#define NRPTR48 0x06 /* 16:32 pointer (48-bits) */
#define NROFF32 0x07 /* 32-bit offset (32-bits) */
#define NRSOFF32 0x08 /* 32-bit self-relative offset (32-bits) */
#endif
#define NRSRCMASK 0x0f /* Source type mask */
#define NRALIAS 0x10 /* Fixup to alias */
#define NRCHAIN 0x20 /* List of source offset follows */
/* fixup record, source offset field */
/* in fixup record contains number */
/* of elements in list */
/*
* Format of NR_FLAGS(x) and R32_FLAGS(x):
*
* 7 6 5 4 3 2 1 0 - bit no
* | | | | | | |
* | | | | | +-+--- Reference type
* | | | | +------- Additive fixup
* | | | +----------- 32-bit Target Offset Flag (1 - 32-bit; 0 - 16-bit)
* | | +------------- 32-bit Additive Flag (1 - 32-bit; 0 - 16-bit)
* | +--------------- 16-bit Object/Module ordinal (1 - 16-bit; 0 - 8-bit)
* +----------------- 8-bit import ordinal (1 - 8-bit;
* 0 - NR32BITOFF toggles
* between 16 and 32 bit
* ordinal)
*/
#if FALSE
/* DEFINED in newexe.h !!! */
#define NRRTYP 0x03 /* Reference type mask */
#define NRRINT 0x00 /* Internal reference */
#define NRRORD 0x01 /* Import by ordinal */
#define NRRNAM 0x02 /* Import by name */
#define NRADD 0x04 /* Additive fixup */
#endif
#define NRRENT 0x03 /* Internal entry table fixup */
#define NR32BITOFF 0x10 /* 32-bit Target Offset */
#define NR32BITADD 0x20 /* 32-bit Additive fixup */
#define NR16OBJMOD 0x40 /* 16-bit Object/Module ordinal */
#define NR8BITORD 0x80 /* 8-bit import ordinal */
/*end*/
/*
* Data structures for storing run-time fixups in linker virtual memory.
*
* Each object has a list of Object Page Directories which specify
* fixups for given page. Each page has its own hash table which is
* used to detect fixups to the same target.
*/
#define PAGEPERDIR 62
#define LG2DIR 7
typedef struct _OBJPAGEDIR
{
DWORD next; /* Virtual pointer to next dir on list */
WORD ht[PAGEPERDIR]; /* Pointers to individual hash tables */
}
OBJPAGEDIR;
/*
* OBJECT TABLE
*/
/***ET+ o32_obj Object Table Entry */
struct o32_obj /* Flat .EXE object table entry */
{
unsigned long o32_size; /* Object virtual size */
unsigned long o32_base; /* Object base virtual address */
unsigned long o32_flags; /* Attribute flags */
unsigned long o32_pagemap; /* Object page map index */
unsigned long o32_mapsize; /* Number of entries in object page map */
unsigned long o32_reserved; /* Reserved */
};
#define O32_SIZE(x) (x).o32_size
#define O32_BASE(x) (x).o32_base
#define O32_FLAGS(x) (x).o32_flags
#define O32_PAGEMAP(x) (x).o32_pagemap
#define O32_MAPSIZE(x) (x).o32_mapsize
#define O32_RESERVED(x) (x).o32_reserved
/*
* Format of O32_FLAGS(x)
*
* High word of dword flag field is not used for now.
* Low word has the following format:
*
* 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 - bit no
* | | | | | | | | | | | | | | |
* | | | | | | | | | | | | | | +--- Readable Object
* | | | | | | | | | | | | | +----- Writeable Object
* | | | | | | | | | | | | +------- Executable Object
* | | | | | | | | | | | +--------- Resource Object
* | | | | | | | | | | +----------- Object is Discardable
* | | | | | | | | | +------------- Object is Shared
* | | | | | | | | +--------------- Object has preload pages
* | | | | | | | +----------------- Object has invalid pages
* | | | | | | +------------------- Object is permanent and swappable
* | | | | | +--------------------- Object is permanent and resident
* | | | | +----------------------- Object is permanent and long lockable
* | | | +----------------------------- 16:16 alias required (80x86 specific)
* | | +-------------------------------- Big/Default bit setting (80x86 specific)
* | +----------------------------------- Object is conforming for code (80x86 specific)
* +-------------------------------------- Object I/O privilege level (80x86 specific)
*
*/
#define OBJREAD 0x0001L /* Readable Object */
#define OBJWRITE 0x0002L /* Writeable Object */
#define OBJRSRC 0x0008L /* Resource Object */
#define OBJINVALID 0x0080L /* Object has invalid pages */
#define LNKNONPERM 0x0600L /* Object is nonpermanent - should be */
#define OBJNONPERM 0x0000L /* zero in the .EXE but LINK386 uses 6 */
#define OBJPERM 0x0100L /* Object is permanent and swappable */
#define OBJRESIDENT 0x0200L /* Object is permanent and resident */
#define OBJCONTIG 0x0300L /* Object is resident and contiguous */
#define OBJDYNAMIC 0x0400L /* Object is permanent and long locable */
#define OBJTYPEMASK 0x0700L /* Object type mask */
#define OBJALIAS16 0x1000L /* 16:16 alias required (80x86 specific) */
#define OBJBIGDEF 0x2000L /* Big/Default bit setting (80x86 specific) */
#define OBJIOPL 0x8000L /* Object I/O privilege level (80x86 specific) */
#if FOR_EXEHDR
/*
* Name these flags differently for EXEHDR.EXE - avoid conflicts with 286 version
*/
#define OBJDISCARD 0x0010L /* Object is Discardable */
#define OBJSHARED 0x0020L /* Object is Shared */
#define OBJPRELOAD 0x0040L /* Object has preload pages */
#define OBJEXEC 0x0004L /* Executable Object */
#define OBJCONFORM 0x4000L /* Object is conforming for code (80x86 specific) */
#else
/*
* Life will be easier, if we keep the same names for the following flags:
*/
#define NSDISCARD 0x0010L /* Object is Discardable */
#define NSMOVE NSDISCARD /* Moveable object is for sure Discardable */
#define NSSHARED 0x0020L /* Object is Shared */
#define NSPRELOAD 0x0040L /* Object has preload pages */
#define NSEXRD 0x0004L /* Executable Object */
#define NSCONFORM 0x4000L /* Object is conforming for code (80x86 specific) */
#endif
/*end*/
/***ET+ o32_map - Object Page Map entry */
struct o32_map /* Object Page Table entry */
{
unsigned long o32_pagedataoffset; /* file offset of page */
unsigned short o32_pagesize; /* # bytes of page data */
unsigned short o32_pageflags; /* Per-Page attributes */
};
#define GETPAGEIDX(x) ((x).o32_pagedataoffset)
#define PUTPAGEIDX(x,i) ((x).o32_pagedataoffset = ((unsigned long)(i)))
#define PUTPAGESIZ(x,i) ((x).o32_pagesize = ((unsigned int)(i)))
#define GETPAGESIZ(x) ((x).o32_pagesize)
#define PAGEFLAGS(x) (x).o32_pageflags
#define VALID 0x0000 /* Valid Physical Page in .EXE */
#define ITERDATA 0x0001 /* Iterated Data Page */
#define INVALID 0x0002 /* Invalid Page */
#define ZEROED 0x0003 /* Zero Filled Page */
#define RANGE 0x0004 /* Range of pages */
#define ITERDATA2 0x0005 /* Iterated Data Page Type II */
/*end*/
/*
* RESOURCE TABLE
*/
/***ET+ rsrc32 - Resource Table Entry */
struct rsrc32 /* Resource Table Entry */
{
unsigned short type; /* Resource type */
unsigned short name; /* Resource name */
unsigned long cb; /* Resource size */
unsigned short obj; /* Object number */
unsigned long offset; /* Offset within object */
};
/*end*/
/*
* Iteration Record format for 'EXEPACK'ed pages.
*/
struct LX_Iter
{
unsigned short LX_nIter; /* number of iterations */
unsigned short LX_nBytes; /* number of bytes */
unsigned char LX_Iterdata; /* iterated data byte(s) */
};
/*
* ENTRY TABLE DEFINITIONS
*/
/***ET+ b32_bundle - Entry Table */
struct b32_bundle
{
unsigned char b32_cnt; /* Number of entries in this bundle */
unsigned char b32_type; /* Bundle type */
unsigned short b32_obj; /* Object number */
}; /* Follows entry types */
struct e32_entry
{
unsigned char e32_flags; /* Entry point flags */
union entrykind
{
offset e32_offset; /* 16-bit/32-bit offset entry */
struct callgate
{
unsigned short offset; /* Offset in segment */
unsigned short callgate; /* Callgate selector */
}
e32_callgate; /* 286 (16-bit) call gate */
struct fwd
{
unsigned short modord; /* Module ordinal number */
unsigned long value; /* Proc name offset or ordinal */
}
e32_fwd; /* Forwarder */
}
e32_variant; /* Entry variant */
};
#define B32_CNT(x) (x).b32_cnt
#define B32_TYPE(x) (x).b32_type
#define B32_OBJ(x) (x).b32_obj
#define E32_EFLAGS(x) (x).e32_flags
#define E32_OFFSET16(x) (x).e32_variant.e32_offset.offset16
#define E32_OFFSET32(x) (x).e32_variant.e32_offset.offset32
#define E32_GATEOFF(x) (x).e32_variant.e32_callgate.offset
#define E32_GATE(x) (x).e32_variant.e32_callgate.callgate
#define E32_MODORD(x) (x).e32_variant.e32_fwd.modord
#define E32_VALUE(x) (x).e32_variant.e32_fwd.value
#define FIXENT16 3
#define FIXENT32 5
#define GATEENT16 5
#define FWDENT 7
/*
* BUNDLE TYPES
*/
#define EMPTY 0x00 /* Empty bundle */
#define ENTRY16 0x01 /* 16-bit offset entry point */
#define GATE16 0x02 /* 286 call gate (16-bit IOPL) */
#define ENTRY32 0x03 /* 32-bit offset entry point */
#define ENTRYFWD 0x04 /* Forwarder entry point */
#define TYPEINFO 0x80 /* Typing information present flag */
/*
* Format for E32_EFLAGS(x)
*
* 7 6 5 4 3 2 1 0 - bit no
* | | | | | | | |
* | | | | | | | +--- exported entry
* | | | | | | +----- uses shared data
* +-+-+-+-+-+------- parameter word count
*/
#define E32EXPORT 0x01 /* Exported entry */
#define E32SHARED 0x02 /* Uses shared data */
#define E32PARAMS 0xf8 /* Parameter word count mask */
/*
* Flags for forwarders only:
*/
#define FWD_ORDINAL 0x01 /* Imported by ordinal */
#pragma pack() /* Restore default alignment */
/*end*/
#endif /* __LX_EXE__ */

BIN
os2/utils/LXDUMP.EXE Normal file

Binary file not shown.

BIN
os2/utils/lxtest.EXE Normal file

Binary file not shown.