]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/utils.cpp
Replaced an old ifndef FWD_ONLY_CURSORS with the new wxODBC_FWD_ONLY_CURSORS setup...
[wxWidgets.git] / src / os2 / utils.cpp
index 1b441d1cef9187bff79cfe7e97c6613b84cb0395..2bae71d97b58f55aba721de4f0990cba91b54144 100644 (file)
@@ -40,7 +40,6 @@
 #define INCL_PM
 #define INCL_GPI
 #include <os2.h>
-#include<netdb.h>
 #define PURE_32
 #include <upm.h>
 #include <netcons.h>
@@ -65,17 +64,17 @@ bool wxGetHostName(
 #if wxUSE_NET_API
     char                            zServer[256];
     char                            zComputer[256];
-    unsigned short                  nLevel = 0;
+    unsigned long                   ulLevel = 0;
     unsigned char*                  zBuffer;
-    unsigned short                  nBuffer;
-    unsigned short*                 pnTotalAvail;
+    unsigned long                   ulBuffer;
+    unsigned long*                  pulTotalAvail;
 
     NetBios32GetInfo( (const unsigned char*)zServer
                      ,(const unsigned char*)zComputer
-                     ,nLevel
+                     ,ulLevel
                      ,zBuffer
-                     ,nBuffer
-                     ,pnTotalAvail
+                     ,ulBuffer
+                     ,pulTotalAvail
                     );
     strcpy(zBuf, zServer);
 #else
@@ -160,8 +159,8 @@ bool wxShell(
     SData.PgmTitle = PgmTitle;
     SData.PgmName  = zShell;
 
-//    sInputs = "/C " + rCommand;
-    SData.PgmInputs     = NULL; //(BYTE*)sInputs.c_str();
+    sInputs = "/C " + rCommand;
+    SData.PgmInputs     = (BYTE*)sInputs.c_str();
     SData.TermQ         = 0;
     SData.Environment   = 0;
     SData.InheritOpt    = SSF_INHERTOPT_SHELL;
@@ -178,7 +177,7 @@ bool wxShell(
     SData.ObjectBuffLen = (ULONG)sizeof(achObjBuf);
 
     rc = ::DosStartSession(&SData, &ulSessID, &vPid);
-    if (rc == 0)
+    if (rc == 0 || rc == 457) // NO_ERROR or SMG_START_IN_BACKGROUND
     {
         PTIB                            ptib;
         PPIB                            ppib;
@@ -196,10 +195,9 @@ bool wxShell(
 }
 
 // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
-long wxGetFreeMemory(
-  void*                             pMemptr
-)
+long wxGetFreeMemory()
 {
+    void*                           pMemptr;
     ULONG                           lSize;
     ULONG                           lMemFlags;
     APIRET                          rc;
@@ -310,14 +308,17 @@ int wxGetOsVersion(
 )
 {
     ULONG                           ulSysInfo[QSV_MAX] = {0};
-
-    if (::DosQuerySysInfo( 1L
-                          ,QSV_MAX
-                          ,(PVOID)ulSysInfo
-                          ,sizeof(ULONG) * QSV_MAX
-                         ))
+    APIRET                          ulrc;
+
+    ulrc = ::DosQuerySysInfo( 1L
+                             ,QSV_MAX
+                             ,(PVOID)ulSysInfo
+                             ,sizeof(ULONG) * QSV_MAX
+                            );
+    if (ulrc == 0L)
     {
         *pMajorVsn = ulSysInfo[QSV_VERSION_MAJOR];
+        *pMajorVsn = *pMajorVsn/10;
         *pMinorVsn = ulSysInfo[QSV_VERSION_MINOR];
         return wxWINDOWS_OS2;
     }
@@ -428,10 +429,10 @@ bool wxGetResource(
                                               ,(PSZ)WXSTRINGCAST rSection
                                               ,(PSZ)WXSTRINGCAST rEntry
                                               ,(PSZ)zDefunkt
-                                              ,(void*)wxBuffer
+                                              ,(void*)*ppValue
                                               ,1000
                                              );
-            if (n == 0L || wxStrcmp(wxBuffer, zDefunkt) == 0)
+            if (n != 0L || wxStrcmp(*ppValue, zDefunkt) == 0)
                 return FALSE;
         }
         else
@@ -443,15 +444,12 @@ bool wxGetResource(
                                           ,(PSZ)WXSTRINGCAST rSection
                                           ,(PSZ)WXSTRINGCAST rEntry
                                           ,(PSZ)zDefunkt
-                                          ,(void*)wxBuffer
+                                          ,(void*)*ppValue
                                           ,1000
                                          );
-        if (n == 0L || wxStrcmp(wxBuffer, zDefunkt) == 0)
+        if (n != 0L || wxStrcmp(*ppValue, zDefunkt) == 0)
             return FALSE;
     }
-    if (*ppValue)
-        delete[] (*ppValue);
-    *ppValue = copystring(wxBuffer);
     return TRUE;
 }