Index: trunk/src/kernel32/kernel32exp.def
===================================================================
--- trunk/src/kernel32/kernel32exp.def	(revision 1145)
+++ trunk/src/kernel32/kernel32exp.def	(revision 1146)
@@ -590,14 +590,22 @@
     _lstrncmpA@12                             @785
     _lstrncmpW@12                             @786
+    _GetFileAttributesExA@12                  @874
+    _GetFileAttributesExW@12                  @875
+    _lstrncmpiA@12                            @887
+    _lstrncmpiW@12                            @888
     _OS2memmove                               @906
-    ConvertNameId                             @1200
+    DebugErrorBox                             @1201
     WriteLog                                  @1202
     WriteLogError                             @1214
-    _RegisterExe@48                           @1203
+    _RegisterPe2LxExe@48                      @1203
+    _RegisterPe2LxDll@48                      @1209
+    _CreateWin32PeLdrExe@8                    @1236
+    _RegisterLxExe@8                          @1237
+    _RegisterLxDll@12                         @1238
+    _UnregisterLxDll@4                        @1239
     enter__6VMutexFUl                         @1204
     leave__6VMutexFv                          @1205
     __ct__6VMutexFi                           @1206
     __dt__6VMutexFv                           @1207
-    _RegisterDll@48                           @1209
     _UnicodeToAsciiString@4                   @1210
     _UnicodeToAscii@8                         @1211
@@ -606,5 +614,4 @@
     _UnicodeToAsciiN@12                       @1215
     _AsciiToUnicodeN@12                       @1216
-    __ct__8Win32ExeFPc                        @1220
     GetVersionStruct                          @1221
     GetVersionSize                            @1222
@@ -622,5 +629,4 @@
     _GetThreadTEB@0                           @1234
     _GetThreadTHDB@0                          @1235
-    _CreateWin32Exe@4                         @1236
     _HEAP_xalloc@12                           @1240
     _HEAP_xrealloc@16                         @1241
@@ -638,6 +644,6 @@
     OS2SetExceptionHandler                    @1253
     OS2UnsetExceptionHandler                  @1254
-    __ct__12Win32MenuResFP10Win32ImageUlN22   @1260
-    __ct__12Win32MenuResFP10Win32ImageUlN22Pc  @1261
+    __ct__12Win32MenuResFP14Win32ImageBaseUlN22  @1260
+    __ct__12Win32MenuResFP14Win32ImageBaseUlN22Pc  @1261
     __ct__12Win32MenuResFUl                   @1262
     __ct__12Win32MenuResFPv                   @1263
Index: trunk/src/kernel32/winimagepeldr.cpp
===================================================================
--- trunk/src/kernel32/winimagepeldr.cpp	(revision 1145)
+++ trunk/src/kernel32/winimagepeldr.cpp	(revision 1146)
@@ -1,3 +1,3 @@
-/* $Id: winimagepeldr.cpp,v 1.3 1999-09-28 00:37:39 phaller Exp $ */
+/* $Id: winimagepeldr.cpp,v 1.4 1999-10-05 23:23:47 phaller Exp $ */
 
 /*
@@ -351,9 +351,6 @@
   hinstance = (HINSTANCE)realBaseAddress;
 
-  if(processImports((char *)win32file) == FALSE) {
-    	fout << "Failed to process imports!" << endl;
-    	goto failure;
-  }
-
+  //PH: get pResDir pointer correct first, since processImports may
+  //    implicitly call functions depending on it.
   IMAGE_SECTION_HEADER sh;
   if(GetSectionHdrByName (win32file, &sh, ".rsrc")) {
@@ -361,4 +358,9 @@
 	pResDir = (PIMAGE_RESOURCE_DIRECTORY)(sh.VirtualAddress + realBaseAddress);
         pResourceSectionStart = (ULONG)pResSection->virtaddr - oh.ImageBase;
+  }
+
+  if(processImports((char *)win32file) == FALSE) {
+    	fout << "Failed to process imports!" << endl;
+    	goto failure;
   }
 
Index: trunk/src/kernel32/winimgres.cpp
===================================================================
--- trunk/src/kernel32/winimgres.cpp	(revision 1145)
+++ trunk/src/kernel32/winimgres.cpp	(revision 1146)
@@ -1,3 +1,3 @@
-/* $Id: winimgres.cpp,v 1.19 1999-10-04 20:52:34 sandervl Exp $ */
+/* $Id: winimgres.cpp,v 1.20 1999-10-05 23:24:31 phaller Exp $ */
 
 /*
@@ -10,5 +10,6 @@
  *
  * TODO: Check created resource objects before loading the resource!
- * TODO: Once the resource handling in PE2LX/win32k is changed, 
+ * TODO: Is the name id of the version resource always 1?
+ * TODO: Once the resource handling in PE2LX/win32k is changed,
  *       getVersionStruct/Size can be moved into the Win32ImageBase class
  *
@@ -35,5 +36,5 @@
 //PE spec says names & ids are sorted; keep on searching just to be sure
 //******************************************************************************
-PIMAGE_RESOURCE_DATA_ENTRY 
+PIMAGE_RESOURCE_DATA_ENTRY
  Win32ImageBase::getPEResourceEntry(ULONG id, ULONG type, ULONG lang)
 {
@@ -44,4 +45,8 @@
  ULONG  nodeData[3], i, j, nameOffset;
  BOOL  fFound = FALSE, fNumType;
+
+  //PH: our system LX DLLs might not have a resource segment
+  if (pResDir == NULL)
+    return NULL;
 
   /* set pointer to first resource type entry */
