Index: trunk/src/kernel32/KERNEL32.DEF
===================================================================
--- trunk/src/kernel32/KERNEL32.DEF	(revision 1475)
+++ trunk/src/kernel32/KERNEL32.DEF	(revision 1476)
@@ -1,3 +1,3 @@
-; $Id: KERNEL32.DEF,v 1.45 1999-10-26 11:15:32 sandervl Exp $
+; $Id: KERNEL32.DEF,v 1.46 1999-10-27 12:38:44 phaller Exp $
 
 ;Created by BLAST for IBM's compiler
@@ -19,4 +19,11 @@
   _DosAliasMem                 =  DOSCALLS.298
    DosQuerySysState            =  DOSCALLS.368
+
+  _O32_RegCloseKey             = PMWINX.541
+  _O32_RegCreateKeyEx          = PMWINX.543
+  _O32_RegOpenKeyEx            = PMWINX.550
+  _O32_RegQueryValueEx         = PMWINX.553
+  _O32_RegSetValueEx           = PMWINX.555
+
 
 
Index: trunk/src/kernel32/conprop.cpp
===================================================================
--- trunk/src/kernel32/conprop.cpp	(revision 1475)
+++ trunk/src/kernel32/conprop.cpp	(revision 1476)
@@ -1,3 +1,3 @@
-/* $Id: conprop.cpp,v 1.8 1999-08-31 22:44:33 phaller Exp $ */
+/* $Id: conprop.cpp,v 1.9 1999-10-27 12:38:45 phaller Exp $ */
 
 /*
@@ -6,5 +6,5 @@
  * 1998/03/06 Patrick Haller (haller@zebra.fh-weingarten.de)
  *
- * @(#) conprop.cpp     	1.0.0   1998/03/06 PH Start from scratch
+ * @(#) conprop.cpp             1.0.0   1998/03/06 PH Start from scratch
  */
 
@@ -32,5 +32,5 @@
 #define  INCL_VIO
 #define  INCL_AVIO
-#include <os2wrap.h>	//Odin32 OS/2 api wrappers
+#include <os2wrap.h>    //Odin32 OS/2 api wrappers
 #include <builtin.h>
 
@@ -1891,32 +1891,6 @@
 
 
-
-
-
 /*****************************************************************************
- * Name      : APIRET EXPENTRY ConsolePropertyLoad
- * Funktion  : load properties from registry
- * Parameter : PICONSOLEOPTIONS pConsoleOptions
- * Variablen :
- * Ergebnis  : APIRET
- * Bemerkung :
- *
- * Autor     : Patrick Haller [1998/06/13 23:20]
- *****************************************************************************/
-
-APIRET EXPENTRY ConsolePropertyLoad(PICONSOLEOPTIONS pConsoleOptions)
-{
-  dprintf (("KERNEL32: Console:ConsolePropertyLoad(%08xh) not implemented.\n",
-            pConsoleOptions));
-
-  // HKEY_CURRENT_USER/SOFTWARE/ODIN/<process name>/<option name>
-
-  return (NO_ERROR);
-}
-
-
-
-/*****************************************************************************
- * Name      : APIRET EXPENTRY ConsolePropertySave
+ * Name      : APIRET EXPENTRY ConsolePropertyApply
  * Funktion  : save properties from registry
  * Parameter : PICONSOLEOPTIONS pConsoleOptions
@@ -1928,25 +1902,5 @@
  *****************************************************************************/
 
