X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c5fb56c07a3718798459a69c74b3124ab58c65b5..5e84fc5a820a15a1ce2d32d2ae71f0bf92abda3d:/src/os2/utils.cpp?ds=inline diff --git a/src/os2/utils.cpp b/src/os2/utils.cpp index 1b441d1cef..2bae71d97b 100644 --- a/src/os2/utils.cpp +++ b/src/os2/utils.cpp @@ -40,7 +40,6 @@ #define INCL_PM #define INCL_GPI #include -#include #define PURE_32 #include #include @@ -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; }