--- /dev/null
+/*
+ * 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);
+}
+
+++ /dev/null
-/*
- * 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);
-}