Index: trunk/src/kernel32/directory.cpp
===================================================================
--- trunk/src/kernel32/directory.cpp	(revision 2971)
+++ trunk/src/kernel32/directory.cpp	(revision 2973)
@@ -1,3 +1,3 @@
-/* $Id: directory.cpp,v 1.15 2000-02-16 14:25:38 sandervl Exp $ */
+/* $Id: directory.cpp,v 1.16 2000-03-02 19:17:20 sandervl Exp $ */
 
 /*
@@ -131,5 +131,6 @@
 
   strcpy(tmp, lpPathName);
-  if(tmp[len -1] == '\\')
+  //SvL: Don't remove terminating backslash if it wants to chdir to root dir
+  if(tmp[len -1] == '\\' && len != 1)
     tmp[len -1] = 0;
 
Index: trunk/src/kernel32/hmmmap.cpp
===================================================================
--- trunk/src/kernel32/hmmmap.cpp	(revision 2971)
+++ trunk/src/kernel32/hmmmap.cpp	(revision 2973)
@@ -1,3 +1,3 @@
-/* $Id: hmmmap.cpp,v 1.10 2000-02-16 14:23:59 sandervl Exp $ */
+/* $Id: hmmmap.cpp,v 1.11 2000-03-02 19:17:21 sandervl Exp $ */
 
 /*
@@ -197,4 +197,5 @@
  Win32MemMap *map;
 
+  dprintf(("HMDeviceMemMapClass::CloseHandle %x", pHMHandleData->dwUserData));
   if(pHMHandleData->dwUserData == NULL || pHMHandleData->dwInternalType != HMTYPE_MEMMAP) {
 	dprintf(("MapViewOfFileEx: invalid handle data!"));
Index: trunk/src/kernel32/hmopen32.cpp
===================================================================
--- trunk/src/kernel32/hmopen32.cpp	(revision 2971)
+++ trunk/src/kernel32/hmopen32.cpp	(revision 2973)
@@ -1,3 +1,3 @@
-/* $Id: hmopen32.cpp,v 1.17 2000-02-16 14:24:00 sandervl Exp $ */
+/* $Id: hmopen32.cpp,v 1.18 2000-03-02 19:17:21 sandervl Exp $ */
 
 /*
@@ -846,10 +846,21 @@
                                                DWORD         dwTimeout)
 {
+ DWORD rc, starttime, endtime;
+
   dprintfl(("KERNEL32: HandleManager::Open32::WaitForSingleObject(%08xh,%08h)\n",
             pHMHandleData->hHMHandle,
             dwTimeout));
-
-  return (O32_WaitForSingleObject(pHMHandleData->hHMHandle,
-                                  dwTimeout));
+ 
+  if(dwTimeout) {
+  	starttime = O32_GetCurrentTime();
+  }
+  rc =  (O32_WaitForSingleObject(pHMHandleData->hHMHandle,
+                                 dwTimeout));
+  if(dwTimeout) {
+  	endtime = O32_GetCurrentTime();
+  	dprintf(("KERNEL32: HandleManager::WaitForSingleObject delta = %x (rc=%x)", endtime - starttime, rc));
+  }
+  else dprintf(("KERNEL32: HandleManager::WaitForSingleObject rc=%x", rc));
+  return rc;
 }
 
Index: trunk/src/kernel32/initsystem.cpp
===================================================================
--- trunk/src/kernel32/initsystem.cpp	(revision 2971)
+++ trunk/src/kernel32/initsystem.cpp	(revision 2973)
@@ -1,5 +1,8 @@
-/* $Id: initsystem.cpp,v 1.4 2000-02-16 14:25:40 sandervl Exp $ */
+/* $Id: initsystem.cpp,v 1.5 2000-03-02 19:17:21 sandervl Exp $ */
 /*
  * Odin system initialization (registry & directories)
+ *
+ *
+ * NOTE: Most of this has to be moved into the Odin install program!!!!!
  *
  * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl)
@@ -29,4 +32,5 @@
 
 LONG (WIN32API *ADVAPI32_RegCloseKey)(HKEY) = 0;
+LONG (WIN32API *ADVAPI32_RegOpenKeyA)(HKEY,LPCSTR,LPHKEY) = 0;
 LONG (WIN32API *ADVAPI32_RegCreateKeyA)(HKEY,LPCSTR,LPHKEY) = 0;
 LONG (WIN32API *ADVAPI32_RegSetValueExA)(HKEY,LPSTR,DWORD,DWORD,LPBYTE,DWORD) = 0;
@@ -39,4 +43,5 @@
    if(hInstance) {
     	*(VOID **)&ADVAPI32_RegCloseKey=(void*)GetProcAddress(hInstance, (LPCSTR)"RegCloseKey");
+        *(VOID **)&ADVAPI32_RegOpenKeyA=(void*)GetProcAddress(hInstance, (LPCSTR)"RegOpenKeyA");
         *(VOID **)&ADVAPI32_RegCreateKeyA=(void*)GetProcAddress(hInstance, (LPCSTR)"RegCreateKeyA");
         *(VOID **)&ADVAPI32_RegSetValueExA=(void*)GetProcAddress(hInstance, (LPCSTR)"RegSetValueExA");
@@ -100,4 +105,72 @@
    ADVAPI32_RegCloseKey(hkey);
    //todo: productid, registered org/owner, sourcepath,    
+
+   //Create Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders keys
+   //"Favorites"="C:\WINDOWS\Favorites"
+   //"StartUp"="C:\WINDOWS\Start Menu\Programs\Startup"
+   //"Desktop"="C:\WINDOWS\Desktop"
+   //"Programs"="C:\WINDOWS\Start Menu\Programs"
+   //"Fonts"="C:\WINDOWS\Fonts"
+   //"SendTo"="C:\WINDOWS\SendTo"
+   //"Start Menu"="C:\WINDOWS\Start Menu"
+   //"Templates"="C:\WINDOWS\ShellNew"
+   //"Recent"="C:\WINDOWS\Recent"
+   //"NetHood"="C:\WINDOWS\NetHood"
+   //"Personal"="C:\My Documents"
+
+   char shellpath[260];
+
+   if(ADVAPI32_RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey) != ERROR_SUCCESS) 
+   {
+   	if(ADVAPI32_RegCreateKeyA(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",&hkey)!=ERROR_SUCCESS) {
+      		dprintf(("InitRegistry: Unable to register system information (3)"));
+		return FALSE;
+   	}
+   	strcpy(shellpath, InternalGetSystemDirectoryA());
+   	strcat(shellpath, "\\Favorites");
+   	CreateDirectoryA(shellpath, NULL);
+   	ADVAPI32_RegSetValueExA(hkey,"Favorites",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
+   	strcpy(shellpath, InternalGetSystemDirectoryA());
+   	strcat(shellpath, "\\Programs\\Startup");
+   	CreateDirectoryA(shellpath, NULL);
+   	ADVAPI32_RegSetValueExA(hkey,"Startup",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
+   	strcpy(shellpath, InternalGetSystemDirectoryA());
+   	strcat(shellpath, "\\Desktop");
+   	CreateDirectoryA(shellpath, NULL);
+   	ADVAPI32_RegSetValueExA(hkey,"Desktop",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
+   	strcpy(shellpath, InternalGetSystemDirectoryA());
+   	strcat(shellpath, "\\Start Menu\\Programs");
+   	CreateDirectoryA(shellpath, NULL);
+   	ADVAPI32_RegSetValueExA(hkey,"Programs",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
+   	strcpy(shellpath, InternalGetSystemDirectoryA());
+   	strcat(shellpath, "\\Fonts");
+   	CreateDirectoryA(shellpath, NULL);
+   	ADVAPI32_RegSetValueExA(hkey,"Fonts",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
+   	strcpy(shellpath, InternalGetSystemDirectoryA());
+   	strcat(shellpath, "\\SendTo");
+   	CreateDirectoryA(shellpath, NULL);
+   	ADVAPI32_RegSetValueExA(hkey,"SendTo",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
+   	strcpy(shellpath, InternalGetSystemDirectoryA());
+   	strcat(shellpath, "\\Start Menu");
+   	CreateDirectoryA(shellpath, NULL);
+   	ADVAPI32_RegSetValueExA(hkey,"Start Menu",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
+   	strcpy(shellpath, InternalGetSystemDirectoryA());
+   	strcat(shellpath, "\\ShellNew");
+   	CreateDirectoryA(shellpath, NULL);
+   	ADVAPI32_RegSetValueExA(hkey,"Templates",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
+   	strcpy(shellpath, InternalGetSystemDirectoryA());
+   	strcat(shellpath, "\\Recent");
+   	CreateDirectoryA(shellpath, NULL);
+   	ADVAPI32_RegSetValueExA(hkey,"Recent",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
+   	strcpy(shellpath, InternalGetSystemDirectoryA());
+   	strcat(shellpath, "\\NetHood");
+   	CreateDirectoryA(shellpath, NULL);
+   	ADVAPI32_RegSetValueExA(hkey,"NetHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
+   	strcpy(shellpath, InternalGetSystemDirectoryA());
+   	strcat(shellpath, "\\My Documents");
+   	CreateDirectoryA(shellpath, NULL);
+   	ADVAPI32_RegSetValueExA(hkey,"Personal",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
+   }
+   ADVAPI32_RegCloseKey(hkey);
    return TRUE;
 }
Index: trunk/src/kernel32/mmap.cpp
===================================================================
--- trunk/src/kernel32/mmap.cpp	(revision 2971)
+++ trunk/src/kernel32/mmap.cpp	(revision 2973)
@@ -1,3 +1,3 @@
-/* $Id: mmap.cpp,v 1.34 2000-02-17 14:08:51 sandervl Exp $ */
+/* $Id: mmap.cpp,v 1.35 2000-03-02 19:17:21 sandervl Exp $ */
 
 /*
@@ -270,4 +270,5 @@
 BOOL Win32MemMap::unmapViewOfFile(Win32MemMapView *view)
 {
+  dprintf(("Win32MemMap::unmapViewOfFile %x (nrmaps=%d)", view, nrMappings));
   mapMutex.enter();
 