-APIRET EXPENTRY ConsolePropertySave(PICONSOLEOPTIONS pConsoleOptions)
-{
-  dprintf (("KERNEL32: Console:ConsolePropertySave(%08xh) not implemented.\n",
-            pConsoleOptions));
-
-  return (NO_ERROR);
-}
-
-
-/*****************************************************************************
- * Name      : APIRET EXPENTRY ConsolePropertyApply
- * Funktion  : apply properties in memory to the console window
- * Parameter : PICONSOLEOPTIONS pConsoleOptions
- * Variablen :
- * Ergebnis  : APIRET
- * Bemerkung :
- *
- * Autor     : Patrick Haller [1998/06/13 23:20]
- *****************************************************************************/
-
-APIRET EXPENTRY ConsolePropertyApply(PICONSOLEOPTIONS pConsoleOptions)
+DWORD ConsolePropertyApply(PICONSOLEOPTIONS pConsoleOptions)
 {
   dprintf (("KERNEL32: Console:ConsolePropertyApply(%08xh) not implemented.\n",
@@ -1955,8 +1909,4 @@
   return (NO_ERROR);
 }
-
-
-
-
 
 
Index: trunk/src/kernel32/conprop.h
===================================================================
--- trunk/src/kernel32/conprop.h	(revision 1475)
+++ trunk/src/kernel32/conprop.h	(revision 1476)
@@ -1,3 +1,3 @@
-/* $Id: conprop.h,v 1.5 1999-08-31 22:44:33 phaller Exp $ */
+/* $Id: conprop.h,v 1.6 1999-10-27 12:38:46 phaller Exp $ */
 
 /*
@@ -55,13 +55,14 @@
                                         MPARAM mp2);
 
-
+                                               /* default console properties */
+DWORD ConsolePropertyDefault(PICONSOLEOPTIONS pConsoleOptions);
                                                   /* read console properties */
-APIRET EXPENTRY ConsolePropertyLoad(PICONSOLEOPTIONS pConsoleOptions);
+DWORD ConsolePropertyLoad(PICONSOLEOPTIONS pConsoleOptions);
 
                                                  /* write console properties */
-APIRET EXPENTRY ConsolePropertySave(PICONSOLEOPTIONS pConsoleOptions);
+DWORD ConsolePropertySave(PICONSOLEOPTIONS pConsoleOptions);
 
                                                  /* apply console properties */
-APIRET EXPENTRY ConsolePropertyApply(PICONSOLEOPTIONS pConsoleOptions);
+DWORD ConsolePropertyApply(PICONSOLEOPTIONS pConsoleOptions);
 
 #ifdef __cplusplus
Index: trunk/src/kernel32/conprop2.cpp
===================================================================
--- trunk/src/kernel32/conprop2.cpp	(revision 1476)
+++ trunk/src/kernel32/conprop2.cpp	(revision 1476)
@@ -0,0 +1,253 @@
+/* $Id: conprop2.cpp,v 1.1 1999-10-27 12:38:47 phaller Exp $ */
+
+/*
+ * Win32 Console API Translation for OS/2
+ *
+ * 1998/03/06 Patrick Haller (haller@zebra.fh-weingarten.de)
+ *
+ * @(#) conprop.cpp             1.0.0   1998/03/06 PH Start from scratch
+ */
+
+
+/*****************************************************************************
+ * Remark                                                                    *
+ *****************************************************************************
+
+ - save / load properties from EAs
+
+ */
+
+
+/*****************************************************************************
+ * Includes                                                                  *
+ *****************************************************************************/
+
+#include <odin.h>
+#include <odinwrap.h>
+#include <os2sel.h>
+
+#define  INCL_GPI
+#define  INCL_WIN
+#define  INCL_DOSMEMMGR
+#define  INCL_DOSSEMAPHORES
+#define  INCL_DOSERRORS
+#define  INCL_DOSPROCESS
+#define  INCL_DOSMODULEMGR
+#define  INCL_VIO
+#define  INCL_AVIO
+#include <os2wrap.h>    //Odin32 OS/2 api wrappers
+#include <builtin.h>
+
+#include <win32type.h>
+#include <misc.h>
+#include <stdio.h>
+
+#include "console.h"
+#include "console2.h"
+#include "conprop.h"
+
+
+ODINDEBUGCHANNEL(KERNEL32-CONPROP2)
+
+/*****************************************************************************
+ * Defines                                                                   *
+ *****************************************************************************/
+
+#define ERROR_SUCCESS 0
+
+#define REG_NONE                         0  /* no type */
+#define REG_SZ                           1  /* string type (ASCII) */
+#define REG_EXPAND_SZ                    2  /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
+#define REG_BINARY                       3  /* binary format, callerspecific */
+                                /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
+#define REG_DWORD                        4  /* DWORD in little endian format */
+#define REG_DWORD_LITTLE_ENDIAN          4  /* DWORD in little endian format */
+#define REG_DWORD_BIG_ENDIAN             5  /* DWORD in big endian format  */
+#define REG_LINK                         6  /* symbolic link (UNICODE) */
+#define REG_MULTI_SZ                     7  /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
+#define REG_RESOURCE_LIST                8  /* resource list? huh? */
+#define REG_FULL_RESOURCE_DESCRIPTOR     9  /* full resource descriptor? huh? */
+
+#define HKEY_LOCAL_MACHINE_O32      0xFFFFFFEFL
+#define HKEY_CURRENT_USER_O32       0xFFFFFFEEL
+#define HKEY_USERS_O32              0xFFFFFFEDL
+#define HKEY_CLASSES_ROOT_O32       0xFFFFFFECL
+
+#define KEY_ALL_ACCESS 0x0000003f
+
+typedef unsigned long HKEY;
+typedef HKEY* LPHKEY;
+typedef DWORD REGSAM;
+
+LONG  _System _O32_RegOpenKeyEx(HKEY,LPCSTR,DWORD,REGSAM,LPHKEY);
+LONG  _System _O32_RegCreateKeyEx(HKEY,LPCSTR,DWORD,LPSTR,DWORD,REGSAM,
+                              LPSECURITY_ATTRIBUTES,LPHKEY,LPDWORD);
+LONG  _System _O32_RegQueryValueEx(HKEY,LPSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
+LONG  _System _O32_RegCloseKey(HKEY);
+DWORD _System GetModuleFileNameA(HMODULE,LPSTR,DWORD);
+
+
+/*****************************************************************************
+ * Name      : APIRET EXPENTRY ConsolePropertyDefault
+ * Funktion  : load default options
+ * Parameter : PICONSOLEOPTIONS pConsoleOptions
+ * Variablen :
+ * Ergebnis  : APIRET
+ * Bemerkung :
+ *
+ * Autor     : Patrick Haller [1998/06/13 23:20]
+ *****************************************************************************/
+
+DWORD ConsolePropertyDefault(PICONSOLEOPTIONS pConsoleOptions)
+{
+  /*************************************
+   * Initialize Console Window Options *
+   *************************************/
+
+  pConsoleOptions->fTerminateAutomatically = FALSE;
+  pConsoleOptions->fSpeakerEnabled         = TRUE;
+  pConsoleOptions->fSetWindowPosition      = FALSE;
+  pConsoleOptions->coordDefaultPosition.X  = 0;
+  pConsoleOptions->coordDefaultPosition.Y  = 0;
+  pConsoleOptions->coordDefaultSize.X      = 80;
+  pConsoleOptions->coordDefaultSize.Y      = 25;
+  pConsoleOptions->fQuickInsert            = FALSE;
+  pConsoleOptions->fInsertMode             = FALSE;
+  pConsoleOptions->fMouseActions           = FALSE;
+  pConsoleOptions->fToolbarActive          = FALSE;
+  pConsoleOptions->ucDefaultAttribute      = 0x0007;  /* 07 = grey on black */
+  pConsoleOptions->ulTabSize               = 8;      /* tabulator size */
+  pConsoleOptions->ulUpdateLimit           = 8; /* scroll max. n lines */
+
+                                     /* priority settings for message thread */
+  pConsoleOptions->ulConsoleThreadPriorityClass = PRTYC_REGULAR;
+  pConsoleOptions->ulConsoleThreadPriorityDelta = +10;
+
+  pConsoleOptions->ucCursorDivisor = 10; /* timer divisor for blinking */
+
+  return NO_ERROR;
+}
+
+
+/*****************************************************************************
+ * Name      : APIRET EXPENTRY ConsolePropertyLoad
+ * Funktion  : load properties from registry
+ * Parameter : PICONSOLEOPTIONS pConsoleOptions
+ * Variablen :
+ * Ergebnis  : APIRET
+ * Bemerkung :
+ *
+ * Autor     : Patrick Haller [1998/06/13 23:20]
+ *****************************************************************************/
+
+DWORD ConsolePropertyLoad(PICONSOLEOPTIONS pConsoleOptions)
+{
+  dprintf (("KERNEL32: Console:ConsolePropertyLoad(%08xh) not implemented.\n",
+            pConsoleOptions));
+
+  // HKEY_CURRENT_USER/SOFTWARE/ODIN/ConsoleProperties/<process name>/<option name>
+  LONG  lRes = ERROR_SUCCESS;
+  HKEY  hkConsole;
+  char  szKey[256];
+  char  szProcessName[256];
+  DWORD dwRes;
+  DWORD dwSize;
+  DWORD dwType;
+
+  // query process's name
+  dwRes = GetModuleFileNameA(NULL,
+                             (LPSTR)&szProcessName,
+                             sizeof(szProcessName));
+  if (dwRes == 0)
+  {
+    dprintf(("KERNEL32: ConProp: ConsolePropertyLoad: GetModuleFileName failed\n"));
+    lRes = ERROR_INVALID_PARAMETER;
+  }
+  else
+  {
+    // open process key
+    sprintf (szKey,
+             "Software\\ODIN\\ConsoleProperties\\%s",
+             szProcessName);
+
+    lRes = _O32_RegOpenKeyEx(HKEY_CURRENT_USER_O32,
+                         szKey,
+                         0,
+                         KEY_ALL_ACCESS,
+                         &hkConsole);
+  }
+
+  // try to open DEFAULT
+  if (lRes != ERROR_SUCCESS)
+    lRes = _O32_RegOpenKeyEx(HKEY_CURRENT_USER_O32,
+                         "Software\\ODIN\\ConsoleProperties\\DEFAULT",
+                         0,
+                         KEY_ALL_ACCESS,
+                         &hkConsole);
+
+  // now it's time to retrieve information
+  if (lRes != ERROR_SUCCESS)
+  {
+    // load hardcoded defaults instead
+    ConsolePropertyDefault(pConsoleOptions);
+    return ERROR_INVALID_PARAMETER;
+  }
+
+
+  // OK, finally retrieve tokens
+#define REGQUERYVALUE(name,var)              \
+  dwSize = sizeof(pConsoleOptions->var);             \
+  lRes = _O32_RegQueryValueEx(hkConsole, name, NULL, &dwType, \
+           (LPBYTE)&pConsoleOptions->var, &dwSize);
+
+  REGQUERYVALUE("AutomaticTermination",     fTerminateAutomatically)
+  REGQUERYVALUE("Speaker",                  fSpeakerEnabled)
+  REGQUERYVALUE("SpeakerDuration",          ulSpeakerDuration)
+  REGQUERYVALUE("SpeakerFrequency",         ulSpeakerFrequency)
+  REGQUERYVALUE("UpdateLimit",              ulUpdateLimit)
+  REGQUERYVALUE("SetWindowPosition",        fSetWindowPosition)
+  REGQUERYVALUE("DefaultPosition_x",        coordDefaultPosition.X)
+  REGQUERYVALUE("DefaultPosition_y",        coordDefaultPosition.Y)
+  REGQUERYVALUE("DefaultSize_x",            coordDefaultSize.X)
+  REGQUERYVALUE("DefaultSize_y",            coordDefaultSize.Y)
+  REGQUERYVALUE("BufferSize_x",             coordBufferSize.X)
+  REGQUERYVALUE("BufferSize_y",             coordBufferSize.Y)
+  REGQUERYVALUE("QuickInsert",              fQuickInsert)
+  REGQUERYVALUE("InsertMode",               fInsertMode)
+  REGQUERYVALUE("MouseActions",             fMouseActions)
+  REGQUERYVALUE("Toolbar",                  fToolbarActive)
+  REGQUERYVALUE("TabSize",                  ulTabSize)
+  REGQUERYVALUE("DefaultAttribute",         ucDefaultAttribute)
+  REGQUERYVALUE("CursorDivisor",            ucCursorDivisor)
+  REGQUERYVALUE("ConsolePriorityClass",     ulConsoleThreadPriorityClass)
+  REGQUERYVALUE("ConsolePriorityDelta",     ulConsoleThreadPriorityDelta)
+  REGQUERYVALUE("ApplicationPriorityClass", ulAppThreadPriorityClass)
+  REGQUERYVALUE("ApplicationPriorityDelta", ulAppThreadPriorityDelta)
+#undef REGQUERYVALUE
+
+  _O32_RegCloseKey(hkConsole);
+
+  return (NO_ERROR);
+}
+
+
+
+/*****************************************************************************
+ * Name      : APIRET EXPENTRY ConsolePropertySave
+ * Funktion  : save properties from registry
+ * Parameter : PICONSOLEOPTIONS pConsoleOptions
+ * Variablen :
+ * Ergebnis  : APIRET
+ * Bemerkung :
+ *
+ * Autor     : Patrick Haller [1998/06/13 23:20]
+ *****************************************************************************/
+
+DWORD ConsolePropertySave(PICONSOLEOPTIONS pConsoleOptions)
+{
+  dprintf (("KERNEL32: Console:ConsolePropertySave(%08xh) not implemented.\n",
+            pConsoleOptions));
+
+  return (NO_ERROR);
+}
+
Index: trunk/src/kernel32/console.cpp
===================================================================
--- trunk/src/kernel32/console.cpp	(revision 1475)
+++ trunk/src/kernel32/console.cpp	(revision 1476)
@@ -1,3 +1,3 @@
-/* $Id: console.cpp,v 1.14 1999-10-08 09:52:33 sandervl Exp $ */
+/* $Id: console.cpp,v 1.15 1999-10-27 12:38:47 phaller Exp $ */
 
 /*
@@ -384,34 +384,13 @@
    *************************************/
 
-  ConsoleGlobals.Options.fTerminateAutomatically = FALSE;
-  ConsoleGlobals.Options.fSpeakerEnabled         = TRUE;
-
-  ConsoleGlobals.Options.fSetWindowPosition      = FALSE;
-  ConsoleGlobals.Options.coordDefaultPosition.X  = 0;
-  ConsoleGlobals.Options.coordDefaultPosition.Y  = 0;
-  ConsoleGlobals.Options.coordDefaultSize.X      = 80;
-  ConsoleGlobals.Options.coordDefaultSize.Y      = 25;
+  // load defaults
+  ConsolePropertyDefault(&ConsoleGlobals.Options);
+
+  ConsoleGlobals.ulTimerFrequency = 10;  /* cursor + blitter timer frequency */
+
   ConsoleGlobals.coordWindowSize.X               = ConsoleGlobals.Options.coordDefaultSize.X;
   ConsoleGlobals.coordWindowSize.Y               = ConsoleGlobals.Options.coordDefaultSize.Y;
   ConsoleGlobals.coordWindowPos.X                = 0;
   ConsoleGlobals.coordWindowPos.Y                = 0;
-
-  ConsoleGlobals.Options.fQuickInsert            = FALSE;
-  ConsoleGlobals.Options.fInsertMode             = FALSE;
-  ConsoleGlobals.Options.fMouseActions           = FALSE;
-  ConsoleGlobals.Options.fToolbarActive          = FALSE;
-
-  ConsoleGlobals.Options.ucDefaultAttribute = 0x0007;  /* 07 = grey on black */
-
-  ConsoleGlobals.Options.ulTabSize               = 8;      /* tabulator size */
-  ConsoleGlobals.Options.ulUpdateLimit           = 8; /* scroll max. n lines */
-
-                                     /* priority settings for message thread */
-  ConsoleGlobals.Options.ulConsoleThreadPriorityClass = PRTYC_REGULAR;
-  ConsoleGlobals.Options.ulConsoleThreadPriorityDelta = +10;
-
-  ConsoleGlobals.Options.ucCursorDivisor = 10; /* timer divisor for blinking */
-
-  ConsoleGlobals.ulTimerFrequency = 10;  /* cursor + blitter timer frequency */
 
 
Index: trunk/src/kernel32/makefile
===================================================================
--- trunk/src/kernel32/makefile	(revision 1475)
+++ trunk/src/kernel32/makefile	(revision 1476)
@@ -1,3 +1,3 @@
-# $Id: makefile,v 1.47 1999-10-26 11:15:33 sandervl Exp $
+# $Id: makefile,v 1.48 1999-10-27 12:38:48 phaller Exp $
 
 #
@@ -28,5 +28,5 @@
 os2heap.OBJ vmutex.OBJ initterm.OBJ handlemanager.OBJ  \
 hmdevice.obj hmopen32.obj hmobjects.obj hmevent.obj hmmutex.obj \
-hmsemaphore.obj wprocess.OBJ conprop.OBJ winimagelx.obj \
+hmsemaphore.obj wprocess.OBJ conprop.OBJ conprop2.obj winimagelx.obj \
 winimagebase.OBJ windllbase.OBJ winexebase.OBJ time.obj mmap.obj \
 winimagepe2lx.obj winimagepeldr.obj windllpe2lx.obj windlllx.obj windllpeldr.obj \
@@ -81,5 +81,5 @@
     $(PDWIN32_INCLUDE)\unicode.h \
     $(PDWIN32_INCLUDE)\heap.h \
-    $(PDWIN32_INCLUDE)\wprocess.h 
+    $(PDWIN32_INCLUDE)\wprocess.h
 
 kobjects.obj: kobjects.cpp
@@ -100,5 +100,5 @@
 
 atom.obj: atom.cpp \
-    $(PDWIN32_INCLUDE)\unicode.h 
+    $(PDWIN32_INCLUDE)\unicode.h
 
 time.obj: time.cpp \
@@ -132,5 +132,5 @@
     os2heap.h
 
-initterm.OBJ: .\initterm.cpp initterm.h  heapshared.h 
+initterm.OBJ: .\initterm.cpp initterm.h  heapshared.h
 
 thunk.OBJ: \
@@ -155,5 +155,5 @@
     oslibexcept.cpp \
     $(PDWIN32_INCLUDE)\exceptions.h \
-    oslibexcept.h 
+    oslibexcept.h
 
 devio.OBJ: \
@@ -316,4 +316,8 @@
         .\conprop.cpp
 
+conprop2.OBJ: \
+        .\conprop.h \
+        .\conprop2.cpp
+
 async.OBJ: \
         .\async.cpp \
@@ -327,5 +331,5 @@
 pefile.OBJ:    pefile.cpp $(PDWIN32_INCLUDE)\pefile.h $(PDWIN32_INCLUDE)\winres.h
 
-winimagebase.obj:  winimagebase.cpp $(PDWIN32_INCLUDE)\winimagebase.h 
+winimagebase.obj:  winimagebase.cpp $(PDWIN32_INCLUDE)\winimagebase.h
 winimagepe2lx.obj: winimagepe2lx.cpp $(PDWIN32_INCLUDE)\winimagebase.h $(PDWIN32_INCLUDE)\winimagepe2lx.h
 winimagepeldr.obj: winimagepeldr.cpp $(PDWIN32_INCLUDE)\winimagebase.h $(PDWIN32_INCLUDE)\winimagepeldr.h
