Commit 83c02e38 by Mohan Embar Committed by Mohan Embar

configure.in: Added new MinGW-specific configure flag --with-win32-nlsapi.

	* configure.in: Added new MinGW-specific configure flag
	--with-win32-nlsapi.
	Added new AC_DEFINE MINGW_LIBGCJ_UNICODE.
	Add -lunicows to MinGW SYSTEMSPEC if --with-win32-nlsapi
	is set to unicows.
	* configure: Rebuilt.
	* include/config.h.in: Rebuilt.
	* win32.cc (_Jv_Win32NewString): Implemented.
	(nativeToUnicode): New helper function defined only for
	non-UNICODE builds.
	(unicodeToNative): Likewise.
	(_Jv_Win32TempString): Implemented.
	(lots): Refactored using tchar.h macros.
	(WSAEventWrapper): Use _Jv_Win32NewString.
	(_Jv_platform_initialize): Use GetModuleFileNameA instead
	of GetModuleFileName.
	(_Jv_platform_initProperties): Use _Jv_Win32NewString.
	Use temporary stack buffer instead of a heap buffer.
	* include/win32.h
	Added defines for UNICODE and _UNICODE if MINGW_LIBGCJ_UNICODE is
	defined; added tchar.h include.
	(_Jv_Win32TempString): Declared new helper class.
	(JV_TEMP_STRING_WIN32): New helper macro.
	(_Jv_Win32NewString): Declared new helper method.
	* java/io/natFileDescriptorWin32.cc (open): Use
	JV_TEMP_STRING_WIN32 instead of JV_TEMP_UTF_STRING.
	(write): Reformatted slightly.
	* java/io/natFileWin32.cc (lots): Use tchar.h macros;
	use JV_TEMP_STRING_WIN32 instead of JV_TEMP_UTF_STRING.
	(getCanonicalPath): Use _Jv_Win32NewString instead of
	JvNewStringUTF.
	(performList): Likewise.
	* java/lang/natWin32Process.cc (ChildProcessPipe):
	Use tchar.h macros.
	(startProcess): Use tchar.h macros, JV_TEMP_STRING_WIN32,
	and UNICODE environment flag for CreateProcess.
	* java/net/natNetworkInterfaceWin32.cc
	(winsock2GetRealNetworkInterfaces): Use tchar.h macros and
	_Jv_Win32NewString.

