Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
2269f5a7
Commit
2269f5a7
authored
Sep 07, 2004
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for launcher.exe
parent
193f902e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
PC/WinMain.c
PC/WinMain.c
+30
-0
No files found.
PC/WinMain.c
View file @
2269f5a7
...
...
@@ -2,9 +2,25 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <fcntl.h>
#include "Python.h"
#ifdef LAUNCHER
/* Q105305 suggests this routine to adjust the handles. */
static
void
adjust_file
(
DWORD
handle
,
FILE
*
f
,
char
*
mode
)
{
int
hCrt
;
FILE
*
hf
;
hCrt
=
_open_osfhandle
((
intptr_t
)
GetStdHandle
(
handle
),
_O_TEXT
);
hf
=
_fdopen
(
hCrt
,
mode
);
*
f
=
*
hf
;
setvbuf
(
f
,
NULL
,
_IONBF
,
0
);
/* Alternatively, we could use __set_app_type and _set_osfhnd,
but that appears to be undocumented. */
}
#endif
int
WINAPI
WinMain
(
HINSTANCE
hInstance
,
/* handle to current instance */
HINSTANCE
hPrevInstance
,
/* handle to previous instance */
...
...
@@ -12,5 +28,19 @@ int WINAPI WinMain(
int
nCmdShow
/* show state of window */
)
{
#ifdef LAUNCHER
int
i
;
if
(
__argc
>
1
&&
strcmp
(
__argv
[
1
],
"-console"
)
==
0
)
{
/* Allocate a console, and remove the -console argument. */
AllocConsole
();
for
(
i
=
2
;
i
<
__argc
;
i
++
)
__argv
[
i
-
1
]
=
__argv
[
i
];
__argc
--
;
/* Make stdin, stdout, stderr use the newly allocated OS handles. */
adjust_file
(
STD_INPUT_HANDLE
,
stdin
,
"r"
);
adjust_file
(
STD_OUTPUT_HANDLE
,
stdout
,
"w"
);
adjust_file
(
STD_ERROR_HANDLE
,
stderr
,
"w"
);
}
#endif
return
Py_Main
(
__argc
,
__argv
);
}
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