Cleaned up system libraries
authorDavid Welch <welch@cwcom.net>
Sat, 19 Dec 1998 17:48:53 +0000 (17:48 +0000)
committerDavid Welch <welch@cwcom.net>
Sat, 19 Dec 1998 17:48:53 +0000 (17:48 +0000)
svn path=/trunk/; revision=121

reactos/lib/kernel32/file/create.c [new file with mode: 0644]
reactos/lib/ntdll/genntdll.c [deleted file]
reactos/lib/ntdll/stubs.asm [deleted file]
reactos/lib/ntdll/sysfuncs.lst [deleted file]

diff --git a/reactos/lib/kernel32/file/create.c b/reactos/lib/kernel32/file/create.c
new file mode 100644 (file)
index 0000000..b2b1de2
--- /dev/null
@@ -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 <windows.h>
+#include <ddk/ntddk.h>
+#include <wstring.h>
+#include <string.h>
+#include <kernel32/li.h>
+#include <ddk/rtl.h>
+
+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 (file)
index 694f5ab..0000000
+++ /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 <stdio.h>
-#include <stdlib.h>
-
-/* 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 (file)
index 6f6b033..0000000
+++ /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 (file)
index 85dbbbc..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# This defines the kernel entry points used by ntdll
-#
-# They have the following format
-#          <name> <system call number> <size of the parameters in bytes>
-#
-NtAlertThread  4 14