From-SVN: r74201
parent 5f8a45f7
2003-12-02 Mohan Embar <gnustuff@thisiscool.com>
* configure.in: Added new MinGW-specific configure flag
--with-win32-nlsapi.
Added new AC_DEFINE MINGW_LIBGCJ_UNICODE.
Add -lunicows to MinGW SYSTEMSPEC if --with-win32-nlsapi
is set to unicows.
* configure: Rebuilt.
* include/config.h.in: Rebuilt.
* win32.cc (_Jv_Win32NewString): Implemented.
(nativeToUnicode): New helper function defined only for
non-UNICODE builds.
(unicodeToNative): Likewise.
(_Jv_Win32TempString): Implemented.
(lots): Refactored using tchar.h macros.
(WSAEventWrapper): Use _Jv_Win32NewString.
(_Jv_platform_initialize): Use GetModuleFileNameA instead
of GetModuleFileName.
(_Jv_platform_initProperties): Use _Jv_Win32NewString.
Use temporary stack buffer instead of a heap buffer.
* include/win32.h
Added defines for UNICODE and _UNICODE if MINGW_LIBGCJ_UNICODE is
defined; added tchar.h include.
(_Jv_Win32TempString): Declared new helper class.
(JV_TEMP_STRING_WIN32): New helper macro.
(_Jv_Win32NewString): Declared new helper method.
* java/io/natFileDescriptorWin32.cc (open): Use
JV_TEMP_STRING_WIN32 instead of JV_TEMP_UTF_STRING.
(write): Reformatted slightly.
* java/io/natFileWin32.cc (lots): Use tchar.h macros;
use JV_TEMP_STRING_WIN32 instead of JV_TEMP_UTF_STRING.
(getCanonicalPath): Use _Jv_Win32NewString instead of
JvNewStringUTF.
(performList): Likewise.
* java/lang/natWin32Process.cc (ChildProcessPipe):
Use tchar.h macros.
(startProcess): Use tchar.h macros, JV_TEMP_STRING_WIN32,
and UNICODE environment flag for CreateProcess.
* java/net/natNetworkInterfaceWin32.cc
(winsock2GetRealNetworkInterfaces): Use tchar.h macros and
_Jv_Win32NewString.
2003-12-02 Thomas Fitzsimmons <fitzsim@redhat.com> 2003-12-02 Thomas Fitzsimmons <fitzsim@redhat.com>
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c
......
...@@ -97,6 +97,26 @@ AC_ARG_ENABLE(libgcj-multifile, ...@@ -97,6 +97,26 @@ AC_ARG_ENABLE(libgcj-multifile,
esac],[enable_libgcj_multifile=no]) esac],[enable_libgcj_multifile=no])
AM_CONDITIONAL(ONESTEP, test "$enable_libgcj_multifile" = yes) AM_CONDITIONAL(ONESTEP, test "$enable_libgcj_multifile" = yes)
# What is the native OS API for MinGW?
AC_ARG_WITH(win32-nlsapi,
changequote(<<,>>)dnl
<< --with-win32-nlsapi=ansi, unicows or unicode
native MinGW libgcj Win32 OS API [ansi]>>,
changequote([,])
[case "${withval}" in
ansi) with_win32_nlsapi=ansi ;;
unicows) with_win32_nlsapi=unicows ;;
unicode) with_win32_nlsapi=unicode ;;
*) AC_MSG_ERROR(Bad value ${withval} for --with-win32-nlsapi.) ;;
esac],[with_win32_nlsapi=ansi])
case "${with_win32_nlsapi}" in
unicows | unicode)
AC_DEFINE(MINGW_LIBGCJ_UNICODE, 1,
[Define if MinGW libgcj uses the Windows UNICODE OS API.])
;;
esac
dnl configure.host sets slow_pthread_self if the synchronization code should dnl configure.host sets slow_pthread_self if the synchronization code should
dnl try to avoid pthread_self calls by caching thread IDs in a hashtable. dnl try to avoid pthread_self calls by caching thread IDs in a hashtable.
if test "${slow_pthread_self}" = "yes"; then if test "${slow_pthread_self}" = "yes"; then
...@@ -313,6 +333,9 @@ AC_LINK_FILES(gnu/java/nio/natSelectorImpl${PLATFORM}.cc, gnu/java/nio/natSelect ...@@ -313,6 +333,9 @@ AC_LINK_FILES(gnu/java/nio/natSelectorImpl${PLATFORM}.cc, gnu/java/nio/natSelect
case "${host}" in case "${host}" in
*mingw*) *mingw*)
SYSTEMSPEC="-lgdi32 -lwsock32 -lws2_32" SYSTEMSPEC="-lgdi32 -lwsock32 -lws2_32"
if test "${with_win32_nlsapi}" = "unicows"; then
SYSTEMSPEC="-lunicows $SYSTEMSPEC"
fi
;; ;;
*) *)
SYSTEMSPEC= SYSTEMSPEC=
......
...@@ -272,6 +272,9 @@ ...@@ -272,6 +272,9 @@
/* Define if we should ignore arguments to main(). */ /* Define if we should ignore arguments to main(). */
#undef DISABLE_MAIN_ARGS #undef DISABLE_MAIN_ARGS
/* Define if MinGW libgcj uses the Windows UNICODE OS API. */
#undef MINGW_LIBGCJ_UNICODE
/* Define if if the synchronization code should try to avoid pthread_self calls by caching thread IDs in a hashtable. */ /* Define if if the synchronization code should try to avoid pthread_self calls by caching thread IDs in a hashtable. */
#undef SLOW_PTHREAD_SELF #undef SLOW_PTHREAD_SELF
......
...@@ -11,6 +11,16 @@ details. */ ...@@ -11,6 +11,16 @@ details. */
#ifndef __JV_WIN32_H__ #ifndef __JV_WIN32_H__
#define __JV_WIN32_H__ #define __JV_WIN32_H__
// Enable UNICODE Support.?
#ifdef MINGW_LIBGCJ_UNICODE
#define UNICODE
#define _UNICODE
#endif // MINGW_LIBGCJ_UNICODE
#include <tchar.h>
// Includes
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#undef WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN
...@@ -23,6 +33,43 @@ details. */ ...@@ -23,6 +33,43 @@ details. */
#include <io.h> #include <io.h>
/* Begin UNICODE Support Classes and Functions */
/* Helper class which creates a temporary, null-terminated,
wide-character C string. */
class _Jv_Win32TempString
{
public:
_Jv_Win32TempString(jstring jstr);
~_Jv_Win32TempString();
// Accessors
operator LPCTSTR() const
{
return buf_;
}
LPCTSTR buf() const
{
return buf_;
}
LPTSTR buf()
{
return buf_;
}
private:
TCHAR stackbuf_[500];
LPTSTR buf_;
};
// Mimics the JV_TEMP_STRING_UTF macro in jvm.h
#define JV_TEMP_STRING_WIN32(x,y) _Jv_Win32TempString x(y);
// Creates a jstring from a LPCTSTR
extern jstring _Jv_Win32NewString (LPCTSTR pcsz);
/* End UNICODE Helpers */
// Prefix and suffix for shared libraries. // Prefix and suffix for shared libraries.
#define _Jv_platform_solib_prefix "" #define _Jv_platform_solib_prefix ""
#define _Jv_platform_solib_suffix ".dll" #define _Jv_platform_solib_suffix ".dll"
......
...@@ -87,7 +87,7 @@ java::io::FileDescriptor::open (jstring path, jint jflags) { ...@@ -87,7 +87,7 @@ java::io::FileDescriptor::open (jstring path, jint jflags) {
DWORD access = 0; DWORD access = 0;
DWORD create = OPEN_EXISTING; DWORD create = OPEN_EXISTING;
JV_TEMP_UTF_STRING(cpath, path) JV_TEMP_STRING_WIN32(cpath, path)
JvAssert((jflags & READ) || (jflags & WRITE)); JvAssert((jflags & READ) || (jflags & WRITE));
...@@ -115,7 +115,8 @@ java::io::FileDescriptor::open (jstring path, jint jflags) { ...@@ -115,7 +115,8 @@ java::io::FileDescriptor::open (jstring path, jint jflags) {
create = CREATE_ALWAYS; create = CREATE_ALWAYS;
} }
handle = CreateFile(cpath, access, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, create, 0, NULL); handle = CreateFile(cpath, access, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, create, 0, NULL);
if (handle == INVALID_HANDLE_VALUE) if (handle == INVALID_HANDLE_VALUE)
{ {
...@@ -174,13 +175,14 @@ java::io::FileDescriptor::write(jbyteArray b, jint offset, jint len) ...@@ -174,13 +175,14 @@ java::io::FileDescriptor::write(jbyteArray b, jint offset, jint len)
jbyte *buf = elements (b) + offset; jbyte *buf = elements (b) + offset;
DWORD bytesWritten; DWORD bytesWritten;
if (WriteFile ((HANDLE)fd, buf, len, &bytesWritten, NULL)) if (WriteFile ((HANDLE)fd, buf, len, &bytesWritten, NULL))
{ {
if (java::lang::Thread::interrupted()) if (java::lang::Thread::interrupted())
{ {
InterruptedIOException *iioe = new InterruptedIOException (JvNewStringLatin1 ("write interrupted")); InterruptedIOException *iioe = new InterruptedIOException (JvNewStringLatin1 ("write interrupted"));
iioe->bytesTransferred = bytesWritten; iioe->bytesTransferred = bytesWritten;
throw iioe; throw iioe;
} }
} }
else else
......
...@@ -40,7 +40,7 @@ details. */ ...@@ -40,7 +40,7 @@ details. */
jboolean jboolean
java::io::File::_access (jint query) java::io::File::_access (jint query)
{ {
JV_TEMP_UTF_STRING (canon, getCanonicalPath()); JV_TEMP_STRING_WIN32 (canon, getCanonicalPath());
if (!canon) if (!canon)
return false; return false;
...@@ -54,13 +54,14 @@ java::io::File::_access (jint query) ...@@ -54,13 +54,14 @@ java::io::File::_access (jint query)
if ((query == EXISTS) || (query == READ)) if ((query == EXISTS) || (query == READ))
return (attributes == 0xffffffff) ? false : true; return (attributes == 0xffffffff) ? false : true;
else else
return ((attributes != 0xffffffff) && ((attributes & FILE_ATTRIBUTE_READONLY) == 0)) ? true : false; return ((attributes != 0xffffffff) &&
((attributes & FILE_ATTRIBUTE_READONLY) == 0)) ? true : false;
} }
jboolean jboolean
java::io::File::_stat (jint query) java::io::File::_stat (jint query)
{ {
JV_TEMP_UTF_STRING (canon, getCanonicalPath()); JV_TEMP_STRING_WIN32 (canon, getCanonicalPath());
if (!canon) if (!canon)
return false; return false;
...@@ -79,7 +80,7 @@ java::io::File::_stat (jint query) ...@@ -79,7 +80,7 @@ java::io::File::_stat (jint query)
jlong jlong
java::io::File::attr (jint query) java::io::File::attr (jint query)
{ {
JV_TEMP_UTF_STRING (canon, getCanonicalPath()); JV_TEMP_STRING_WIN32 (canon, getCanonicalPath());
if (!canon) if (!canon)
return false; return false;
...@@ -108,21 +109,19 @@ java::io::File::attr (jint query) ...@@ -108,21 +109,19 @@ java::io::File::attr (jint query)
jstring jstring
java::io::File::getCanonicalPath (void) java::io::File::getCanonicalPath (void)
{ {
JV_TEMP_UTF_STRING (cpath, path); JV_TEMP_STRING_WIN32 (cpath, path);
// If the filename is blank, use the current directory. // If the filename is blank, use the current directory.
const char* thepath = cpath.buf(); LPCTSTR thepath = cpath.buf();
if (*thepath == '\0') if (*thepath == 0)
thepath = "."; thepath = _T(".");
LPTSTR unused; LPTSTR unused;
char buf2[MAX_PATH]; TCHAR buf2[MAX_PATH];
if(!GetFullPathName(thepath, MAX_PATH, buf2, &unused)) if(!GetFullPathName(thepath, MAX_PATH, buf2, &unused))
throw new IOException (JvNewStringLatin1 ("GetFullPathName failed")); throw new IOException (JvNewStringLatin1 ("GetFullPathName failed"));
// FIXME: what encoding to assume for file names? This affects many return _Jv_Win32NewString (buf2);
// calls.
return JvNewStringUTF(buf2);
} }
jboolean jboolean
...@@ -161,12 +160,17 @@ java::io::File::performList (java::io::FilenameFilter *filter, ...@@ -161,12 +160,17 @@ java::io::File::performList (java::io::FilenameFilter *filter,
jstring canon = getCanonicalPath(); jstring canon = getCanonicalPath();
if (! canon) if (! canon)
return NULL; return NULL;
char *buf = (char *) __builtin_alloca (JvGetStringUTFLength (canon) + 5);
jsize total = JvGetStringUTFRegion (canon, 0, canon->length(), buf); int len = canon->length();
if (buf[total-1] == '\\') TCHAR buf[len + 5];
strcpy (&buf[total], "*.*");
JV_TEMP_STRING_WIN32(canonstr, canon);
_tcscpy(buf, canonstr);
if (buf[len - 1] == _T('\\'))
_tcscpy (&buf[len], _T("*.*"));
else else
strcpy (&buf[total], "\\*.*"); _tcscpy (&buf[len], _T("\\*.*"));
WIN32_FIND_DATA data; WIN32_FIND_DATA data;
HANDLE handle = FindFirstFile (buf, &data); HANDLE handle = FindFirstFile (buf, &data);
...@@ -177,21 +181,22 @@ java::io::File::performList (java::io::FilenameFilter *filter, ...@@ -177,21 +181,22 @@ java::io::File::performList (java::io::FilenameFilter *filter,
do do
{ {
if (strcmp (data.cFileName, ".") && strcmp (data.cFileName, "..")) if (_tcscmp (data.cFileName, _T(".")) &&
_tcscmp (data.cFileName, _T("..")))
{ {
jstring name = JvNewStringUTF (data.cFileName); jstring name = _Jv_Win32NewString (data.cFileName);
if (filter && !filter->accept(this, name)) if (filter && !filter->accept(this, name))
continue; continue;
if (clazz == &java::io::File::class$) if (clazz == &java::io::File::class$)
{ {
java::io::File *file = new java::io::File (this, name); java::io::File *file = new java::io::File (this, name);
if (fileFilter && !fileFilter->accept(file)) if (fileFilter && !fileFilter->accept(file))
continue; continue;
vec->addElement (file); vec->addElement (file);
} }
else else
vec->addElement (name); vec->addElement (name);
} }
} }
while (FindNextFile (handle, &data)); while (FindNextFile (handle, &data));
...@@ -209,22 +214,22 @@ java::io::File::performList (java::io::FilenameFilter *filter, ...@@ -209,22 +214,22 @@ java::io::File::performList (java::io::FilenameFilter *filter,
jboolean jboolean
java::io::File::performMkdir (void) java::io::File::performMkdir (void)
{ {
JV_TEMP_UTF_STRING (cpath, path); JV_TEMP_STRING_WIN32 (cpath, path);
return (CreateDirectory(cpath, NULL)) ? true : false; return (CreateDirectory(cpath, NULL)) ? true : false;
} }
jboolean jboolean
java::io::File::performRenameTo (File *dest) java::io::File::performRenameTo (File *dest)
{ {
JV_TEMP_UTF_STRING (pathFrom, path); JV_TEMP_STRING_WIN32 (pathFrom, path);
JV_TEMP_UTF_STRING (pathTo, dest->path); JV_TEMP_STRING_WIN32 (pathTo, dest->path);
return (MoveFile(pathFrom, pathTo)) ? true : false; return (MoveFile(pathFrom, pathTo)) ? true : false;
} }
jboolean jboolean
java::io::File::performDelete () java::io::File::performDelete ()
{ {
JV_TEMP_UTF_STRING (canon, getCanonicalPath()); JV_TEMP_STRING_WIN32 (canon, getCanonicalPath());
if (!canon) if (!canon)
return false; return false;
...@@ -240,7 +245,7 @@ java::io::File::performDelete () ...@@ -240,7 +245,7 @@ java::io::File::performDelete ()
jboolean java::io::File::performCreate (void) jboolean java::io::File::performCreate (void)
{ {
JV_TEMP_UTF_STRING (canon, getCanonicalPath()); JV_TEMP_STRING_WIN32 (canon, getCanonicalPath());
if (!canon) if (!canon)
return false; return false;
...@@ -262,7 +267,7 @@ jboolean java::io::File::performCreate (void) ...@@ -262,7 +267,7 @@ jboolean java::io::File::performCreate (void)
jboolean java::io::File::performSetReadOnly () jboolean java::io::File::performSetReadOnly ()
{ {
JV_TEMP_UTF_STRING (canon, getCanonicalPath()); JV_TEMP_STRING_WIN32 (canon, getCanonicalPath());
if (!canon) if (!canon)
return false; return false;
...@@ -280,7 +285,7 @@ jboolean java::io::File::performSetReadOnly () ...@@ -280,7 +285,7 @@ jboolean java::io::File::performSetReadOnly ()
jboolean java::io::File::performSetLastModified (jlong time) jboolean java::io::File::performSetLastModified (jlong time)
{ {
JV_TEMP_UTF_STRING (canon, getCanonicalPath()); JV_TEMP_STRING_WIN32 (canon, getCanonicalPath());
if (!canon) if (!canon)
return false; return false;
......
...@@ -173,7 +173,7 @@ ChildProcessPipe::ChildProcessPipe(EType eType): ...@@ -173,7 +173,7 @@ ChildProcessPipe::ChildProcessPipe(EType eType):
{ {
DWORD dwErrorCode = GetLastError (); DWORD dwErrorCode = GetLastError ();
throw new java::io::IOException ( throw new java::io::IOException (
_Jv_WinStrError ("Error creating pipe", dwErrorCode)); _Jv_WinStrError (_T("Error creating pipe"), dwErrorCode));
} }
// If this is the read end of the child, we need // If this is the read end of the child, we need
...@@ -220,48 +220,53 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray, ...@@ -220,48 +220,53 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray,
int cmdLineLen = 0; int cmdLineLen = 0;
for (int i = 0; i < progarray->length; ++i) for (int i = 0; i < progarray->length; ++i)
cmdLineLen += (_Jv_GetStringUTFLength (elts[i]) + 1); cmdLineLen += (elts[i]->length() + 1);
char *cmdLine = (char *) _Jv_Malloc (cmdLineLen + 1); LPTSTR cmdLine = (LPTSTR) _Jv_Malloc ((cmdLineLen + 1) * sizeof(TCHAR));
char *cmdLineCurPos = cmdLine; LPTSTR cmdLineCurPos = cmdLine;
for (int i = 0; i < progarray->length; ++i) for (int i = 0; i < progarray->length; ++i)
{ {
if (i > 0) if (i > 0)
*cmdLineCurPos++ = ' '; *cmdLineCurPos++ = _T(' ');
jsize s = _Jv_GetStringUTFLength (elts[i]);
_Jv_GetStringUTFRegion (elts[i], 0, elts[i]->length(), cmdLineCurPos); jint len = elts[i]->length();
cmdLineCurPos += s; JV_TEMP_STRING_WIN32(thiselt, elts[i]);
_tcscpy(cmdLineCurPos, thiselt);
cmdLineCurPos += len;
} }
*cmdLineCurPos = '\0'; *cmdLineCurPos = _T('\0');
// Get the environment, if any. // Get the environment, if any.
char *env = NULL; LPTSTR env = NULL;
if (envp) if (envp)
{ {
elts = elements (envp); elts = elements (envp);
int envLen = 0; int envLen = 0;
for (int i = 0; i < envp->length; ++i) for (int i = 0; i < envp->length; ++i)
envLen += (_Jv_GetStringUTFLength (elts[i]) + 1); envLen += (elts[i]->length() + 1);
env = (char *) _Jv_Malloc (envLen + 1); env = (LPTSTR) _Jv_Malloc ((envLen + 1) * sizeof(TCHAR));
int j = 0; int j = 0;
for (int i = 0; i < envp->length; ++i) for (int i = 0; i < envp->length; ++i)
{ {
jsize s = _Jv_GetStringUTFLength (elts[i]); jint len = elts[i]->length();
_Jv_GetStringUTFRegion (elts[i], 0, elts[i]->length(), (env + j));
JV_TEMP_STRING_WIN32(thiselt, elts[i]);
j += s; _tcscpy(env + j, thiselt);
*(env + j) = '\0';
j += len;
// Skip past the null terminator that _tcscpy just inserted.
j++; j++;
} }
*(env + j) = '\0'; *(env + j) = _T('\0');
} }
// Get the working directory path, if specified. // Get the working directory path, if specified.
JV_TEMP_UTF_STRING (wdir, dir ? dir->getPath () : 0); JV_TEMP_STRING_WIN32 (wdir, dir ? dir->getPath () : 0);
errorStream = NULL; errorStream = NULL;
inputStream = NULL; inputStream = NULL;
...@@ -304,12 +309,13 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray, ...@@ -304,12 +309,13 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray,
// starting a console application; it suppresses the // starting a console application; it suppresses the
// creation of a console window. This flag is ignored on // creation of a console window. This flag is ignored on
// Win9X. // Win9X.
if (CreateProcess (NULL, if (CreateProcess (NULL,
cmdLine, cmdLine,
NULL, NULL,
NULL, NULL,
1, 1,
CREATE_NO_WINDOW, CREATE_NO_WINDOW | CREATE_UNICODE_ENVIRONMENT,
env, env,
wdir, wdir,
&si, &si,
...@@ -317,7 +323,7 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray, ...@@ -317,7 +323,7 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray,
{ {
DWORD dwErrorCode = GetLastError (); DWORD dwErrorCode = GetLastError ();
throw new IOException ( throw new IOException (
_Jv_WinStrError ("Error creating child process", dwErrorCode)); _Jv_WinStrError (_T("Error creating child process"), dwErrorCode));
} }
procHandle = (jint ) pi.hProcess; procHandle = (jint ) pi.hProcess;
......
...@@ -70,18 +70,18 @@ winsock2GetRealNetworkInterfaces (jstring* pjstrName, ...@@ -70,18 +70,18 @@ winsock2GetRealNetworkInterfaces (jstring* pjstrName,
// have access to the real name under Winsock 2, we use // have access to the real name under Winsock 2, we use
// "lo" for the loopback interface and ethX for the // "lo" for the loopback interface and ethX for the
// real ones. // real ones.
char szName[30]; TCHAR szName[30];
u_long lFlags = arInterfaceInfo[i].iiFlags; u_long lFlags = arInterfaceInfo[i].iiFlags;
if (lFlags & IFF_LOOPBACK) if (lFlags & IFF_LOOPBACK)
strcpy (szName, "lo"); _tcscpy (szName, _T("lo"));
else else
{ {
strcpy (szName, "eth"); _tcscpy (szName, _T("eth"));
wsprintf(szName+3, "%d", nCurETHInterface++); wsprintf(szName+3, _T("%d"), nCurETHInterface++);
} }
jstring if_name = JvNewStringLatin1 (szName); jstring if_name = _Jv_Win32NewString (szName);
java::net::Inet4Address* address = java::net::Inet4Address* address =
new java::net::Inet4Address (baddr, JvNewStringLatin1 ("")); new java::net::Inet4Address (baddr, JvNewStringLatin1 (""));
pjstrName[i] = if_name; pjstrName[i] = if_name;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment