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
6afb5f07
Commit
6afb5f07
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_Path.
parent
d6fd86e8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
2 deletions
+48
-2
host.c
programs/wscript/host.c
+14
-2
run.c
programs/wscript/tests/run.c
+33
-0
run.js
programs/wscript/tests/run.js
+1
-0
No files found.
programs/wscript/host.c
View file @
6afb5f07
...
...
@@ -28,6 +28,7 @@
#include "wscript.h"
#include <wine/debug.h>
#include <wine/unicode.h>
#define BUILDVERSION 16535
...
...
@@ -127,8 +128,19 @@ static HRESULT WINAPI Host_get_FullName(IHost *iface, BSTR *out_Path)
static
HRESULT
WINAPI
Host_get_Path
(
IHost
*
iface
,
BSTR
*
out_Path
)
{
WINE_FIXME
(
"(%p)
\n
"
,
out_Path
);
return
E_NOTIMPL
;
WCHAR
path
[
MAX_PATH
];
int
howMany
;
WCHAR
*
pos
;
WINE_TRACE
(
"(%p)
\n
"
,
out_Path
);
if
(
GetModuleFileNameW
(
NULL
,
path
,
sizeof
(
path
)
/
sizeof
(
WCHAR
))
==
0
)
return
E_FAIL
;
pos
=
strrchrW
(
path
,
'\\'
);
howMany
=
pos
-
path
;
if
(
!
(
*
out_Path
=
SysAllocStringLen
(
path
,
howMany
)))
return
E_OUTOFMEMORY
;
return
S_OK
;
}
static
HRESULT
WINAPI
Host_get_Interactive
(
IHost
*
iface
,
VARIANT_BOOL
*
out_Interactive
)
...
...
programs/wscript/tests/run.c
View file @
6afb5f07
...
...
@@ -60,6 +60,7 @@ DEFINE_EXPECT(reportSuccess);
#define DISPID_TESTOBJ_TRACE 10001
#define DISPID_TESTOBJ_REPORTSUCCESS 10002
#define DISPID_TESTOBJ_WSCRIPTFULLNAME 10003
#define DISPID_TESTOBJ_WSCRIPTPATH 10004
#define TESTOBJ_CLSID "{178fc166-f585-4e24-9c13-4bb7faf80646}"
...
...
@@ -75,6 +76,17 @@ static int strcmp_wa(LPCWSTR strw, const char *stra)
return
lstrcmpW
(
strw
,
buf
);
}
static
const
WCHAR
*
mystrrchr
(
const
WCHAR
*
str
,
WCHAR
ch
)
{
const
WCHAR
*
pos
=
NULL
,
*
current
=
str
;
while
(
*
current
!=
0
)
{
if
(
*
current
==
ch
)
pos
=
current
;
++
current
;
}
return
pos
;
}
static
HRESULT
WINAPI
Dispatch_QueryInterface
(
IDispatch
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
if
(
IsEqualGUID
(
riid
,
&
IID_IUnknown
)
||
IsEqualGUID
(
riid
,
&
IID_IDispatch
))
{
...
...
@@ -123,6 +135,8 @@ static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid,
rgDispId
[
i
]
=
DISPID_TESTOBJ_REPORTSUCCESS
;
}
else
if
(
!
strcmp_wa
(
rgszNames
[
i
],
"wscriptFullName"
))
{
rgDispId
[
i
]
=
DISPID_TESTOBJ_WSCRIPTFULLNAME
;
}
else
if
(
!
strcmp_wa
(
rgszNames
[
i
],
"wscriptPath"
))
{
rgDispId
[
i
]
=
DISPID_TESTOBJ_WSCRIPTPATH
;
}
else
{
ok
(
0
,
"unexpected name %s
\n
"
,
wine_dbgstr_w
(
rgszNames
[
i
]));
return
DISP_E_UNKNOWNNAME
;
...
...
@@ -181,6 +195,25 @@ static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REF
return
E_OUTOFMEMORY
;
break
;
}
case
DISPID_TESTOBJ_WSCRIPTPATH
:
{
WCHAR
fullPath
[
MAX_PATH
];
const
WCHAR
wscriptexe
[]
=
{
'w'
,
's'
,
'c'
,
'r'
,
'i'
,
'p'
,
't'
,
'.'
,
'e'
,
'x'
,
'e'
,
0
};
DWORD
res
;
const
WCHAR
*
pos
;
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
=
SearchPathW
(
NULL
,
wscriptexe
,
NULL
,
sizeof
(
fullPath
)
/
sizeof
(
WCHAR
),
fullPath
,
NULL
);
if
(
res
==
0
)
return
E_FAIL
;
pos
=
mystrrchr
(
fullPath
,
'\\'
);
if
(
!
(
V_BSTR
(
pVarResult
)
=
SysAllocStringLen
(
fullPath
,
pos
-
fullPath
)))
return
E_OUTOFMEMORY
;
break
;
}
default:
ok
(
0
,
"unexpected dispIdMember %d
\n
"
,
dispIdMember
);
return
E_NOTIMPL
;
...
...
programs/wscript/tests/run.js
View file @
6afb5f07
...
...
@@ -29,5 +29,6 @@ ok(WScript.Name === "Windows Script Host", "WScript.Name = " + WScript.Name);
ok
(
typeof
(
WScript
.
Version
)
===
"string"
,
"typeof(WScript.Version) = "
+
typeof
(
WScript
.
Version
));
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
);
winetest
.
reportSuccess
();
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