X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6ba47d9973bbb113257401b6eeb82b23da7acc4..61ecf6d34ffb087e4a02d1c4e29e1f155875eba0:/src/msw/utils.cpp diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index bfed9170c1..4556f6fa97 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -38,19 +38,14 @@ #endif #endif //WX_PRECOMP -// In some mingws there is a missing extern "C" int the winsock header, -// so we put it here just to be safe. Note that this must appear _before_ -// #include "wx/msw/private.h" which itself includes , as this -// one in turn includes unless we define WIN32_LEAN_AND_MEAN. -// -#if defined(__WIN32__) && !defined(__TWIN32__) && !defined(__WXMICROWIN__) && ! (defined(__GNUWIN32__) && !defined(__MINGW32__)) -extern "C" { - #include // we use socket functions in wxGetFullHostName() -} -#endif - #include "wx/msw/private.h" // includes +#ifdef __GNUWIN32_OLD__ + // apparently we need to include winsock.h to get WSADATA and other stuff + // used in wxGetFullHostName() with the old mingw32 versions + #include +#endif + #include "wx/timer.h" #if !defined(__GNUWIN32__) && !defined(__WXWINE__) && !defined(__SALFORDC__) && !defined(__WXMICROWIN__) @@ -199,12 +194,12 @@ bool wxGetFullHostName(wxChar *buf, int maxSize) if ( pHostEnt ) { // Windows will use DNS internally now - pHostEnt = gethostbyaddr(pHostEnt->h_addr, 4, PF_INET); + pHostEnt = gethostbyaddr(pHostEnt->h_addr, 4, AF_INET); } if ( pHostEnt ) { - host = pHostEnt->h_name; + host = wxString::FromAscii(pHostEnt->h_name); } } } @@ -858,7 +853,7 @@ bool wxShell(const wxString& command) { wxChar *shell = wxGetenv(wxT("COMSPEC")); if ( !shell ) - shell = wxT("\\COMMAND.COM"); + shell = (wxChar*) wxT("\\COMMAND.COM"); wxString cmd; if ( !command ) @@ -872,7 +867,7 @@ bool wxShell(const wxString& command) cmd.Printf(wxT("%s /c %s"), shell, command.c_str()); } - return wxExecute(cmd, TRUE /* sync */) != 0; + return wxExecute(cmd, wxEXEC_SYNC) == 0; } // Shutdown or reboot the PC @@ -888,6 +883,7 @@ bool wxShutdown(wxShutdownFlags wFlags) bOK = ::OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken) != 0; +#ifndef __WXWINE__ if ( bOK ) { TOKEN_PRIVILEGES tkp; @@ -906,6 +902,7 @@ bool wxShutdown(wxShutdownFlags wFlags) // Cannot test the return value of AdjustTokenPrivileges. bOK = ::GetLastError() == ERROR_SUCCESS; } +#endif } if ( bOK ) @@ -952,6 +949,15 @@ long wxGetFreeMemory() #endif } +unsigned long wxGetProcessId() +{ +#ifdef __WIN32__ + return ::GetCurrentProcessId(); +#else + return 0; +#endif +} + // Emit a beeeeeep void wxBell() {