documentatnio
authorRobert Kopferl <robertk@mok.lvcm.com>
Thu, 18 Apr 2002 23:49:42 +0000 (23:49 +0000)
committerRobert Kopferl <robertk@mok.lvcm.com>
Thu, 18 Apr 2002 23:49:42 +0000 (23:49 +0000)
and slight mods

svn path=/trunk/; revision=2857

os2/doc/index.html [new file with mode: 0644]
os2/lib/doscalls/misc/doscalls.c
os2/lib/doscalls/misc/os2def.h

diff --git a/os2/doc/index.html b/os2/doc/index.html
new file mode 100644 (file)
index 0000000..8f28539
--- /dev/null
@@ -0,0 +1,67 @@
+<html>
+<head>
+<title>OS/2 subsystem for ReactOS</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+<h1><b>OS/2 subsystem for ReactOS (ROS/2)</b></h1>
+<h2><font color="#009966">Introduction</font></h2>
+<p>The OS/2 subsystem is being developed to enable NT-like systems (like WinNT 
+  and ReactOS) to run 32-Bit OS/2 applications natively. With this it shall provide 
+  binary compatiblility on x86-Based systems. It is intended to port the ROS/2 
+  also to other platforms supported by ReactOS / NT. It is planned to provide 
+  source code compatibility on these platforms. Yeeahh, OS/2 for PowerPC is in 
+  sight.</p>
+<h2><font color="#009966">Components</font></h2>
+<p>ROS/2 consists of the following components:</p>
+<ul>
+  <li>OS2SS.EXE - A native application that implements the personality of the 
+    OS/2 kernel.</li>
+  <li>OS2.EXE - A win32 application that does the interaction of the OS/2 apps 
+    with the desktop.</li>
+  <li>Core DLLs - These DLLs that make OS/2 programs interface with the kernel/sub 
+    system (i.E. DOSCALLS.DLL). </li>
+  <li>Additional DLLs - DLLs that provide additional APIs for OS/2 apps. This 
+    includes Presentation Manager.</li>
+</ul>
+<h2><font color="#009966">Current state</font></h2>
+<p>Up to now just a fragment of DOSCALLS.DLL exists. The biggest problem are the 
+  os2 API headers which are (C) by IBM. So help is still welcome.</p>
+<h2><font color="#009966">16-Bit issues</font></h2>
+<p>It is not intended to support 16-bit OS/2 applications. This would make the 
+  system inconsistent and produce much more work that use. But there is still 
+  one issue: Current textmode applications are either 16-bit or use thunking to 
+  call the 16-bit APIs. These 32-Bit thunking applications have to be supported. 
+  We are still thinking how to accomplish that. </p>
+<h2><font color="#009966">32-Bit issues</font></h2>
+<p>It is planned to replace the current MOU- KBD- MSG- and VIO- subsystems with 
+  the <a href="http://homepages.tesco.net/%7EJ.deBoynePollard/Softwares/conapi.html">Unicode 
+  Console API</a>. This is also the foundation for other platforms we want to 
+  provide source code compatibility with. So nearly every 32-Bit processor can 
+  be supported. It sould even be possible to implement a 64-bit OS/2 API.</p>
+<h2><font color="#009966">Architecture</font></h2>
+<p>To understand the architecture of ReactOS or WinNT read a book from the &quot;Inside 
+  Windows NT&quot;-series. The architecture of ROS/2 is like every normal subsystem. 
+  When OS2SS.EXE starts, it creates an object directory named os2 and therein 
+  it creates a port object with the name Os2API. A port is something like a socket. 
+  Two programs can comunicate with each other via a port. The port Os2API provides 
+  the LPC API of the OS2SS.EXE - the actual subsystem. <br>
+  Every OS/2 program that is loaded, is linked with DOSCALLS.DLL and NTDLL.DLL 
+  - the interface to the NT-kernel. Since DOSCALLS is implemented using NTDLL.DLL, 
+  every OS/2 app has it in its adress space. Many functions in DOSCALLS.DLL are 
+  implemented by just wrapping NTDLL.DLL functions. Some functions however need 
+  assistance by the subsystem. For this reason the app makes an LPC to OS2SS.EXE. 
+  LPC means local procedure call and it is a very fast version of RPC. Together 
+  with the first application also OS2.EXE starts up. OS2.EXE runs in the win32 
+  subsystem with the security of the current user. OS2.EXE is used to gather keyboard 
+  and mouse input and to show console windows and PM-windows of all OS/2 programms 
+  of the current user. In order to accomplish this OS2.EXE creates a port object 
+  in the os2 object directory named Os2Interact. OS/2 applications have a connection 
+  to OS2.EXE, too. OS2SS.EXE and OS2.EXE also talk to each other. An OS/2 application 
+  then makes LPCs either to OS2.EXE directly or if required via OS2SS.EXE.</p>
+<p>Details</p>
+<p>&nbsp;</p>
+<p>LPC Documentation</p>
+</body>
+</html>
index 5e691a9..5ccea05 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: doscalls.c,v 1.3 2002/03/24 18:55:38 ea Exp $
+/* $Id: doscalls.c,v 1.4 2002/04/18 23:49:42 robertk Exp $
 */
 /*
  *
 */
 /*
  *
@@ -58,6 +58,85 @@ IN ULONG CreateOptions,
 IN PVOID EaBuffer OPTIONAL,
 IN ULONG EaLength
 );*/
 IN PVOID EaBuffer OPTIONAL,
 IN ULONG EaLength
 );*/
