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
bf331f8d
Commit
bf331f8d
authored
Jul 20, 2011
by
Michał Ziętek
Committed by
Alexandre Julliard
Jul 21, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wscript: Implemented Host_get_ScriptName.
parent
6afb5f07
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
2 deletions
+49
-2
host.c
programs/wscript/host.c
+9
-2
main.c
programs/wscript/main.c
+5
-0
run.c
programs/wscript/tests/run.c
+32
-0
run.js
programs/wscript/tests/run.js
+1
-0
wscript.h
programs/wscript/wscript.h
+2
-0
No files found.
programs/wscript/host.c
View file @
bf331f8d
...
...
@@ -163,8 +163,15 @@ static HRESULT WINAPI Host_Quit(IHost *iface, int ExitCode)
static
HRESULT
WINAPI
Host_get_ScriptName
(
IHost
*
iface
,
BSTR
*
out_ScriptName
)
{
WINE_FIXME
(
"(%p)
\n
"
,
out_ScriptName
);
return
E_NOTIMPL
;
WCHAR
*
scriptName
;
WINE_TRACE
(
"(%p)
\n
"
,
out_ScriptName
);
scriptName
=
strrchrW
(
scriptFullName
,
'\\'
);
++
scriptName
;
if
(
!
(
*
out_ScriptName
=
SysAllocString
(
scriptName
)))
return
E_OUTOFMEMORY
;
return
S_OK
;
}
static
HRESULT
WINAPI
Host_get_ScriptFullName
(
IHost
*
iface
,
BSTR
*
out_ScriptFullName
)
...
...
programs/wscript/main.c
View file @
bf331f8d
...
...
@@ -36,6 +36,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wscript);
static
const
WCHAR
wscriptW
[]
=
{
'W'
,
'S'
,
'c'
,
'r'
,
'i'
,
'p'
,
't'
,
0
};
static
const
WCHAR
wshW
[]
=
{
'W'
,
'S'
,
'H'
,
0
};
WCHAR
scriptFullName
[
MAX_PATH
];
ITypeInfo
*
host_ti
;
...
...
@@ -326,6 +327,7 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cm
WCHAR
**
argv
;
CLSID
clsid
;
int
argc
,
i
;
DWORD
res
;
WINE_TRACE
(
"(%p %p %s %x)
\n
"
,
hInst
,
hPrevInst
,
wine_dbgstr_w
(
cmdline
),
cmdshow
);
...
...
@@ -346,6 +348,9 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cm
WINE_FIXME
(
"No file name specified
\n
"
);
return
1
;
}
res
=
GetFullPathNameW
(
filename
,
sizeof
(
scriptFullName
)
/
sizeof
(
WCHAR
),
scriptFullName
,
NULL
);
if
(
!
res
||
res
>
sizeof
(
scriptFullName
)
/
sizeof
(
WCHAR
))
return
1
;
ext
=
strchrW
(
filename
,
'.'
);
if
(
!
ext
)
...
...
programs/wscript/tests/run.c
View file @
bf331f8d
...
...
@@ -61,6 +61,7 @@ DEFINE_EXPECT(reportSuccess);
#define DISPID_TESTOBJ_REPORTSUCCESS 10002
#define DISPID_TESTOBJ_WSCRIPTFULLNAME 10003
#define DISPID_TESTOBJ_WSCRIPTPATH 10004
#define DISPID_TESTOBJ_WSCRIPTSCRIPTNAME 10005
#define TESTOBJ_CLSID "{178fc166-f585-4e24-9c13-4bb7faf80646}"
...
...
@@ -87,6 +88,18 @@ static const WCHAR* mystrrchr(const WCHAR *str, WCHAR ch)
return
pos
;
}
static
BSTR
a2bstr
(
const
char
*
str
)
{
BSTR
ret
;
int
len
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
);
ret
=
SysAllocStringLen
(
NULL
,
len
-
1
);
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
ret
,
len
);
return
ret
;
}
static
HRESULT
WINAPI
Dispatch_QueryInterface
(
IDispatch
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
if
(
IsEqualGUID
(
riid
,
&
IID_IUnknown
)
||
IsEqualGUID
(
riid
,
&
IID_IDispatch
))
{
...
...
@@ -137,6 +150,8 @@ static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid,
rgDispId
[
i
]
=
DISPID_TESTOBJ_WSCRIPTFULLNAME
;
}
else
if
(
!
strcmp_wa
(
rgszNames
[
i
],
"wscriptPath"
))
{
rgDispId
[
i
]
=
DISPID_TESTOBJ_WSCRIPTPATH
;
}
else
if
(
!
strcmp_wa
(
rgszNames
[
i
],
"wscriptScriptName"
))
{
rgDispId
[
i
]
=
DISPID_TESTOBJ_WSCRIPTSCRIPTNAME
;
}
else
{
ok
(
0
,
"unexpected name %s
\n
"
,
wine_dbgstr_w
(
rgszNames
[
i
]));
return
DISP_E_UNKNOWNNAME
;
...
...
@@ -214,6 +229,23 @@ static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REF
return
E_OUTOFMEMORY
;
break
;
}
case
DISPID_TESTOBJ_WSCRIPTSCRIPTNAME
:
{
char
fullPath
[
MAX_PATH
];
char
*
pos
;
long
res
;
ok
(
wFlags
==
INVOKE_PROPERTYGET
,
"wFlags = %x
\n
"
,
wFlags
);
ok
(
pdp
->
cArgs
==
0
,
"cArgs = %d
\n
"
,
pdp
->
cArgs
);
ok
(
!
pdp
->
cNamedArgs
,
"cNamedArgs = %d
\n
"
,
pdp
->
cNamedArgs
);
V_VT
(
pVarResult
)
=
VT_BSTR
;
res
=
GetFullPathNameA
(
script_name
,
sizeof
(
fullPath
)
/
sizeof
(
WCHAR
),
fullPath
,
&
pos
);
if
(
!
res
||
res
>
sizeof
(
fullPath
)
/
sizeof
(
WCHAR
))
return
E_FAIL
;
if
(
!
(
V_BSTR
(
pVarResult
)
=
SysAllocString
(
a2bstr
(
pos
))))
return
E_OUTOFMEMORY
;
break
;
}
default:
ok
(
0
,
"unexpected dispIdMember %d
\n
"
,
dispIdMember
);
return
E_NOTIMPL
;
...
...
programs/wscript/tests/run.js
View file @
bf331f8d
...
...
@@ -30,5 +30,6 @@ ok(typeof(WScript.Version) === "string", "typeof(WScript.Version) = " + typeof(W
ok
(
typeof
(
WScript
.
BuildVersion
)
===
"number"
,
"typeof(WScript.BuldVersion) = "
+
typeof
(
WScript
.
BuldVersion
));
ok
(
WScript
.
FullName
===
winetest
.
wscriptFullName
,
"WScript.FullName = "
,
WScript
.
FullName
);
ok
(
WScript
.
Path
===
winetest
.
wscriptPath
,
"WScript.Path = "
,
WScript
.
Path
);
ok
(
WScript
.
ScriptName
===
winetest
.
wscriptScriptName
,
"WScript.ScriptName = "
+
WScript
.
ScriptName
);
winetest
.
reportSuccess
();
programs/wscript/wscript.h
View file @
bf331f8d
...
...
@@ -21,3 +21,5 @@
extern
IHost
host_obj
;
extern
ITypeInfo
*
host_ti
;
extern
WCHAR
scriptFullName
[];
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