Changed RtlCopyMemory() from function to macro

Improved system service table code

svn path=/trunk/; revision=995
This commit is contained in:
Eric Kohl
2000-02-21 22:44:37 +00:00
parent 151f2f646e
commit d1341007cf
24 changed files with 645 additions and 732 deletions
+1 -4
View File
@@ -8,12 +8,9 @@
*/
#include <ddk/ntddk.h>
#include <wchar.h>
#include <internal/string.h>
#include <ddk/ntddk.h>
#include <ddk/cctypes.h>
#include <ddk/zwtypes.h>
//#include <ddk/rtl.h>
#define NDEBUG
#include <internal/debug.h>
+1 -2
View File
@@ -8,11 +8,10 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <ctype.h>
#include <wchar.h>
#include <internal/string.h>
#include <ddk/ntddk.h>
#include <ddk/cctypes.h>
#define NDEBUG
#include <internal/debug.h>
+2 -3
View File
@@ -1,4 +1,4 @@
/* $Id: iface.c,v 1.40 1999/12/22 14:48:28 dwelch Exp $
/* $Id: iface.c,v 1.41 2000/02/21 22:42:15 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -22,10 +22,9 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <wchar.h>
#include <internal/string.h>
#include <ddk/ntddk.h>
#include <ddk/cctypes.h>
#define NDEBUG
#include <internal/debug.h>
+3 -2
View File
@@ -1,2 +1,3 @@
mktab
mktab.exe
genw32k
genw32k.exe
+347
View File
@@ -0,0 +1,347 @@
/* $Id: genw32k.c,v 1.1 2000/02/21 22:34:26 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS version of ntdll
* FILE: iface/native/genntdll.c
* PURPOSE: Generates the system call stubs in ntdll
* CHANGE HISTORY: Added a '@xx' to deal with stdcall [ Ariadne ]
* 19990616 (ea)
* Four arguments now required; 4th is the file
* for ntoskrnl ZwXXX functions (which are merely calls
* to twin NtXXX calls, via int 0x2e (x86).
* 19990617 (ea)
* Fixed a bug in function numbers in kernel ZwXXX stubs.
*
*/
/* INCLUDE ******************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define PARAMETERIZED_LIBS
#define VERBOSE
#define INPUT_BUFFER_SIZE 255
#define INDEX 0x1000 /* SSDT index 1 */
/* FUNCTIONS ****************************************************************/
int makeSystemServiceTable(FILE *in, FILE *out)
{
char line [INPUT_BUFFER_SIZE];
char *s;
char *name;
int sys_call_idx;
char *nr_args;
char *stmp;
/*
* Main SSDT Header
*/
fprintf(out,"// Machine generated, don't edit\n");
fprintf(out,"\n\n");
/*
* First we build the Win32k SSDT
*/
fprintf(out,"SSDT Win32kSSDT[] = {\n");
/* First system call has index zero */
sys_call_idx = 0;
/* Go on until EOF or read zero bytes */
while ((!feof(in))&& (fgets(line, sizeof line, in) != NULL))
{
if ((s = (char *) strchr(line,'\r')) != NULL)
{
*s = '\0';
}
/*
* Skip comments (#) and empty lines.
*/
s = & line[0];
if ((*s) != '#' && (*s) != '\0')
{
/* Extract the NtXXX name */
name = (char *)strtok(s," \t");
/* Extract the stack size */
nr_args = (char *)strtok(NULL," \t");
/*
* Remove, if present, the trailing LF.
*/
if ((stmp = strchr(nr_args, '\n')) != NULL)
{
*stmp = '\0';
}
#ifdef VERBOSE
printf("%3d \"%s\"\n",sys_call_idx | INDEX,name);
#endif
if (sys_call_idx > 0)
{
fprintf(out,",\n");
}
/*
* Now write the current system call's name
* in the service table.
*/
fprintf(out,"\t\t{ (ULONG)%s }",name);
/* Next system call index */
sys_call_idx++;
}
}
/* Close the service table (C syntax) */
fprintf(out,"\n};\n");
/*
* Now we build the Win32k SSPT
*/
rewind(in);
fprintf(out,"\n\n");
fprintf(out,"SSPT Win32kSSPT[] = {\n");
/* First system call has index zero */
sys_call_idx = 0;
/* Go on until EOF or read zero bytes */
while ((!feof(in))&& (fgets(line, sizeof line, in) != NULL))
{
if ((s = (char *) strchr(line,'\r')) != NULL)
{
*s = '\0';
}
/*
* Skip comments (#) and empty lines.
*/
s = & line[0];
if ((*s) != '#' && (*s) != '\0')
{
/* Extract the NtXXX name */
name = (char *)strtok(s," \t");
/* Extract the stack size */
nr_args = (char *)strtok(NULL," \t");
/*
* Remove, if present, the trailing LF.
*/
if ((stmp = strchr(nr_args, '\n')) != NULL)
{
*stmp = '\0';
}
#ifdef VERBOSE
printf("%3d \"%s\"\n",sys_call_idx|INDEX,name);
#endif
if (sys_call_idx > 0)
{
fprintf(out,",\n");
}
/*
* Now write the current system call's ID
* in the service table along with its Parameters Size.
*/
fprintf(out,"\t\t{ %d }",atoi(nr_args) * sizeof(void*));
/* Next system call index */
sys_call_idx++;
}
}
/*
* Close the service table (C syntax)
*/
fprintf(out,"\n};\n");
/*
* We write some useful defines
*/
fprintf(out, "\n\n#define MIN_SYSCALL_NUMBER 0\n");
fprintf(out, "#define MAX_SYSCALL_NUMBER %d\n", sys_call_idx-1);
fprintf(out, "#define NUMBER_OF_SYSCALLS %d\n", sys_call_idx);
return(0);
}
int
process(
FILE * in,
FILE * out1,
FILE * out2
)
{
char line [INPUT_BUFFER_SIZE];
char * s;
char * name; /* NtXXX name */
int sys_call_idx; /* NtXXX index number in the service table */
char * nr_args; /* stack_size / machine_word_size */
char * stmp;
int stacksize;
/*
* GDI32 stubs file header
*/
fprintf(out1,"// Machine generated, don't edit\n");
fprintf(out1,"\n\n");
/*
* USER32 stubs file header
*/
fprintf(out2,"// Machine generated, don't edit\n");
fprintf(out2,"\n\n");
/*
* Scan the database. DB is a text file; each line
* is a record, which contains data for one system
* function. Each record has three columns:
*
* NT_NAME (e.g. NtCreateProcess)
* ZW_NAME (e.g. ZwCreateProcess)
* STACK_SIZE (in machine words: for x[3456]86
* processors a machine word is 4 bytes)
*/
/* First system call has index zero */
sys_call_idx = 0;
while (
/* Go on until EOF or read zero bytes */
( (!feof(in))
&& (fgets(line, sizeof line, in) != NULL)
)
)
{
/*
* Remove, if present, the trailing CR.
* (os specific?)
*/
if ((s = (char *) strchr(line,'\r')) != NULL)
{
*s = '\0';
}
/*
* Skip comments (#) and empty lines.
*/
s = & line[0];
if ((*s) != '#' && (*s) != '\0')
{
/* Extract the NtXXX name */
name = (char *)strtok(s," \t");
/* Extract the stack size */
nr_args = (char *)strtok(NULL," \t");
stacksize = atoi(nr_args)*sizeof(void*);
/*
* Remove, if present, the trailing LF.
*/
if ((stmp = strchr(nr_args, '\n')) != NULL)
{
*stmp = '\0';
}
#ifdef VERBOSE
printf("%3d \"%s\"\n",sys_call_idx | INDEX,name);
#endif
/*
* Write the GDI32 stub for the current system call.
*/
#ifdef PARAMETERIZED_LIBS
fprintf(out1,"__asm__(\"\\n\\t.global _%s@%d\\n\\t\"\n",name,stacksize);
fprintf(out1,"\"_%s@%d:\\n\\t\"\n",name,stacksize);
#else
fprintf(out1,"__asm__(\"\\n\\t.global _%s\\n\\t\"\n",name);
fprintf(out1,"\"_%s:\\n\\t\"\n",name);
#endif
fprintf(out1,"\t\"mov\t$%d,%%eax\\n\\t\"\n",sys_call_idx | INDEX);
fprintf(out1,"\t\"lea\t4(%%esp),%%edx\\n\\t\"\n");
fprintf(out1,"\t\"int\t$0x2E\\n\\t\"\n");
fprintf(out1,"\t\"ret\t$%d\\n\\t\");\n\n",stacksize);
/*
* Write the USER32 stub for the current system call
*/
#ifdef PARAMETERIZED_LIBS
fprintf(out2,"__asm__(\"\\n\\t.global _%s@%d\\n\\t\"\n",name,stacksize);
fprintf(out2,"\"_%s@%d:\\n\\t\"\n",name,stacksize);
#else
fprintf(out2,"__asm__(\"\\n\\t.global _%s\\n\\t\"\n",name);
fprintf(out2,"\"_%s:\\n\\t\"\n",name);
#endif
fprintf(out2,"\t\"mov\t$%d,%%eax\\n\\t\"\n",sys_call_idx | INDEX);
fprintf(out2,"\t\"lea\t4(%%esp),%%edx\\n\\t\"\n");
fprintf(out2,"\t\"int\t$0x2E\\n\\t\"\n");
fprintf(out2,"\t\"ret\t$%d\\n\\t\");\n\n",stacksize);
/* Next system call index */
sys_call_idx++;
}
}
return(0);
}
void usage(char * argv0)
{
printf("Usage: %s w32k.lst ssdt.h win32k.c win32k.c\n"
" w32k.lst system functions database\n"
" ssdt.h WIN32K service table\n"
" win32k.c GDI32 stubs\n"
" win32k.c USER32 stubs\n",
argv0
);
}
int main(int argc, char* argv[])
{
FILE * in; /* System calls database */
FILE * out1; /* SERVICE_TABLE */
FILE * out2; /* GDI32 stubs */
FILE * out3; /* USER32 stubs */
int ret;
if (argc != 5)
{
usage(argv[0]);
return(1);
}
in = fopen(argv[1],"rb");
if (in == NULL)
{
perror("Failed to open input file (system calls database)");
return(1);
}
out1 = fopen(argv[2],"wb");
if (out1 == NULL)
{
perror("Failed to open output file (WIN32K service table)");
return(1);
}
out2 = fopen(argv[3],"wb");
if (out2 == NULL)
{
perror("Failed to open output file (GDI32 stubs)");
return(1);
}
out3 = fopen(argv[4],"wb");
if (out3 == NULL)
{
perror("Failed to open output file (USER32 stubs)");
return(1);
}
ret = process(in,out2,out3);
rewind(in);
ret = makeSystemServiceTable(in, out1);
fclose(in);
fclose(out1);
fclose(out2);
fclose(out3);
return(ret);
}
+25 -13
View File
@@ -1,50 +1,62 @@
# $Id: makefile,v 1.1 2000/02/20 22:52:47 ea Exp $
# $Id: makefile,v 1.2 2000/02/21 22:34:26 ekohl Exp $
#
# ReactOS Operating System
#
# Generate files for a kernel module that needs to add a service table.
#
TARGETNAME = mktab
#TARGETNAME = mktab
TARGETNAME = genw32k
# WIN32K.SYS
SVC_DB=w32ksvc.db
SVC_MASK=0x10000000
SVC_MASK=0x1000
ifeq ($(DOSCLI),yes)
SVC_SERVICE_TABLE_PATH=..\\..\\subsys\\win32k\\main\\
SVC_CLIENT_STUBS_PATH=..\\..\\lib\\gdi32\\misc\\
SVC_GDI_STUBS_PATH=..\\..\\lib\\gdi32\\misc\\
SVC_USER_STUBS_PATH=..\\..\\lib\\user32\\misc\\
else
SVC_SERVICE_TABLE_PATH=../../subsys/win32k/main/
SVC_CLIENT_STUBS_PATH=../../lib/gdi32/misc/
SVC_GDI_STUBS_PATH=../../lib/gdi32/misc/
SVC_USER_STUBS_PATH=../../lib/user32/misc/
endif
SVC_SERVICE_TABLE=$(SVC_SERVICE_TABLE_PATH)svctab.c
SVC_CLIENT_STUBS=$(SVC_CLIENT_STUBS_PATH)win32k.c
SVC_GDI_STUBS=$(SVC_GDI_STUBS_PATH)win32k.c
SVC_USER_STUBS=$(SVC_USER_STUBS_PATH)win32k.c
SVC_FILES = $(SVC_CLIENT_STUBS) $(SVC_SERVICE_TABLE)
SVC_FILES = $(SVC_GDI_STUBS) $(SVC_USER_STUBS) $(SVC_SERVICE_TABLE)
BASE_CFLAGS = -I../../include
all: $(SVC_FILES)
$(TARGETNAME)$(EXE_POSTFIX): $(TARGETNAME).cc
$(TARGETNAME)$(EXE_POSTFIX): $(TARGETNAME).c
$(CC) \
$(CFLAGS) \
-o $(TARGETNAME) \
-O2 \
$(TARGETNAME).cc
$(TARGETNAME).c
#$(SVC_FILES): $(SVC_DB) $(TARGETNAME)$(EXE_POSTFIX)
# ./$(TARGETNAME)$(EXE_POSTFIX) \
# $(SVC_DB) \
# $(SVC_MASK) \
# $(SVC_CLIENT_STUBS) \
# $(SVC_SERVICE_TABLE)
$(SVC_FILES): $(SVC_DB) $(TARGETNAME)$(EXE_POSTFIX)
./$(TARGETNAME)$(EXE_POSTFIX) \
$(SVC_DB) \
$(SVC_MASK) \
$(SVC_CLIENT_STUBS) \
$(SVC_SERVICE_TABLE)
$(SVC_SERVICE_TABLE) \
$(SVC_GDI_STUBS) \
$(SVC_USER_STUBS)
clean:
- $(RM) $(TARGETNAME)$(EXE_POSTFIX)
- $(RM) $(SVC_CLIENT_STUBS)
- $(RM) $(SVC_GDI_STUBS)
- $(RM) $(SVC_USER_STUBS)
- $(RM) $(SVC_SERVICE_TABLE)
.PHONY: all clean
-410
View File
@@ -1,410 +0,0 @@
/* $Id: mktab.cc,v 1.1 2000/02/20 22:52:47 ea Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT : ReactOS
* FILE : iface/addsys/mktab.c
* PURPOSE : Generating any files required for a kernel module
* to register an additional system calls table in
* NTOSKRNL.
* REVISIONS:
* 2000-02-13 (ea)
* Derived from genntdll.c mainly to build
* win32k.sys functions table.
*/
/* INCLUDE ******************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define VERBOSE
#define INPUT_BUFFER_SIZE 255
#define DB_RECORD_NAME_SIZE 64
#define STACK_ENTRY_SIZE (sizeof(void*))
#define FALSE 0
#define TRUE 1
typedef unsigned int DWORD;
typedef int INT;
typedef char * LPSTR, CHAR, * PCHAR;
typedef int BOOL;
typedef void VOID, * PVOID;
typedef
struct _DB_RECORD
{
CHAR Name [DB_RECORD_NAME_SIZE];
INT ArgumentCount;
INT StackSize;
} DB_RECORD, * PDB_RECORD;
typedef
enum
{
SELECT_OK,
SELECT_EOF,
SELECT_ERROR
} SELECT_TYPE;
/* FUNCTIONS ****************************************************************/
void usage (char * argv0)
{
printf (
"\nUsage: %s api.db mask table.c apistubs.c\n\n"
" api.db additional system functions database (NAME, ARG_COUNT)\n"
" mask service table mask (in hex; e.g. 0x1000000)\n"
" table.c service table file to be linked in the kernel module\n"
" apistubs.c stubs for user mode clients to call the API\n\n"
"NOTE: NAME must be an ASCII string and ARG_COUNT a decimal number;\n"
"between NAME and ARG_COUNT there must be at least one space or tab.\n",
argv0
);
}
void
CloseAllFiles (FILE * f0, FILE * f1, FILE * f2)
{
if (f0) fclose (f0);
if (f1) fclose (f1);
if (f2) fclose (f2);
}
SELECT_TYPE
GetNextRecord (
FILE * InputFile,
PDB_RECORD Dbr
)
{
CHAR InputBuffer [INPUT_BUFFER_SIZE];
PCHAR s;
static INT LineNumber = 0;
BOOL BadData = TRUE;
if ( (NULL == InputFile)
|| (NULL == Dbr)
)
{
fprintf (stderr, "GetNextRecord: bad argument!\n");
return SELECT_ERROR;
}
while (TRUE == BadData)
{
if ( feof (InputFile)
|| (NULL == fgets (
InputBuffer,
sizeof InputBuffer,
InputFile
)
)
)
{
#ifdef VERBOSE
fprintf (
stderr,
"GetNextRecord: EOF at line %d\n",
LineNumber
);
#endif
return SELECT_EOF;
}
++ LineNumber;
/*
* Remove, if present, the trailing CR.
* (os specific?)
*/
if (NULL != (s = (char *) strchr (InputBuffer,'\r')))
{
*s = '\0';
}
/*
* Skip comments (#) and empty lines.
*/
s = & InputBuffer [0];
if ( ('#' != (*s))
&& ('\0' != (*s))
)
{
BadData = FALSE;
}
}
if (2 != sscanf (
InputBuffer,
"%s%d",
Dbr->Name,
& Dbr->ArgumentCount
)
)
{
fprintf (
stderr,
"GetNextRecord: line %d: syntax error!\n",
LineNumber
);
return SELECT_ERROR;
}
Dbr->StackSize = (Dbr->ArgumentCount * sizeof (void*));
return SELECT_OK;
}
/* User mode service stubs file generation */
void
OutputStubPrologue (FILE * of)
{
fprintf (
of,
"/* Machine generated. Don't edit! */\n\n"
"__asm (\n"
);
}
BOOL
OutputStub (FILE * of, PDB_RECORD Dbr, INT Id, DWORD Mask)
{
DWORD CallId = (Mask | (DWORD) Id);
CHAR DecoratedName [DB_RECORD_NAME_SIZE];
sprintf (
DecoratedName,
"_%s@%d",
Dbr->Name,
Dbr->StackSize
);
fprintf (
of,
"\t\".global %s\\n\\t\"\n"
"\"%s:\\n\\t\"\n"
"\t\"mov\t$0x%08x,%%eax\\n\\t\"\n"
"\t\"lea\t4(%%esp),%%edx\\n\\t\"\n"
"\t\"int\t$0x2E\\n\\t\"\n"
"\t\"ret\t$%d\\n\\t\"\n",
DecoratedName,
DecoratedName,
CallId,
Dbr->StackSize
);
return TRUE;
}
void
OutputStubEpilog (FILE * of)
{
fprintf (
of,
");\n\n/* EOF */\n"
);
}
/* Service table file generation (used by the kernel module) */
void
OutputTablePrologue (FILE * of)
{
fprintf (
of,
"/* Machine generated. Don't edit! */\n\n"
"SERVICE_TABLE W32kServiceTable [] =\n{\n"
);
}
BOOL
OutputTable (FILE * of, PDB_RECORD Dbr)
{
static BOOL First = TRUE;
if (TRUE == First)
{
fprintf (
of,
"{%d,(ULONG)%s}",
Dbr->StackSize,
Dbr->Name
);
First = FALSE;
}
else
{
fprintf (
of,
",\n{%d,(ULONG)%s}",
Dbr->StackSize,
Dbr->Name
);
}
return TRUE;
}
void
OutputTableEpilog (FILE * of)
{
fprintf (
of,
"\n};\n/* EOF */"
);
}
/* MAIN */
int
main (int argc, char * argv [])
{
FILE * ApiDb = NULL;
FILE * Table = NULL;
FILE * Stubs = NULL;
DWORD Mask = 0;
DB_RECORD Dbr;
INT Id = 0;
SELECT_TYPE ReturnValue;
/* --- Check arguments --- */
if (argc != 5)
{
usage (argv[0]);
return (1);
}
/* --- Create files --- */
ApiDb = fopen (argv[1], "rb");
if (NULL == ApiDb)
{
fprintf (
stderr,
"%s: fatal: could not open the file \"%s\".\n",
argv [0],
argv [1]
);
return (1);
}
printf ("< %s\n", argv[1]);
Stubs = fopen (argv[3], "wb");
if (NULL == Stubs)
{
fprintf (
stderr,
"%s: fatal: could not open the file \"%s\".\n",
argv [0],
argv [3]
);
CloseAllFiles (ApiDb, Table, Stubs);
return (1);
}
printf ("> %s\n", argv[3]);
Table = fopen (argv[4], "wb");
if (NULL == Table)
{
fprintf (
stderr,
"%s: fatal: could not open the file \"%s\".\n",
argv [0],
argv [4]
);
CloseAllFiles (ApiDb, Table, Stubs);
return (1);
}
printf ("> %s\n", argv[4]);
/* --- Convert the mask value --- */
if (1 != sscanf (argv[2], "%x", & Mask))
{
fprintf (
stderr,
"%s: fatal: could not convert the mask \"%s\".\n",
argv [0],
argv [2]
);
CloseAllFiles (ApiDb, Table, Stubs);
return (1);
}
printf ("& 0x%08x\n", Mask);
/* --- Process data --- */
printf ("Processing data...\n");
OutputStubPrologue (Stubs);
OutputTablePrologue (Table);
while (SELECT_OK == (ReturnValue = GetNextRecord (ApiDb, & Dbr)))
{
if (TRUE == OutputTable (Table, & Dbr))
{
if (FALSE == OutputStub (Stubs, & Dbr, Id, Mask))
{
fprintf (
stderr,
"%s: WARNING: %s has no user mode stub\n",
argv [0],
Dbr.Name
);
}
}
else
{
fprintf (
stderr,
"%s: WARNING: %s skipped on I/O error\n",
argv [0],
Dbr.Name
);
}
++ Id;
#ifdef VERBOSE
printf (
"%3d: _%s@%d\n",
Id,
Dbr.Name,
Dbr.StackSize
);
#endif
}
if (SELECT_EOF == ReturnValue)
{
OutputStubEpilog (Stubs);
OutputTableEpilog (Table);
}
else
{
fprintf (
stderr,
"%s: generated files may be incomplete!\n",
argv [0]
);
}
/* --- Close files --- */
CloseAllFiles (ApiDb, Table, Stubs);
printf ("Done\n");
return (0);
}
/* EOF */
+52 -106
View File
@@ -1,4 +1,4 @@
/* $Id: genntdll.c,v 1.9 2000/01/23 15:14:42 hochoa Exp $
/* $Id: genntdll.c,v 1.10 2000/02/21 22:35:12 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS version of ntdll
@@ -39,17 +39,16 @@ char *nr_args;
char *stmp;
/*
* Main SSDT Header
* Main SSDT Header
*/
fprintf(out,"// Machine generated, don't edit\n");
fprintf(out,"\n\n");
fprintf(out,"// Machine generated, don't edit\n");
fprintf(out,"\n\n");
/*
* First we build the Main SSDT
*
*/
fprintf(out,"\n\n\n");
fprintf(out,"SSDT MainSSDT[] = {\n");
/*
* First we build the Main SSDT
*/
fprintf(out,"\n\n\n");
fprintf(out,"SSDT MainSSDT[] = {\n");
for ( /* First system call has index zero */
sys_call_idx = 0;
@@ -91,26 +90,24 @@ char *stmp;
if (sys_call_idx > 0)
{
fprintf(out,",\n");
fprintf(out,",\n");
}
/*
* Now write the current system call's name
* in the service table.
* in the service table.
*/
fprintf(out,"\t\t{ (ULONG)%s }",name);
fprintf(out,"\t\t{ (ULONG)%s }",name);
}
}
/* Close the service table (C syntax) */
fprintf(out,"\n};\n");
}
}
/* Close the service table (C syntax) */
fprintf(out,"\n};\n");
/*
* Now we build the Main SSPT
*
*/
rewind(in);
fprintf(out,"\n\n\n");
fprintf(out,"SSPT MainSSPT[] = {\n");
/*
* Now we build the Main SSPT
*/
rewind(in);
fprintf(out,"\n\n\n");
fprintf(out,"SSPT MainSSPT[] = {\n");
for ( /* First system call has index zero */
sys_call_idx = 0;
@@ -152,47 +149,28 @@ char *stmp;
if (sys_call_idx > 0)
{
fprintf(out,",\n");
fprintf(out,",\n");
}
/*
* Now write the current system call's ID
* in the service table along with its Parameters Size.
* Now write the current system call's ID
* in the service table along with its Parameters Size.
*/
fprintf(out,"\t\t{ %s }",nr_args);
}
}
/* Close the service table (C syntax) */
fprintf(out,"\n};\n");
// We write some useful defines
fprintf(out, "\n\n#define MIN_SYSCALL_NUMBER 0\n");
fprintf(out, "#define MAX_SYSCALL_NUMBER %d\n", sys_call_idx-1);
fprintf(out, "#define NUMBER_OF_SYSCALLS %d\n", sys_call_idx);
fprintf(out, "#define SSDTSHADOW_MAX_ENTRIES 2\n");
// Now write the KeServiceDescriptorTable
fprintf(out, "\n\n// These Service Descriptor Table its exported by NTOSKRNL and can be used\n");
fprintf(out, "// by Device Drivers to hook system services\n");
fprintf(out, "\n\nKE_SERVICE_DESCRIPTOR_TABLE_ENTRY KeServiceDescriptorTable = {\n"
"\t\tMainSSDT,\n"
"\t\tNULL,\n"
"\t\tNUMBER_OF_SYSCALLS,\n"
"\t\tMainSSPT\n\t\t};\n");
// Now write the KeServiceDescriptorTableShadow
// This would be used when win32k.sys gets implemented
fprintf(out, "\n\n// These Service Descriptor Table will be used by the win32k.sys driver\n");
fprintf(out, "\n\nKE_SERVICE_DESCRIPTOR_TABLE_ENTRY KeServiceDescriptorTableShadow[SSDTSHADOW_MAX_ENTRIES] = {\n"
"\t\t{ MainSSDT, NULL, NUMBER_OF_SYSCALLS, MainSSPT },\n"
"\t\t{ NULL, NULL, 0, NULL }\n"
"};\n");
return(0);
fprintf(out,"\t\t{ %s }",nr_args);
}
}
/*
* Close the service table (C syntax)
*/
fprintf(out,"\n};\n");
/*
* We write some useful defines
*/
fprintf(out, "\n\n#define MIN_SYSCALL_NUMBER 0\n");
fprintf(out, "#define MAX_SYSCALL_NUMBER %d\n", sys_call_idx-1);
fprintf(out, "#define NUMBER_OF_SYSCALLS %d\n", sys_call_idx);
return(0);
}
@@ -217,18 +195,8 @@ process(
*/
fprintf(out,"// Machine generated, don't edit\n");
fprintf(out,"\n\n");
/*
* Service table header
*/
//Hfprintf(out2,"// Machine generated, don't edit\n");
//Hfprintf(out2,"\n\n");
//fprintf(out2,"#include <ntddk.h>");
//H fprintf(out2,"\n\n\n");
//H fprintf(out2,"SERVICE_TABLE _SystemServiceTable[256] = {\n");
/*
* NTOSKRNL Zw functions stubs header
*/
fprintf(out3,"// Machine generated, don't edit\n");
@@ -253,7 +221,6 @@ process(
sys_call_idx++
)
{
//fgets(line,255,in);
/*
* Remove, if present, the trailing CR.
* (os specific?)
@@ -306,24 +273,7 @@ process(
fprintf(out,"\t\"int\t$0x2E\\n\\t\"\n");
fprintf(out,"\t\"ret\t$%s\\n\\t\");\n\n",nr_args);
/*
* Mark the end of the previous service
* table's element (C array syntax). When
* the current function is the n-th, we
* close the (n - 1)-th entry.
*/
//Hif (sys_call_idx > 0)
//H{
//H fprintf(out2,",\n");
//H}
/*
* Now write the current system call's name
* in the service table.
*/
//Hfprintf(out2,"\t\t{ %s, (ULONG)%s }",nr_args,name);
/*
* Now write the NTOSKRNL stub for the
* current system call. ZwXXX does NOT
* alias the corresponding NtXXX call.
@@ -337,20 +287,17 @@ process(
fprintf(out3,"\t\"ret\t$%s\\n\\t\");\n\n",nr_args);
}
}
/* Close the service table (C syntax) */
//Hfprintf(out2,"\n};\n");
return(0);
}
void usage(char * argv0)
{
printf("\
Usage: %s sysfuncs.lst napi.c napi.h zw.c\n\
sysfuncs.lst system functions database\n\
napi.c NTDLL stubs\n\
napi.h NTOSKRNL service table\n\
zw.c NTOSKRNL Zw stubs\n",
printf("Usage: %s sysfuncs.lst napi.c napi.h zw.c\n"
" sysfuncs.lst system functions database\n"
" napi.c NTDLL stubs\n"
" napi.h NTOSKRNL service table\n"
" zw.c NTOSKRNL Zw stubs\n",
argv0
);
}
@@ -358,7 +305,7 @@ Usage: %s sysfuncs.lst napi.c napi.h zw.c\n\
int main(int argc, char* argv[])
{
FILE * in; /* System calls database */
FILE * out; /* NTDLL stubs */
FILE * out1; /* NTDLL stubs */
FILE * out2; /* SERVICE_TABLE */
FILE * out3; /* NTOSKRNL Zw stubs */
int ret;
@@ -376,14 +323,13 @@ int main(int argc, char* argv[])
return(1);
}
out = fopen(argv[2],"wb");
if (out == NULL)
out1 = fopen(argv[2],"wb");
if (out1 == NULL)
{
perror("Failed to open output file (NTDLL stubs)");
return(1);
}
out2 = fopen(argv[3],"wb");
if (out2 == NULL)
{
@@ -398,12 +344,12 @@ int main(int argc, char* argv[])
return(1);
}
ret = process(in,out,out2,out3);
rewind(in);
ret = makeSystemServiceTable(in, out2);
ret = process(in,out1,out2,out3);
rewind(in);
ret = makeSystemServiceTable(in, out2);
fclose(in);
fclose(out);
fclose(out1);
fclose(out2);
fclose(out3);
+57 -47
View File
@@ -1,4 +1,4 @@
/* $Id: rtl.h,v 1.26 2000/02/18 00:47:28 ekohl Exp $
/* $Id: rtl.h,v 1.27 2000/02/21 22:36:00 ekohl Exp $
*
*/
@@ -320,6 +320,7 @@ RtlConvertUlongToLargeInteger (
ULONG UnsignedInteger
);
#if 0
VOID
RtlCopyBytes (
PVOID Destination,
@@ -333,6 +334,12 @@ RtlCopyMemory (
CONST VOID * Source,
ULONG Length
);
#endif
#define RtlCopyMemory(Destination,Source,Length) \
memcpy((Destination),(Source),(Length))
#define RtlCopyBytes RtlCopyMemory
VOID
STDCALL
@@ -1242,17 +1249,18 @@ WRITE_REGISTER_BUFFER_ULONG (
/* functions exported from NTOSKRNL.EXE which are considered RTL */
#if 0
_stricmp
_strlwr
_strnicmp
_strnset
_strrev
_strset
_strupr
;_vsnprintf
#endif
char *_itoa (int value, char *string, int radix);
int _snprintf(char * buf, size_t cnt, const char *fmt, ...);
int _snwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, ...);
int _stricmp(const char *s1, const char *s2);
char * _strlwr(char *x);
int _strnicmp(const char *s1, const char *s2, size_t n);
char * _strnset(char* szToFill, int szFill, size_t sizeMaxFill);
char * _strrev(char *s);
char * _strset(char* szToFill, int szFill);
char * _strupr(char *x);
int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args);
int _wcsicmp (const wchar_t* cs, const wchar_t* ct);
wchar_t * _wcslwr (wchar_t *x);
int _wcsnicmp (const wchar_t * cs,const wchar_t * ct,size_t count);
@@ -1260,45 +1268,45 @@ wchar_t* _wcsnset (wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill);
wchar_t * _wcsrev(wchar_t *s);
wchar_t *_wcsupr(wchar_t *x);
int atoi(const char *str);
long atol(const char *str);
int isdigit(int c);
int islower(int c);
int isprint(int c);
int isspace(int c);
int isupper(int c);
int isxdigit(int c);
size_t mbstowcs (wchar_t *wcstr, const char *mbstr, size_t count);
int mbtowc (wchar_t *wchar, const char *mbchar, size_t count);
void * memchr(const void *s, int c, size_t n);
void * memcpy(void *to, const void *from, size_t count);
void * memmove(void *dest,const void *src, size_t count);
void * memset(void *src, int val, size_t count);
#if 0
atoi
atol
isdigit
islower
isprint
isspace
isupper
isxdigit
;mbstowcs
;mbtowc
memchr
memcpy
memmove
memset
;qsort
rand
sprintf
srand
strcat
strchr
strcmp
strcpy
strlen
strncat
strncmp
strcpy
strrchr
strspn
strstr
;strtok
;swprintf
tolower
toupper
towlower
towupper
vsprintf
qsort
#endif
int rand(void);
int sprintf(char * buf, const char *fmt, ...);
void srand(unsigned seed);
char * strcat(char *s, const char *append);
char * strchr(const char *s, int c);
int strcmp(const char *s1, const char *s2);
char * strcpy(char *to, const char *from);
size_t strlen(const char *str);
char * strncat(char *dst, const char *src, size_t n);
int strncmp(const char *s1, const char *s2, size_t n);
char *strncpy(char *dst, const char *src, size_t n);
char *strrchr(const char *s, int c);
size_t strspn(const char *s1, const char *s2);
char *strstr(const char *s, const char *find);
int swprintf(wchar_t *buf, const wchar_t *fmt, ...);
int tolower(int c);
int toupper(int c);
wchar_t towlower(wchar_t c);
wchar_t towupper(wchar_t c);
int vsprintf(char *buf, const char *fmt, va_list args);
wchar_t * wcscat(wchar_t *dest, const wchar_t *src);
wchar_t * wcschr(const wchar_t *str, wchar_t ch);
int wcscmp(const wchar_t *cs, const wchar_t *ct);
@@ -1311,5 +1319,7 @@ wchar_t * wcsncpy(wchar_t *dest, const wchar_t *src, size_t count);
wchar_t * wcsrchr(const wchar_t *str, wchar_t ch);
size_t wcsspn(const wchar_t *str,const wchar_t *accept);
wchar_t *wcsstr(const wchar_t *s,const wchar_t *b);
size_t wcstombs (char *mbstr, const wchar_t *wcstr, size_t count);
int wctomb (char *mbchar, wchar_t wchar);
#endif /* __DDK_RTL_H */
-5
View File
@@ -74,11 +74,6 @@ VOID Hal_bios32_probe(VOID);
*/
BOOLEAN Hal_bios32_is_service_present(ULONG service);
NTSTATUS HalRegisterServiceTable(DWORD Mask,
DWORD Value,
PSERVICE_TABLE Table,
DWORD Count);
VOID HalInitializeDisplay (boot_param *bp);
VOID HalResetDisplay (VOID);
+13 -8
View File
@@ -3,11 +3,9 @@
#define __INTERNAL_SERVICE_H
typedef struct _SERVICE_TABLE
{
unsigned long ParametersSize;
unsigned long Function;
} SERVICE_TABLE, *PSERVICE_TABLE;
/* number of entries in the service descriptor tables */
#define SSDT_MAX_ENTRIES 4
#pragma pack(1)
@@ -22,16 +20,23 @@ typedef struct t_SSPT {
} SSPT, *PSSPT;
typedef struct t_KeServiceDescriptorTableEntry {
PSSDT pSSDT;
PSSDT SSDT;
unsigned long* ServiceCounterTable;
unsigned int NumberOfServices;
PSSPT pSSPT;
PSSPT SSPT;
} KE_SERVICE_DESCRIPTOR_TABLE_ENTRY, *PKE_SERVICE_DESCRIPTOR_TABLE_ENTRY;
#pragma pack()
NTSTATUS KeAddSystemServiceTable( int SSDTindex, PSSDT pSSDT, PSSPT pSSPT, ULONG* SyscallsCountTable );
BOOLEAN
KeAddSystemServiceTable (
PSSDT SSDT,
PULONG ServiceCounterTable,
ULONG NumberOfServices,
PSSPT SSPT,
ULONG TableIndex
);
#endif
+2 -2
View File
@@ -1,4 +1,4 @@
; $Id: ntdll.def,v 1.40 2000/02/18 00:48:50 ekohl Exp $
; $Id: ntdll.def,v 1.41 2000/02/21 22:37:24 ekohl Exp $
;
; ReactOS Operating System
;
@@ -457,7 +457,7 @@ RtlCompareUnicodeString@12
RtlConvertLongToLargeInteger@4
RtlConvertUlongToLargeInteger@4
;RtlCopyMemory@12
RtlCopyMemory
;RtlCopyMemory
RtlCopyString@8
RtlCopyUnicodeString@8
RtlDeNormalizeProcessParams@4
+3 -2
View File
@@ -1,4 +1,4 @@
/* $Id: mem.c,v 1.6 1999/11/09 18:07:50 ekohl Exp $
/* $Id: mem.c,v 1.7 2000/02/21 22:37:36 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -44,6 +44,7 @@ RtlCompareMemory(PVOID Source1, PVOID Source2, ULONG Length)
return(total);
}
#if 0
VOID RtlCopyBytes(PVOID Destination,
CONST VOID* Source,
ULONG Length)
@@ -58,7 +59,7 @@ VOID RtlCopyMemory(VOID* Destination, CONST VOID* Source, ULONG Length)
memcpy(Destination,Source,Length);
DPRINT("*Destination %x\n",*(PULONG)Destination);
}
#endif
VOID
STDCALL
+4 -2
View File
@@ -1,4 +1,4 @@
/* $Id: sprintf.c,v 1.1 2000/01/14 02:22:02 ekohl Exp $
/* $Id: sprintf.c,v 1.2 2000/02/21 22:37:57 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -22,13 +22,15 @@
* Wirzenius wrote this portably, Torvalds fucked it up :-)
*/
#include <ddk/ntddk.h>
#include <stdarg.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <internal/debug.h>
#define NDEBUG
#include <ntdll/ntdll.h>
#define ZEROPAD 1 /* pad with zero */
+3 -2
View File
@@ -1,4 +1,4 @@
/* $Id: swprintf.c,v 1.3 2000/01/14 02:22:02 ekohl Exp $
/* $Id: swprintf.c,v 1.4 2000/02/21 22:37:57 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -23,6 +23,7 @@
* Wirzenius wrote this portably, Torvalds fucked it up :-)
*/
#include <ddk/ntddk.h>
#include <stdarg.h>
#include <stdlib.h>
#include <ctype.h>
@@ -30,7 +31,7 @@
#include <limits.h>
#define NDEBUG
#include <internal/debug.h>
#include <ntdll/ntdll.h>
#define ZEROPAD 1 /* pad with zero */
+19 -1
View File
@@ -17,4 +17,22 @@
#include <ntdll/napi.h>
/* FUNCTIONS *****************************************************************/
KE_SERVICE_DESCRIPTOR_TABLE_ENTRY KeServiceDescriptorTable[SSDT_MAX_ENTRIES] =
{
{ MainSSDT, NULL, NUMBER_OF_SYSCALLS, MainSSPT },
{ NULL, NULL, 0, NULL },
{ NULL, NULL, 0, NULL },
{ NULL, NULL, 0, NULL }
};
KE_SERVICE_DESCRIPTOR_TABLE_ENTRY KeServiceDescriptorTableShadow[SSDT_MAX_ENTRIES] =
{
{ MainSSDT, NULL, NUMBER_OF_SYSCALLS, MainSSPT },
{ NULL, NULL, 0, NULL },
{ NULL, NULL, 0, NULL },
{ NULL, NULL, 0, NULL }
};
+39 -55
View File
@@ -1,4 +1,4 @@
/* $Id: usercall.c,v 1.5 2000/01/23 15:17:06 hochoa Exp $
/* $Id: usercall.c,v 1.6 2000/02/21 22:41:05 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -22,53 +22,17 @@
#include <ddk/defines.h>
extern SERVICE_TABLE _SystemServiceTable[];
extern KE_SERVICE_DESCRIPTOR_TABLE_ENTRY KeServiceDescriptorTable;
extern KE_SERVICE_DESCRIPTOR_TABLE_ENTRY KeServiceDescriptorTable[];
extern KE_SERVICE_DESCRIPTOR_TABLE_ENTRY KeServiceDescriptorTableShadow[];
/* The service dispatcher will take the service number passed in
* by the user mode process, logical and it with ServiceNumberMask
* and compare the resulting value with ServiceNumberValue. If the
* value matches, The passed service number will be and'ed with the
* inverse of ServiceNumberMask to obtain the index into the ServiceTable
* for the service to call
/*
* These become obsolete when the interrupt handler uses
* the service descriptor tables.
*/
typedef struct _HAL_DISPATCH_TABLE_ENTRY
{
DWORD ServiceNumberMask;
DWORD ServiceNumberValue;
PSERVICE_TABLE ServiceTable;
DWORD TableCount;
} HAL_DISPATCH_TABLE_ENTRY, *PHAL_DISPATCH_TABLE_ENTRY;
extern SSDT MainSSDT[];
extern SSPT MainSSPT[];
static KSPIN_LOCK DispatchTableLock = {0,};
static DWORD DispatchTableCount = 0;
static HAL_DISPATCH_TABLE_ENTRY DispatchTables[16];
NTSTATUS HalRegisterServiceTable(DWORD Mask,
DWORD Value,
PSERVICE_TABLE Table,
DWORD Count)
{
NTSTATUS Status;
KIRQL OldLvl;
KeAcquireSpinLock(&DispatchTableLock, &OldLvl);
Status = STATUS_SUCCESS;
/* FIXME: should check for invalid/overlapping service tables */
DispatchTables[DispatchTableCount].ServiceNumberMask = Mask;
DispatchTables[DispatchTableCount].ServiceNumberValue = Value;
DispatchTables[DispatchTableCount].ServiceTable = Table;
DispatchTables[DispatchTableCount].TableCount = Count;
DispatchTableCount++;
KeReleaseSpinLock(&DispatchTableLock, OldLvl);
return Status;
}
#define _STR(x) #x
#define STR(x) _STR(x)
@@ -133,24 +97,44 @@ ULONG KiAfterSystemCallHook(ULONG NtStatus, PCONTEXT Context)
}
// This function should be used by win32k.sys to add its own user32/gdi32 services
// SSDTIndex is 0 based
// SyscallsCountTable its not used at the moment
NTSTATUS KeAddSystemServiceTable( int SSDTindex, PSSDT pSSDT, PSSPT pSSPT, ULONG* SyscallsCountTable )
// TableIndex is 0 based
// ServiceCountTable its not used at the moment
BOOLEAN
KeAddSystemServiceTable (
PSSDT SSDT,
PULONG ServiceCounterTable,
ULONG NumberOfServices,
PSSPT SSPT,
ULONG TableIndex
)
{
if (TableIndex > SSDT_MAX_ENTRIES - 1)
return FALSE;
/* check if descriptor table entry is free */
if ((KeServiceDescriptorTable[TableIndex].SSDT != NULL) ||
(KeServiceDescriptorTableShadow[TableIndex].SSDT != NULL))
return FALSE;
// TODO: We could improve these checks to see if the pointers point to valid memory and so on...
// but we're in kernel mode, this function can get called only from kernel mode, so, why bother?
if(pSSDT == NULL || pSSPT == NULL || SSDTindex != 1)
return STATUS_UNSUCCESSFUL;
/* initialize the shadow service descriptor table */
KeServiceDescriptorTableShadow[TableIndex].SSDT = SSDT;
KeServiceDescriptorTableShadow[TableIndex].SSPT = SSPT;
KeServiceDescriptorTableShadow[TableIndex].NumberOfServices = NumberOfServices;
KeServiceDescriptorTableShadow[TableIndex].ServiceCounterTable = ServiceCounterTable;
// We update the KeServiceDescriptorTableShadow
KeServiceDescriptorTableShadow[SSDTindex].pSSDT = pSSDT;
KeServiceDescriptorTableShadow[SSDTindex].pSSPT = pSSPT;
/* initialize the service descriptor table (not for win32k services) */
if (TableIndex != 1)
{
KeServiceDescriptorTable[TableIndex].SSDT = SSDT;
KeServiceDescriptorTable[TableIndex].SSPT = SSPT;
KeServiceDescriptorTable[TableIndex].NumberOfServices = NumberOfServices;
KeServiceDescriptorTable[TableIndex].ServiceCounterTable = ServiceCounterTable;
}
return STATUS_SUCCESS;
return TRUE;
}
void interrupt_handler2e(void);
__asm__("\n\t.global _interrupt_handler2e\n\t"
"_interrupt_handler2e:\n\t"
@@ -195,7 +179,7 @@ void interrupt_handler2e(void);
"movl %edx,%esi\n\t"
/* FIXME: determine system service table to use */
/* FIXME: chech to see if SS is valid/inrange */
/* FIXME: check to see if SS is valid/inrange */
/* Allocate room for argument list from kernel stack */
"movl %es:_MainSSPT(,%eax,4), %ecx\n\t"
+3 -4
View File
@@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.42 2000/01/23 15:21:25 hochoa Exp $
; $Id: ntoskrnl.def,v 1.43 2000/02/21 22:39:46 ekohl Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@@ -107,7 +107,6 @@ FsRtlTruncateLargeMcb@12
FsRtlTruncateMcb@8
FsRtlUninitializeLargeMcb@4
FsRtlUninitializeMcb@4
HalRegisterServiceTable
IoAllocateController
IoAttachDeviceToDeviceStack
IoBuildSynchronousFsdRequest
@@ -134,6 +133,7 @@ IoStartNextPacket
IoStartNextPacketByKey
IoStartTimer
IoStopTimer
KeAddSystemServiceTable
KeBugCheck
KeBugCheckEx
KeClearEvent
@@ -231,7 +231,6 @@ RtlCompareUnicodeString@12
RtlConvertLongToLargeInteger@4
RtlConvertUlongToLargeInteger@4
RtlCopyLuid@8
RtlCopyMemory
RtlCopyString@8
RtlCopyUnicodeString@8
RtlCreateUnicodeString@8
@@ -435,7 +434,7 @@ strcpy
strlen
strncat
strncmp
strcpy
strncpy
strrchr
strspn
strstr
+3 -4
View File
@@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.29 2000/01/23 15:21:25 hochoa Exp $
; $Id: ntoskrnl.edf,v 1.30 2000/02/21 22:39:46 ekohl Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@@ -107,7 +107,6 @@ FsRtlTruncateLargeMcb=FsRtlTruncateLargeMcb@12
FsRtlTruncateMcb=FsRtlTruncateMcb@8
FsRtlUninitializeLargeMcb=FsRtlUninitializeLargeMcb@4
FsRtlUninitializeMcb=FsRtlUninitializeMcb@4
HalRegisterServiceTable
IoAllocateController
IoAttachDeviceToDeviceStack
IoBuildSynchronousFsdRequest
@@ -134,6 +133,7 @@ IoStartNextPacket
IoStartNextPacketByKey
IoStartTimer
IoStopTimer
KeAddSystemServiceTable
KeBugCheck
KeBugCheckEx
KeClearEvent
@@ -231,7 +231,6 @@ RtlCompareUnicodeString=RtlCompareUnicodeString@12
RtlConvertLongToLargeInteger=RtlConvertLongToLargeInteger@4
RtlConvertUlongToLargeInteger=RtlConvertUlongToLargeInteger@4
RtlCopyLuid=RtlCopyLuid@8
RtlCopyMemory
RtlCopyString=RtlCopyString@8
RtlCopyUnicodeString=RtlCopyUnicodeString@8
RtlCreateUnicodeString=RtlCreateUnicodeString@8
@@ -433,7 +432,7 @@ strcpy
strlen
strncat
strncmp
strcpy
strncpy
strrchr
strspn
strstr
+3 -2
View File
@@ -1,4 +1,4 @@
/* $Id: mem.c,v 1.7 1999/12/01 15:22:49 ekohl Exp $
/* $Id: mem.c,v 1.8 2000/02/21 22:41:45 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -89,6 +89,7 @@ VOID RtlCopyBytes(PVOID Destination,
}
#endif
#if 0
VOID RtlCopyMemory(VOID* Destination, CONST VOID* Source, ULONG Length)
{
DPRINT("RtlCopyMemory(Destination %x Source %x Length %d\n",
@@ -96,7 +97,7 @@ VOID RtlCopyMemory(VOID* Destination, CONST VOID* Source, ULONG Length)
memcpy(Destination,Source,Length);
DPRINT("*Destination %x\n",*(PULONG)Destination);
}
#endif
VOID
STDCALL
+2 -1
View File
@@ -1,4 +1,4 @@
/* $Id: sprintf.c,v 1.1 2000/01/14 02:23:25 ekohl Exp $
/* $Id: sprintf.c,v 1.2 2000/02/21 22:41:45 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -22,6 +22,7 @@
* Wirzenius wrote this portably, Torvalds fucked it up :-)
*/
#include <ddk/ntddk.h>
#include <stdarg.h>
#include <stdlib.h>
#include <ctype.h>
+2 -1
View File
@@ -1,4 +1,4 @@
/* $Id: swprintf.c,v 1.1 2000/01/14 02:23:25 ekohl Exp $
/* $Id: swprintf.c,v 1.2 2000/02/21 22:41:45 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -23,6 +23,7 @@
* Wirzenius wrote this portably, Torvalds fucked it up :-)
*/
#include <ddk/ntddk.h>
#include <stdarg.h>
#include <stdlib.h>
#include <ctype.h>
+44 -39
View File
@@ -1,4 +1,4 @@
/* $Id: init.c,v 1.12 2000/02/19 19:37:13 ekohl Exp $
/* $Id: init.c,v 1.13 2000/02/21 22:43:15 ekohl Exp $
*
* init.c - Session Manager initialization
*
@@ -189,19 +189,20 @@ InitSessionManager (
/* FIXME: Process the file rename list */
/* FIXME: Load the well known DLLs */
/* Create paging files */
#if 0
SmCreatePagingFiles ();
#endif
/* FIXME: Load the well known DLLs */
/* FIXME: Load missing registry hives */
/* Load missing registry hives */
// NtInitializeRegistry (FALSE);
/* Set environment variables from registry */
SmSetEnvironmentVariables ();
#if 0
//#if 0
/* Load the kernel mode driver win32k.sys */
RtlInitUnicodeString (&CmdLineW,
L"\\??\\C:\\reactos\\system32\\drivers\\win32k.sys");
@@ -211,46 +212,50 @@ InitSessionManager (
{
return FALSE;
}
#endif
//#endif
#if 0
/* Start the Win32 subsystem (csrss.exe) */
DisplayString (L"SM: Executing csrss.exe\n");
RtlInitUnicodeString (&UnicodeString,
L"\\??\\C:\\reactos\\system32\\csrss.exe");
RtlCreateProcessParameters (&ProcessParameters,
&UnicodeString,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
Status = RtlCreateUserProcess (&UnicodeString,
0,
ProcessParameters,
NULL,
NULL,
FALSE,
0,
NULL,
&Children[CHILD_CSRSS],
NULL);
if (!NT_SUCCESS(Status))
{
DisplayString (L"SM: Loading csrss.exe failed!\n");
return FALSE;
}
/* Start the Win32 subsystem (csrss.exe) */
DisplayString (L"SM: Executing csrss.exe\n");
RtlDestroyProcessParameters (ProcessParameters);
RtlInitUnicodeString (&UnicodeString,
L"\\??\\C:\\reactos\\system32\\csrss.exe");
/* initialize current directory */
RtlInitUnicodeString (&CurrentDirectoryW,
L"C:\\reactos\\system32\\");
RtlCreateProcessParameters (&ProcessParameters,
&UnicodeString,
NULL,
&CurrentDirectoryW,
NULL,
SmSystemEnvironment,
NULL,
NULL,
NULL,
NULL);
Status = RtlCreateUserProcess (&UnicodeString,
0,
ProcessParameters,
NULL,
NULL,
FALSE,
0,
NULL,
&Children[CHILD_CSRSS],
NULL);
if (!NT_SUCCESS(Status))
{
DisplayString (L"SM: Loading csrss.exe failed!\n");
return FALSE;
}
RtlDestroyProcessParameters (ProcessParameters);
#endif
/* Start the simple shell (shell.exe) */
DisplayString (L"SM: Executing shell\n");
RtlInitUnicodeString (&UnicodeString,
+17 -17
View File
@@ -1,4 +1,4 @@
/* $Id: dllmain.c,v 1.11 2000/02/20 22:52:50 ea Exp $
/* $Id: dllmain.c,v 1.12 2000/02/21 22:44:37 ekohl Exp $
*
* Entry Point for win32k.sys
*/
@@ -9,7 +9,6 @@
#include <ddk/ntddk.h>
#include <ddk/winddi.h>
#include <internal/service.h>
#include <internal/hal.h>
#include <win32k/win32k.h>
@@ -30,26 +29,27 @@ DllMain (
IN PUNICODE_STRING RegistryPath
)
{
NTSTATUS Status;
BOOLEAN Result;
DbgPrint("Win32 kernel mode driver\n");
/*
* Register user mode call interface
* (svc mask is 0x10000000)
* (system service table index = 1)
*/
Status = HalRegisterServiceTable (
0xF0000000,
0x10000000,
W32kServiceTable,
sizeof (W32kServiceTable)
/ sizeof(W32kServiceTable[0])
);
if (!NT_SUCCESS(Status))
Result = KeAddSystemServiceTable (Win32kSSDT,
NULL,
NUMBER_OF_SYSCALLS,
Win32kSSPT,
1);
if (Result == FALSE)
{
return FALSE;
DbgPrint("Adding system services failed!\n");
return STATUS_UNSUCCESSFUL;
}
return TRUE;
DbgPrint("System services added successfully!\n");
return STATUS_SUCCESS;
}
/* EOF */