Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
118bee86
Commit
118bee86
authored
Jan 07, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 08, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Implement _wpopen and forward _popen to it.
parent
3debf282
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
25 deletions
+43
-25
msvcrt.h
dlls/msvcrt/msvcrt.h
+1
-0
process.c
dlls/msvcrt/process.c
+42
-25
No files found.
dlls/msvcrt/msvcrt.h
View file @
118bee86
...
@@ -623,6 +623,7 @@ MSVCRT_clock_t MSVCRT_clock(void);
...
@@ -623,6 +623,7 @@ MSVCRT_clock_t MSVCRT_clock(void);
double
MSVCRT_difftime
(
MSVCRT_time_t
time1
,
MSVCRT_time_t
time2
);
double
MSVCRT_difftime
(
MSVCRT_time_t
time1
,
MSVCRT_time_t
time2
);
MSVCRT_time_t
MSVCRT_time
(
MSVCRT_time_t
*
);
MSVCRT_time_t
MSVCRT_time
(
MSVCRT_time_t
*
);
MSVCRT_FILE
*
MSVCRT__fdopen
(
int
,
const
char
*
);
MSVCRT_FILE
*
MSVCRT__fdopen
(
int
,
const
char
*
);
MSVCRT_FILE
*
MSVCRT__wfdopen
(
int
,
const
MSVCRT_wchar_t
*
);
int
MSVCRT_vsnprintf
(
char
*
str
,
unsigned
int
len
,
const
char
*
format
,
va_list
valist
);
int
MSVCRT_vsnprintf
(
char
*
str
,
unsigned
int
len
,
const
char
*
format
,
va_list
valist
);
int
MSVCRT_vsnwprintf
(
MSVCRT_wchar_t
*
str
,
unsigned
int
len
,
int
MSVCRT_vsnwprintf
(
MSVCRT_wchar_t
*
str
,
unsigned
int
len
,
const
MSVCRT_wchar_t
*
format
,
va_list
valist
);
const
MSVCRT_wchar_t
*
format
,
va_list
valist
);
...
...
dlls/msvcrt/process.c
View file @
118bee86
...
@@ -721,22 +721,21 @@ MSVCRT_intptr_t CDECL _wspawnvp(int flags, const MSVCRT_wchar_t* name, const MSV
...
@@ -721,22 +721,21 @@ MSVCRT_intptr_t CDECL _wspawnvp(int flags, const MSVCRT_wchar_t* name, const MSV
}
}
/*********************************************************************
/*********************************************************************
* _popen (MSVCRT.@)
* _wpopen (MSVCRT.@)
* FIXME: convert to _wpopen and call that from here instead? But it
*
* would have to convert the command back to ANSI to call msvcrt_spawn,
* Unicode version of _popen
* less than ideal.
*/
*/
MSVCRT_FILE
*
CDECL
MSVCRT__
popen
(
const
char
*
command
,
const
char
*
mode
)
MSVCRT_FILE
*
CDECL
MSVCRT__
wpopen
(
const
MSVCRT_wchar_t
*
command
,
const
MSVCRT_wchar_t
*
mode
)
{
{
static
const
char
wcmd
[]
=
"cmd"
,
cmdFlag
[]
=
" /C "
,
comSpec
[]
=
"COMSPEC"
;
MSVCRT_FILE
*
ret
;
MSVCRT_FILE
*
ret
;
BOOL
readPipe
=
TRUE
;
BOOL
readPipe
=
TRUE
;
int
textmode
,
fds
[
2
],
fdToDup
,
fdToOpen
,
fdStdHandle
=
-
1
,
fdStdErr
=
-
1
;
int
textmode
,
fds
[
2
],
fdToDup
,
fdToOpen
,
fdStdHandle
=
-
1
,
fdStdErr
=
-
1
;
const
char
*
p
;
const
MSVCRT_wchar_t
*
p
;
char
*
cmdcopy
;
MSVCRT_wchar_t
*
comspec
,
*
fullcmd
;
DWORD
comSpecLen
;
unsigned
int
len
;
static
const
MSVCRT_wchar_t
flag
[]
=
{
' '
,
'/'
,
'c'
,
' '
,
0
};
TRACE
(
"(command=%s, mode=%s)
\n
"
,
debugstr_
a
(
command
),
debugstr_a
(
mode
));
TRACE
(
"(command=%s, mode=%s)
\n
"
,
debugstr_
w
(
command
),
debugstr_w
(
mode
));
if
(
!
command
||
!
mode
)
if
(
!
command
||
!
mode
)
return
NULL
;
return
NULL
;
...
@@ -782,27 +781,27 @@ MSVCRT_FILE* CDECL MSVCRT__popen(const char* command, const char* mode)
...
@@ -782,27 +781,27 @@ MSVCRT_FILE* CDECL MSVCRT__popen(const char* command, const char* mode)
MSVCRT__close
(
fds
[
fdToDup
]);
MSVCRT__close
(
fds
[
fdToDup
]);
comSpecLen
=
GetEnvironmentVariableA
(
comSpec
,
NULL
,
0
)
;
if
(
!
(
comspec
=
msvcrt_get_comspec
()))
goto
error
;
if
(
!
comSpecLen
)
len
=
strlenW
(
comspec
)
+
strlenW
(
flag
)
+
strlenW
(
command
)
+
1
;
comSpecLen
=
strlen
(
wcmd
)
+
1
;
cmdcopy
=
HeapAlloc
(
GetProcessHeap
(),
0
,
comSpecLen
+
strlen
(
cmdFlag
)
if
(
!
(
fullcmd
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
MSVCRT_wchar_t
))))
goto
error
;
+
strlen
(
command
)
);
strcpyW
(
fullcmd
,
comspec
);
if
(
!
GetEnvironmentVariableA
(
comSpec
,
cmdcopy
,
comSpecLen
))
strcatW
(
fullcmd
,
flag
);
strcpy
(
cmdcopy
,
wcm
d
);
strcatW
(
fullcmd
,
comman
d
);
strcat
(
cmdcopy
,
cmdFlag
);
HeapFree
(
GetProcessHeap
(),
0
,
comspec
);
strcat
(
cmdcopy
,
command
);
if
(
msvcrt_spawn
(
MSVCRT__P_NOWAIT
,
NULL
,
cmdcopy
,
NULL
)
==
-
1
)
if
(
msvcrt_spawn
_wide
(
MSVCRT__P_NOWAIT
,
NULL
,
fullcmd
,
NULL
)
==
-
1
)
{
{
MSVCRT__close
(
fds
[
fdToOpen
]);
MSVCRT__close
(
fds
[
fdToOpen
]);
ret
=
NULL
;
ret
=
NULL
;
}
}
else
else
{
{
ret
=
MSVCRT__fdopen
(
fds
[
fdToOpen
],
mode
);
ret
=
MSVCRT__
w
fdopen
(
fds
[
fdToOpen
],
mode
);
if
(
!
ret
)
if
(
!
ret
)
MSVCRT__close
(
fds
[
fdToOpen
]);
MSVCRT__close
(
fds
[
fdToOpen
]);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
cmdcopy
);
HeapFree
(
GetProcessHeap
(),
0
,
fullcmd
);
MSVCRT__dup2
(
fdStdHandle
,
fdToDup
);
MSVCRT__dup2
(
fdStdHandle
,
fdToDup
);
MSVCRT__close
(
fdStdHandle
);
MSVCRT__close
(
fdStdHandle
);
if
(
readPipe
)
if
(
readPipe
)
...
@@ -821,12 +820,30 @@ error:
...
@@ -821,12 +820,30 @@ error:
}
}
/*********************************************************************
/*********************************************************************
*
_w
popen (MSVCRT.@)
*
_
popen (MSVCRT.@)
*/
*/
MSVCRT_FILE
*
CDECL
MSVCRT__
wpopen
(
const
MSVCRT_wchar_t
*
command
,
const
MSVCRT_wchar_t
*
mode
)
MSVCRT_FILE
*
CDECL
MSVCRT__
popen
(
const
char
*
command
,
const
char
*
mode
)
{
{
FIXME
(
"(command=%s, mode=%s): stub
\n
"
,
debugstr_w
(
command
),
debugstr_w
(
mode
));
MSVCRT_FILE
*
ret
;
MSVCRT_wchar_t
*
cmdW
,
*
modeW
;
TRACE
(
"(command=%s, mode=%s)
\n
"
,
debugstr_a
(
command
),
debugstr_a
(
mode
));
if
(
!
command
||
!
mode
)
return
NULL
;
return
NULL
;
if
(
!
(
cmdW
=
msvcrt_wstrdupa
(
command
)))
return
NULL
;
if
(
!
(
modeW
=
msvcrt_wstrdupa
(
mode
)))
{
HeapFree
(
GetProcessHeap
(),
0
,
cmdW
);
return
NULL
;
}
ret
=
MSVCRT__wpopen
(
cmdW
,
modeW
);
HeapFree
(
GetProcessHeap
(),
0
,
cmdW
);
HeapFree
(
GetProcessHeap
(),
0
,
modeW
);
return
ret
;
}
}
/*********************************************************************
/*********************************************************************
...
...
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