@@ -72,5 +77,5 @@
     prdType = (PIMAGE_RESOURCE_DIRECTORY)((int)pResDir + (int)prde->u2.OffsetToData);
 
-    if(i < pResDir->NumberOfNamedEntries) 
+    if(i < pResDir->NumberOfNamedEntries)
     {//name or id entry?
         //SvL: 30-10-'97, high bit is set, so clear to get real offset
@@ -81,5 +86,5 @@
        	lstrcpynWtoA(typename, pstring->NameString, pstring->Length+1);
 	typename[pstring->Length] = 0;
-        
+
         if(!fNumType) {
             if(stricmp(typename, (char *)type) == 0) {
@@ -142,7 +147,5 @@
   prde    = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)((DWORD)prdType + sizeof(IMAGE_RESOURCE_DIRECTORY));
 
-  //level 2 (id)   -> get first id?
-  //level 3 (lang) -> get first language?
-  if(*nodeData == IDLANG_GETFIRST) {
+  if(level == 3 && *nodeData == LANG_GETFIRST) {
 	nrres  = prdType->NumberOfNamedEntries + prdType->NumberOfIdEntries;
 	fNumId = (prdType->NumberOfNamedEntries == 0);
@@ -151,5 +154,5 @@
   	fNumId = HIWORD(*nodeData) == 0;
 
-	if(fNumId) {//numeric or string id?
+  	if(fNumId) {//numeric or string id?
   		nrres = prdType->NumberOfIdEntries;
   		prde += prdType->NumberOfNamedEntries;  //skip name entries
@@ -162,8 +165,4 @@
     	prdType2 = (PIMAGE_RESOURCE_DIRECTORY)((ULONG)pResDir + (ULONG)prde->u2.OffsetToData);
 
-      	if(*nodeData == IDLANG_GETFIRST) {
-		fFound = TRUE; //always take the first one
-	}
-	else
     	if(!fNumId) {//name or id entry?
 		nameOffset = prde->u1.Name;
@@ -185,4 +184,6 @@
                   	fFound = TRUE;
       	}
+      	if(*nodeData == LANG_GETFIRST)
+         	fFound = TRUE;
 
    	if(fFound) {
@@ -393,5 +394,5 @@
     if(HIWORD(lpszType) != 0) {
        		astring2 = UnicodeToAsciiString(lpszType);
-    } 
+    }
     else	astring2 = (char *)lpszType;
 
@@ -431,5 +432,5 @@
     if(HIWORD(lpszType) != 0) {
          	astring2 = UnicodeToAsciiString(lpszType);
-    } 
+    }
     else	astring2 = (char *)lpszType;
 
@@ -477,5 +478,5 @@
 	return FALSE;
   }
-  pData = getPEResourceEntry(ID_GETFIRST, NTRT_VERSION);
+  pData = getPEResourceEntry(1, NTRT_VERSION);
   if(pData == NULL) {
 	dprintf(("Win32PeLdrImage::getVersionStruct: couldn't find version resource!"));
