#include <mono/utils/strenc.h>
#include <mono/utils/mono-proclib.h>
#include <mono/io-layer/io-layer.h>
+#if defined (MINGW_CROSS_COMPILE) && defined (HAVE_GETPROCESSID)
+#undef HAVE_GETPROCESSID
+#endif
+#ifndef HAVE_GETPROCESSID
+#if defined(_MSC_VER) || defined(HAVE_WINTERNL_H)
+#include <winternl.h>
+#ifndef NT_SUCCESS
+#define NT_SUCCESS(status) ((NTSTATUS) (status) >= 0)
+#endif /* !NT_SUCCESS */
+#else /* ! (defined(_MSC_VER) || defined(HAVE_WINTERNL_H)) */
+#include <ddk/ntddk.h>
+#include <ddk/ntapi.h>
+#endif /* (defined(_MSC_VER) || defined(HAVE_WINTERNL_H)) */
+#endif /* !HAVE_GETPROCESSID */
/* FIXME: fix this code to not depend so much on the inetrnals */
#include <mono/metadata/class-internals.h>
g_message ("%s: Closing process %p, handle %p", __func__, this, process);
#endif
-#if TARGET_WIN32
+#if defined(TARGET_WIN32) || defined(HOST_WIN32)
CloseHandle (process);
#else
CloseProcess (process);
return TRUE;
}
-#if defined (MINGW_CROSS_COMPILE) && defined (HAVE_GETPROCESSID)
-#undef HAVE_GETPROCESSID
-#endif
-
#ifndef HAVE_GETPROCESSID
/* Run-time GetProcessId detection for Windows */
#ifdef TARGET_WIN32
/* The default dir name is "". Turn that into NULL to mean
* "current directory"
*/
- if(mono_string_length (proc_start_info->working_directory)==0) {
+ if(proc_start_info->working_directory == NULL || mono_string_length (proc_start_info->working_directory)==0) {
dir=NULL;
} else {
dir=mono_string_chars (proc_start_info->working_directory);