+
+
+
+          OBJECT_ATTRIBUTES ObjectAttributes;
+   IO_STATUS_BLOCK IoStatusBlock;
+   UNICODE_STRING NtPathU;
+   HANDLE FileHandle;
+   NTSTATUS Status;
+   ULONG Flags = 0;
+
+   switch (dwCreationDisposition)
+     {
+      case CREATE_NEW:
+       dwCreationDisposition = FILE_CREATE;
+       break;
+       
+      case CREATE_ALWAYS:
+       dwCreationDisposition = FILE_OVERWRITE_IF;
+       break;
+       
+      case OPEN_EXISTING:
+       dwCreationDisposition = FILE_OPEN;
+       break;
+       
+      case OPEN_ALWAYS:
+       dwCreationDisposition = OPEN_ALWAYS;
+       break;
+
+      case TRUNCATE_EXISTING:
+       dwCreationDisposition = FILE_OVERWRITE;
+     }
+   
+   DPRINT("CreateFileW(lpFileName %S)\n",lpFileName);
+   
+   if (dwDesiredAccess & GENERIC_READ)
+     dwDesiredAccess |= FILE_GENERIC_READ;
+   
+   if (dwDesiredAccess & GENERIC_WRITE)
+     dwDesiredAccess |= FILE_GENERIC_WRITE;
+   
+   if (!(dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED))
+     {
+       Flags |= FILE_SYNCHRONOUS_IO_ALERT;
+     }
+   
+   if (!RtlDosPathNameToNtPathName_U ((LPWSTR)lpFileName,
+                                     &NtPathU,
+                                     NULL,
+                                     NULL))
+     return INVALID_HANDLE_VALUE;
+   
+   DPRINT("NtPathU \'%S\'\n", NtPathU.Buffer);
+   
+   ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
+   ObjectAttributes.RootDirectory = NULL;
+   ObjectAttributes.ObjectName = &NtPathU;
+   ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE;
+   ObjectAttributes.SecurityDescriptor = NULL;
+   ObjectAttributes.SecurityQualityOfService = NULL;
+   
+   Status = NtCreateFile (&FileHandle,
+                         dwDesiredAccess,
+                         &ObjectAttributes,
+                         &IoStatusBlock,
+                         NULL,
+                         dwFlagsAndAttributes,
+                         dwShareMode,
+                         dwCreationDisposition,
+                         Flags,
+                         NULL,
+                         0);
+   if (!NT_SUCCESS(Status))
+     {
+       SetLastErrorByStatus (Status);
+       return INVALID_HANDLE_VALUE;
+     }
+   
+   return FileHandle;
+
        return 0;
 }
 
        return 0;
 }
 
@@ -175,6 +254,23 @@ APIRET STDCALL Dos32Beep(ULONG freq, ULONG dur)
        if( freq<0x25 || freq>0x7FFF )
                return 395;     // ERROR_INVALID_FREQUENCY
 
        if( freq<0x25 || freq>0x7FFF )
                return 395;     // ERROR_INVALID_FREQUENCY
 
+       HANDLE  hBeep;
+       IO_STATUS_BLOCK ComplStatus;
+       //UNICODE_STRING
+       OBJECT_ATTRIBUTES oa = {sizeof oa, 0, {8,8,"\\\\.\\Beep"l}, OBJ_CASE_INSENSITIVE};
+       NTSTATUS stat;
+       stat = NtOpenFile( &hBeep,
+                               FILE_READ_DATA | FILE_WRITE_DATA,
+                               &oa,
+                               &ComplStatus,
+                               0,      // no sharing
+                               FILE_OPEN );
+       
+       if (!NT_SUCCESS(stat))
+       {
+       }
+
+                  if( ComplStatus-> 
   /*  HANDLE hBeep;
     BEEP_SET_PARAMETERS BeepSetParameters;
     DWORD dwReturned;
   /*  HANDLE hBeep;
     BEEP_SET_PARAMETERS BeepSetParameters;
     DWORD dwReturned;
index e555dc3..527075f 100644 (file)
@@ -1,11 +1,11 @@
-/* $Id: os2def.h,v 1.2 2002/03/24 18:55:39 ea Exp $ */
+/* $Id: os2def.h,v 1.3 2002/04/18 23:49:42 robertk Exp $ */
 /* 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__
 
 /* 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;
+typedef unsigned long __stdcall  APIRET;
 #define APIENTRY
 typedef char *PSZ;
 typedef char *NPSZ;
 #define APIENTRY
 typedef char *PSZ;
 typedef char *NPSZ;