Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
50f4edae
Commit
50f4edae
authored
Dec 11, 2006
by
Hans Leidekker
Committed by
Alexandre Julliard
Dec 12, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mscoree: Take advantage of an installed Mono for Windows to run .NET applications.
parent
e9cd221e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
2 deletions
+90
-2
Makefile.in
dlls/mscoree/Makefile.in
+1
-1
mscoree_main.c
dlls/mscoree/mscoree_main.c
+89
-1
No files found.
dlls/mscoree/Makefile.in
View file @
50f4edae
...
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
MODULE
=
mscoree.dll
IMPORTS
=
kernel32
IMPORTS
=
advapi32
kernel32
C_SRCS
=
\
mscoree_main.c
...
...
dlls/mscoree/mscoree_main.c
View file @
50f4edae
...
...
@@ -24,6 +24,7 @@
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winreg.h"
#include "ole2.h"
#include "wine/debug.h"
...
...
@@ -74,10 +75,97 @@ BOOL WINAPI _CorDllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
return
TRUE
;
}
static
LPWSTR
get_mono_exe
()
{
static
const
WCHAR
mono_exe
[]
=
{
'b'
,
'i'
,
'n'
,
'\\'
,
'm'
,
'o'
,
'n'
,
'o'
,
'.'
,
'e'
,
'x'
,
'e'
,
' '
,
0
};
static
const
WCHAR
mono_key
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'N'
,
'o'
,
'v'
,
'e'
,
'l'
,
'l'
,
'\\'
,
'M'
,
'o'
,
'n'
,
'o'
,
0
};
static
const
WCHAR
defaul_clr
[]
=
{
'D'
,
'e'
,
'f'
,
'a'
,
'u'
,
'l'
,
't'
,
'C'
,
'L'
,
'R'
,
0
};
static
const
WCHAR
install_root
[]
=
{
'S'
,
'd'
,
'k'
,
'I'
,
'n'
,
's'
,
't'
,
'a'
,
'l'
,
'l'
,
'R'
,
'o'
,
'o'
,
't'
,
0
};
static
const
WCHAR
slash
[]
=
{
'\\'
,
0
};
WCHAR
version
[
64
],
version_key
[
MAX_PATH
],
root
[
MAX_PATH
],
*
ret
;
DWORD
len
,
size
;
HKEY
key
;
if
(
RegOpenKeyExW
(
HKEY_LOCAL_MACHINE
,
mono_key
,
0
,
KEY_READ
,
&
key
))
return
NULL
;
len
=
sizeof
(
version
);
if
(
RegQueryValueExW
(
key
,
defaul_clr
,
0
,
NULL
,
(
LPBYTE
)
version
,
&
len
))
{
RegCloseKey
(
key
);
return
NULL
;
}
RegCloseKey
(
key
);
lstrcpyW
(
version_key
,
mono_key
);
lstrcatW
(
version_key
,
slash
);
lstrcatW
(
version_key
,
version
);
if
(
RegOpenKeyExW
(
HKEY_LOCAL_MACHINE
,
version_key
,
0
,
KEY_READ
,
&
key
))
return
NULL
;
len
=
sizeof
(
root
);
if
(
RegQueryValueExW
(
key
,
install_root
,
0
,
NULL
,
(
LPBYTE
)
root
,
&
len
))
{
RegCloseKey
(
key
);
return
NULL
;
}
RegCloseKey
(
key
);
size
=
len
+
sizeof
(
slash
)
+
sizeof
(
mono_exe
);
if
(
!
(
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
return
NULL
;
lstrcpyW
(
ret
,
root
);
lstrcatW
(
ret
,
slash
);
lstrcatW
(
ret
,
mono_exe
);
return
ret
;
}
int
WINAPI
_CorExeMain
(
void
)
{
FIXME
(
"Directly running .NET applications not supported.
\n
"
);
STARTUPINFOW
si
;
PROCESS_INFORMATION
pi
;
WCHAR
*
mono_exe
,
*
cmd_line
;
DWORD
size
,
exit_code
;
if
(
!
(
mono_exe
=
get_mono_exe
()))
{
MESSAGE
(
"install the Windows version of Mono to run .NET executables
\n
"
);
return
-
1
;
}
size
=
(
lstrlenW
(
mono_exe
)
+
lstrlenW
(
GetCommandLineW
())
+
1
)
*
sizeof
(
WCHAR
);
if
(
!
(
cmd_line
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
{
HeapFree
(
GetProcessHeap
(),
0
,
mono_exe
);
return
-
1
;
}
lstrcpyW
(
cmd_line
,
mono_exe
);
HeapFree
(
GetProcessHeap
(),
0
,
mono_exe
);
lstrcatW
(
cmd_line
,
GetCommandLineW
());
TRACE
(
"new command line: %s
\n
"
,
debugstr_w
(
cmd_line
));
memset
(
&
si
,
0
,
sizeof
(
si
));
si
.
cb
=
sizeof
(
si
);
if
(
!
CreateProcessW
(
NULL
,
cmd_line
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
si
,
&
pi
))
{
HeapFree
(
GetProcessHeap
(),
0
,
cmd_line
);
return
-
1
;
}
HeapFree
(
GetProcessHeap
(),
0
,
cmd_line
);
/* wait for the process to exit */
WaitForSingleObject
(
pi
.
hProcess
,
INFINITE
);
GetExitCodeProcess
(
pi
.
hProcess
,
&
exit_code
);
CloseHandle
(
pi
.
hThread
);
CloseHandle
(
pi
.
hProcess
);
return
(
int
)
exit_code
;
}
int
WINAPI
_CorExeMain2
(
PBYTE
ptrMemory
,
DWORD
cntMemory
,
LPCWSTR
imageName
,
LPCWSTR
loaderName
,
LPCWSTR
cmdLine
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment