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
20560f45
Commit
20560f45
authored
Sep 07, 2001
by
Francois Gouget
Committed by
Alexandre Julliard
Sep 07, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initialize argc/argv/wargv by calling ntdll.__wine_get_{w}main_args.
parent
6b9d4ab6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
56 deletions
+11
-56
data.c
dlls/msvcrt/data.c
+11
-56
No files found.
dlls/msvcrt/data.c
View file @
20560f45
...
...
@@ -138,6 +138,9 @@ static WCHAR *wstrdupa(const char *str)
return
wstr
;
}
extern
int
__wine_get_main_args
(
char
***
argv
);
extern
int
__wine_get_wmain_args
(
WCHAR
***
argv
);
/* INTERNAL: Since we can't rely on Winelib startup code calling w/getmainargs,
* we initialise data values during DLL loading. When called by a native
* program we simply return the data we've already initialised. This also means
...
...
@@ -145,19 +148,18 @@ static WCHAR *wstrdupa(const char *str)
*/
void
msvcrt_init_args
(
void
)
{
char
*
cmdline
,
**
xargv
=
NULL
,
*
ptr
;
WCHAR
*
w
cmdline
,
**
wxargv
=
NULL
,
*
w
ptr
;
int
xargc
,
end
,
last_arg
,
afterlastspace
,
count
;
char
*
ptr
;
WCHAR
*
wptr
;
int
count
;
DWORD
version
;
MSVCRT__acmdln
=
_strdup
(
GetCommandLineA
()
);
MSVCRT__wcmdln
=
wcmdline
=
wstrdupa
(
MSVCRT__acmdln
);
/* Make a copy of MSVCRT__acmdln to be able modify it.
We will free it at the end of processing. */
cmdline
=
_strdup
(
MSVCRT__acmdln
);
MSVCRT__wcmdln
=
wstrdupa
(
MSVCRT__acmdln
);
MSVCRT___argc
=
__wine_get_main_args
(
&
MSVCRT___argv
);
__wine_get_wmain_args
(
&
MSVCRT___wargv
);
TRACE
(
"got '%s', wide = %s
\n
"
,
cmdline
,
debugstr_w
(
wcmdline
));
TRACE
(
"got '%s', wide = %s argc=%d
\n
"
,
MSVCRT__acmdln
,
debugstr_w
(
MSVCRT__wcmdln
),
MSVCRT___argc
);
version
=
GetVersion
();
MSVCRT__osver
=
version
>>
16
;
...
...
@@ -178,53 +180,6 @@ void msvcrt_init_args(void)
/* FIXME: set app type for Winelib apps */
end
=
last_arg
=
xargc
=
afterlastspace
=
0
;
while
(
1
)
{
if
((
cmdline
[
end
]
==
' '
)
||
(
cmdline
[
end
]
==
'\0'
))
{
if
(
cmdline
[
end
]
==
'\0'
)
last_arg
=
1
;
else
cmdline
[
end
]
=
'\0'
;
/* alloc xargc + NULL entry */
xargv
=
(
char
**
)
HeapReAlloc
(
GetProcessHeap
(),
0
,
xargv
,
sizeof
(
char
*
)
*
(
xargc
+
1
));
wxargv
=
(
WCHAR
**
)
HeapReAlloc
(
GetProcessHeap
(),
0
,
wxargv
,
sizeof
(
WCHAR
*
)
*
(
xargc
+
1
));
if
(
strlen
(
cmdline
+
afterlastspace
))
{
xargv
[
xargc
]
=
_strdup
(
cmdline
+
afterlastspace
);
wxargv
[
xargc
]
=
wstrdupa
(
xargv
[
xargc
]);
xargc
++
;
if
(
!
last_arg
)
/* need to seek to the next arg ? */
{
end
++
;
while
(
cmdline
[
end
]
==
' '
)
end
++
;
}
afterlastspace
=
end
;
}
else
{
xargv
[
xargc
]
=
NULL
;
wxargv
[
xargc
]
=
NULL
;
/* the last entry is NULL */
break
;
}
}
else
end
++
;
}
MSVCRT___argc
=
xargc
;
MSVCRT___argv
=
xargv
;
MSVCRT___wargv
=
wxargv
;
/* Free a no more needed copy of the command line */
MSVCRT_free
(
cmdline
);
TRACE
(
"found %d arguments
\n
"
,
MSVCRT___argc
);
environ_strings
=
GetEnvironmentStringsA
();
count
=
1
;
/* for NULL sentinel */
for
(
ptr
=
environ_strings
;
*
ptr
;
ptr
+=
strlen
(
ptr
)
+
1
)
...
...
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