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
07f169a9
Commit
07f169a9
authored
Jul 27, 2010
by
Jacek Caban
Committed by
Alexandre Julliard
Jul 28, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wscript.exe: Added parsing script file implmentation.
parent
89ca878d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
2 deletions
+57
-2
Makefile.in
programs/wscript/Makefile.in
+1
-1
main.c
programs/wscript/main.c
+56
-1
No files found.
programs/wscript/Makefile.in
View file @
07f169a9
...
...
@@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH
=
@srcdir@
MODULE
=
wscript.exe
APPMODE
=
-mwindows
-municode
IMPORTS
=
uuid ole32 advapi32
IMPORTS
=
uuid ole
aut32 ole
32 advapi32
EXTRADEFS
=
-DWINE_NO_UNICODE_MACROS
C_SRCS
=
\
...
...
programs/wscript/main.c
View file @
07f169a9
...
...
@@ -225,6 +225,60 @@ static HRESULT init_engine(IActiveScript *script, IActiveScriptParse *parser)
return
SUCCEEDED
(
hres
);
}
static
BSTR
get_script_str
(
const
WCHAR
*
filename
)
{
const
char
*
file_map
;
HANDLE
file
,
map
;
DWORD
size
,
len
;
BSTR
ret
;
file
=
CreateFileW
(
filename
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_READONLY
,
NULL
);
if
(
file
==
INVALID_HANDLE_VALUE
)
return
NULL
;
size
=
GetFileSize
(
file
,
NULL
);
map
=
CreateFileMappingW
(
file
,
NULL
,
PAGE_READONLY
,
0
,
0
,
NULL
);
CloseHandle
(
file
);
if
(
map
==
INVALID_HANDLE_VALUE
)
return
NULL
;
file_map
=
MapViewOfFile
(
map
,
FILE_MAP_READ
,
0
,
0
,
0
);
CloseHandle
(
map
);
if
(
!
file_map
)
return
NULL
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
file_map
,
size
,
NULL
,
0
);
ret
=
SysAllocStringLen
(
NULL
,
len
);
MultiByteToWideChar
(
CP_ACP
,
0
,
file_map
,
size
,
ret
,
len
);
UnmapViewOfFile
(
file_map
);
return
ret
;
}
static
void
run_script
(
const
WCHAR
*
filename
,
IActiveScript
*
script
,
IActiveScriptParse
*
parser
)
{
BSTR
text
;
HRESULT
hres
;
text
=
get_script_str
(
filename
);
if
(
!
text
)
{
WINE_FIXME
(
"Could not get script text
\n
"
);
return
;
}
hres
=
IActiveScriptParse64_ParseScriptText
(
parser
,
text
,
NULL
,
NULL
,
NULL
,
1
,
1
,
SCRIPTTEXT_HOSTMANAGESSOURCE
|
SCRIPTITEM_ISVISIBLE
,
NULL
,
NULL
);
SysFreeString
(
text
);
if
(
FAILED
(
hres
))
{
WINE_FIXME
(
"ParseScriptText failed: %08x
\n
"
,
hres
);
return
;
}
hres
=
IActiveScript_SetScriptState
(
script
,
SCRIPTSTATE_STARTED
);
if
(
FAILED
(
hres
))
WINE_FIXME
(
"SetScriptState failed: %08x
\n
"
,
hres
);
}
int
WINAPI
wWinMain
(
HINSTANCE
hInst
,
HINSTANCE
hPrevInst
,
LPWSTR
cmdline
,
int
cmdshow
)
{
IActiveScriptParse
*
parser
;
...
...
@@ -232,7 +286,7 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cm
const
WCHAR
*
ext
;
CLSID
clsid
;
WINE_
FIXM
E
(
"(%p %p %s %x)
\n
"
,
hInst
,
hPrevInst
,
wine_dbgstr_w
(
cmdline
),
cmdshow
);
WINE_
TRAC
E
(
"(%p %p %s %x)
\n
"
,
hInst
,
hPrevInst
,
wine_dbgstr_w
(
cmdline
),
cmdshow
);
if
(
!*
cmdline
)
return
1
;
...
...
@@ -254,6 +308,7 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cm
}
if
(
init_engine
(
script
,
parser
))
{
run_script
(
cmdline
,
script
,
parser
);
IActiveScript_Close
(
script
);
}
else
{
WINE_FIXME
(
"Script initialization failed
\n
"
);
...
...
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