From 7e398d4e2283532b984a4d032d9bf9913940a6ee Mon Sep 17 00:00:00 2001 From: David Welch Date: Sat, 19 Dec 1998 17:48:53 +0000 Subject: [PATCH] Cleaned up system libraries svn path=/trunk/; revision=121 --- reactos/lib/kernel32/file/create.c | 128 +++++++++++++++++++++++++++++ reactos/lib/ntdll/genntdll.c | 89 -------------------- reactos/lib/ntdll/stubs.asm | 9 -- reactos/lib/ntdll/sysfuncs.lst | 7 -- 4 files changed, 128 insertions(+), 105 deletions(-) create mode 100644 reactos/lib/kernel32/file/create.c delete mode 100644 reactos/lib/ntdll/genntdll.c delete mode 100644 reactos/lib/ntdll/stubs.asm delete mode 100644 reactos/lib/ntdll/sysfuncs.lst diff --git a/reactos/lib/kernel32/file/create.c b/reactos/lib/kernel32/file/create.c new file mode 100644 index 00000000000..b2b1de2efad --- /dev/null +++ b/reactos/lib/kernel32/file/create.c @@ -0,0 +1,128 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: lib/kernel32/file/create.c + * PURPOSE: Directory functions + * PROGRAMMER: Ariadne ( ariadne@xs4all.nl) + GetTempFileName is modified from WINE [ Alexandre Juiliard ] + * UPDATE HISTORY: + * Created 01/11/98 + */ + + +#undef WIN32_LEAN_AND_MEAN +#include +#include +#include +#include +#include +#include + +HANDLE STDCALL CreateFileA(LPCSTR lpFileName, + DWORD dwDesiredAccess, + DWORD dwShareMode, + LPSECURITY_ATTRIBUTES lpSecurityAttributes, + DWORD dwCreationDisposition, + DWORD dwFlagsAndAttributes, + HANDLE hTemplateFile) +{ + + WCHAR FileNameW[MAX_PATH]; + ULONG i = 0; + + OutputDebugStringA("CreateFileA\n"); + + while ((*lpFileName)!=0 && i < MAX_PATH) + { + FileNameW[i] = *lpFileName; + lpFileName++; + i++; + } + FileNameW[i] = 0; + + return CreateFileW(FileNameW,dwDesiredAccess, + dwShareMode, + lpSecurityAttributes, + dwCreationDisposition, + dwFlagsAndAttributes, + hTemplateFile); +} + + +HANDLE STDCALL CreateFileW(LPCWSTR lpFileName, + DWORD dwDesiredAccess, + DWORD dwShareMode, + LPSECURITY_ATTRIBUTES lpSecurityAttributes, + DWORD dwCreationDisposition, + DWORD dwFlagsAndAttributes, + HANDLE hTemplateFile) +{ + HANDLE FileHandle; + NTSTATUS Status; + + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK IoStatusBlock; + UNICODE_STRING FileNameString; + ULONG Flags = 0; + WCHAR PathNameW[MAX_PATH]; + WCHAR *FilePart; + UINT Len = 0; + WCHAR CurrentDir[MAX_PATH]; + + OutputDebugStringA("CreateFileW\n"); + + if (!(dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED)) + { + Flags |= FILE_SYNCHRONOUS_IO_ALERT; + } + +// lstrcpyW(PathNameW,L"\\??\\"); + PathNameW[0] = '\\'; + PathNameW[1] = '?'; + PathNameW[2] = '?'; + PathNameW[3] = '\\'; + PathNameW[4] = 0; + + dprintf("Name %w\n",PathNameW); + if (lpFileName[0] != L'\\' && lpFileName[1] != L':') + { + Len = GetCurrentDirectoryW(MAX_PATH,CurrentDir); + dprintf("CurrentDir %w\n",CurrentDir); + lstrcatW(PathNameW,CurrentDir); + dprintf("Name %w\n",PathNameW); + } + lstrcatW(PathNameW,lpFileName); + dprintf("Name %w\n",PathNameW); + + FileNameString.Length = lstrlenW( PathNameW)*sizeof(WCHAR); + + if ( FileNameString.Length == 0 ) + return NULL; + + if ( FileNameString.Length > MAX_PATH ) + return NULL; + + FileNameString.Buffer = (WCHAR *)PathNameW; + FileNameString.MaximumLength = FileNameString.Length; + + ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES); + ObjectAttributes.RootDirectory = NULL; + ObjectAttributes.ObjectName = &FileNameString; + ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE; + ObjectAttributes.SecurityDescriptor = NULL; + ObjectAttributes.SecurityQualityOfService = NULL; + + Status = NtCreateFile(&FileHandle, + dwDesiredAccess, + &ObjectAttributes, + &IoStatusBlock, + NULL, + dwFlagsAndAttributes, + dwShareMode, + dwCreationDisposition, + Flags, + NULL, + 0); + return(FileHandle); +} + diff --git a/reactos/lib/ntdll/genntdll.c b/reactos/lib/ntdll/genntdll.c deleted file mode 100644 index 694f5ab7fdd..00000000000 --- a/reactos/lib/ntdll/genntdll.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS version of ntdll - * FILE: lib/ntdll/genntdll.c - * PURPOSE: Generates the system call stubs in ntdll - * PROGRAMMER: David Welch (welch@mcmail.com) - */ - -/* INCLUDE ******************************************************************/ - -#include -#include - -/* FUNCTIONS ****************************************************************/ - -int process(FILE* in, FILE* out) -{ - char line[255]; - char* s; - char* name; - char* value; - char* nr_args; - - fprintf(out,"; Machine generated, don't edit\n"); - fprintf(out,"\n\n"); - - while (!feof(in) && fgets(line,255,in)!=NULL) - { - fgets(line,255,in); - if ((s=strchr(line,'\n'))!=NULL) - { - *s=0; - } - s=&line[0]; - if ((*s)!='#') - { - name = strtok(s," \t"); - value = strtok(NULL," \t"); - nr_args = strtok(NULL," \t"); - -// printf("name %s value %s\n",name,value); - - fprintf(out,"%s:\n",name); - fprintf(out,"\tmov\teax,%s\n",value); - fprintf(out,"\tlea\tedx,[esp+4]\n"); - fprintf(out,"\tint\t2Eh\n"); - fprintf(out,"\tret\t%s\n\n",nr_args); - } - } -} - -void usage(void) -{ - printf("Usage: genntdll infile.cll outfile.c\n"); -} - -int main(int argc, char* argv[]) -{ - FILE* in; - FILE* out; - int ret; - - if (argc!=3) - { - usage(); - return(1); - } - - in = fopen(argv[1],"rb"); - if (in==NULL) - { - perror("Failed to open input file"); - return(1); - } - - out = fopen(argv[2],"wb"); - if (out==NULL) - { - perror("Failed to open output file"); - return(1); - } - - ret = process(in,out); - - fclose(in); - fclose(out); - - return(ret); -} diff --git a/reactos/lib/ntdll/stubs.asm b/reactos/lib/ntdll/stubs.asm deleted file mode 100644 index 6f6b033fbe0..00000000000 --- a/reactos/lib/ntdll/stubs.asm +++ /dev/null @@ -1,9 +0,0 @@ -; Machine generated, don't edit - - -NtAlertThread: - mov eax,4 - lea edx,[esp+4] - int 2Eh - ret 14 - diff --git a/reactos/lib/ntdll/sysfuncs.lst b/reactos/lib/ntdll/sysfuncs.lst deleted file mode 100644 index 85dbbbc1fdb..00000000000 --- a/reactos/lib/ntdll/sysfuncs.lst +++ /dev/null @@ -1,7 +0,0 @@ -# -# This defines the kernel entry points used by ntdll -# -# They have the following format -# -# -NtAlertThread 4 14