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
39e972b5
Commit
39e972b5
authored
Apr 07, 2014
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Apr 07, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
taskschd: Make ITaskFolder::CreateFolder, ITaskFolder::GetFolder and…
taskschd: Make ITaskFolder::CreateFolder, ITaskFolder::GetFolder and ITaskFolder::DeleteFolder use the RPC API.
parent
3b63733b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
23 deletions
+75
-23
folder.c
dlls/taskschd/folder.c
+75
-22
scheduler.c
dlls/taskschd/tests/scheduler.c
+0
-1
No files found.
dlls/taskschd/folder.c
View file @
39e972b5
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include "winreg.h"
#include "winreg.h"
#include "objbase.h"
#include "objbase.h"
#include "taskschd.h"
#include "taskschd.h"
#include "schrpc.h"
#include "taskschd_private.h"
#include "taskschd_private.h"
#include "wine/unicode.h"
#include "wine/unicode.h"
...
@@ -273,9 +274,47 @@ static HRESULT WINAPI TaskFolder_CreateFolder(ITaskFolder *iface, BSTR path, VAR
...
@@ -273,9 +274,47 @@ static HRESULT WINAPI TaskFolder_CreateFolder(ITaskFolder *iface, BSTR path, VAR
return
hr
;
return
hr
;
}
}
static
WCHAR
*
get_full_path
(
const
WCHAR
*
parent
,
const
WCHAR
*
path
)
{
static
const
WCHAR
bslash
[]
=
{
'\\'
,
0
};
WCHAR
*
folder_path
;
int
len
=
0
;
if
(
path
)
len
=
strlenW
(
path
);
if
(
parent
)
len
+=
strlenW
(
parent
);
/* +1 if parent is not '\' terminated */
folder_path
=
heap_alloc
((
len
+
2
)
*
sizeof
(
WCHAR
));
if
(
!
folder_path
)
return
NULL
;
folder_path
[
0
]
=
0
;
if
(
parent
)
strcpyW
(
folder_path
,
parent
);
if
(
path
&&
*
path
)
{
len
=
strlenW
(
folder_path
);
if
(
!
len
||
folder_path
[
len
-
1
]
!=
'\\'
)
strcatW
(
folder_path
,
bslash
);
while
(
*
path
==
'\\'
)
path
++
;
strcatW
(
folder_path
,
path
);
}
len
=
strlenW
(
folder_path
);
if
(
!
len
)
strcatW
(
folder_path
,
bslash
);
return
folder_path
;
}
static
HRESULT
WINAPI
TaskFolder_DeleteFolder
(
ITaskFolder
*
iface
,
BSTR
name
,
LONG
flags
)
static
HRESULT
WINAPI
TaskFolder_DeleteFolder
(
ITaskFolder
*
iface
,
BSTR
name
,
LONG
flags
)
{
{
TaskFolder
*
folder
=
impl_from_ITaskFolder
(
iface
);
TaskFolder
*
folder
=
impl_from_ITaskFolder
(
iface
);
WCHAR
*
folder_path
;
HRESULT
hr
;
TRACE
(
"%p,%s,%x
\n
"
,
iface
,
debugstr_w
(
name
),
flags
);
TRACE
(
"%p,%s,%x
\n
"
,
iface
,
debugstr_w
(
name
),
flags
);
...
@@ -284,6 +323,13 @@ static HRESULT WINAPI TaskFolder_DeleteFolder(ITaskFolder *iface, BSTR name, LON
...
@@ -284,6 +323,13 @@ static HRESULT WINAPI TaskFolder_DeleteFolder(ITaskFolder *iface, BSTR name, LON
if
(
flags
)
if
(
flags
)
FIXME
(
"unsupported flags %x
\n
"
,
flags
);
FIXME
(
"unsupported flags %x
\n
"
,
flags
);
folder_path
=
get_full_path
(
folder
->
path
,
name
);
if
(
!
folder_path
)
return
E_OUTOFMEMORY
;
hr
=
SchRpcDelete
(
folder_path
,
0
);
heap_free
(
folder_path
);
if
(
hr
!=
S_OK
)
return
hr
;
return
reg_delete_folder
(
folder
->
path
,
name
);
return
reg_delete_folder
(
folder
->
path
,
name
);
}
}
...
@@ -403,43 +449,50 @@ static const ITaskFolderVtbl TaskFolder_vtbl =
...
@@ -403,43 +449,50 @@ static const ITaskFolderVtbl TaskFolder_vtbl =
HRESULT
TaskFolder_create
(
const
WCHAR
*
parent
,
const
WCHAR
*
path
,
ITaskFolder
**
obj
,
BOOL
create
)
HRESULT
TaskFolder_create
(
const
WCHAR
*
parent
,
const
WCHAR
*
path
,
ITaskFolder
**
obj
,
BOOL
create
)
{
{
static
const
WCHAR
bslash
[]
=
{
'\\'
,
0
};
TaskFolder
*
folder
;
TaskFolder
*
folder
;
WCHAR
*
folder_path
;
WCHAR
*
folder_path
;
int
len
=
0
;
HRESULT
hr
;
HRESULT
hr
;
HKEY
hfolder
;
HKEY
hfolder
;
if
(
path
)
if
(
path
)
{
{
len
=
strlenW
(
path
);
int
len
=
strlenW
(
path
);
if
(
len
&&
path
[
len
-
1
]
==
'\\'
)
return
ERROR_INVALID_NAME
;
if
(
len
&&
path
[
len
-
1
]
==
'\\'
)
return
ERROR_INVALID_NAME
;
}
}
if
(
parent
)
len
+=
strlenW
(
parent
);
folder_path
=
get_full_path
(
parent
,
path
);
/* +1 if parent is not '\' terminated */
folder_path
=
heap_alloc
((
len
+
2
)
*
sizeof
(
WCHAR
));
if
(
!
folder_path
)
return
E_OUTOFMEMORY
;
if
(
!
folder_path
)
return
E_OUTOFMEMORY
;
folder_path
[
0
]
=
0
;
if
(
create
)
if
(
parent
)
strcpyW
(
folder_path
,
parent
);
if
(
path
&&
*
path
)
{
{
len
=
strlenW
(
folder_path
);
hr
=
SchRpcCreateFolder
(
folder_path
,
NULL
,
0
);
if
(
!
len
||
folder_path
[
len
-
1
]
!=
'\\'
)
}
strcatW
(
folder_path
,
bslash
);
else
{
while
(
*
path
==
'\\'
)
path
++
;
DWORD
start_index
,
count
,
i
;
strcatW
(
folder_path
,
path
);
TASK_NAMES
names
;
start_index
=
0
;
names
=
NULL
;
hr
=
SchRpcEnumFolders
(
folder_path
,
0
,
&
start_index
,
0
,
&
count
,
&
names
);
if
(
hr
==
S_OK
)
{
for
(
i
=
0
;
i
<
count
;
i
++
)
MIDL_user_free
(
names
[
i
]);
MIDL_user_free
(
names
);
}
else
{
if
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
))
hr
=
HRESULT_FROM_WIN32
(
ERROR_PATH_NOT_FOUND
);
}
}
}
len
=
strlenW
(
folder_path
);
if
(
FAILED
(
hr
))
if
(
!
len
)
{
strcatW
(
folder_path
,
bslash
);
heap_free
(
folder_path
);
return
hr
;
}
hr
=
create
?
reg_create_folder
(
folder_path
,
&
hfolder
)
:
reg_open_folder
(
folder_path
,
&
hfolder
);
hr
=
create
?
reg_create_folder
(
folder_path
,
&
hfolder
)
:
reg_open_folder
(
folder_path
,
&
hfolder
);
if
(
hr
)
if
(
hr
)
...
...
dlls/taskschd/tests/scheduler.c
View file @
39e972b5
...
@@ -341,7 +341,6 @@ todo_wine
...
@@ -341,7 +341,6 @@ todo_wine
ITaskFolder_Release
(
subfolder
);
ITaskFolder_Release
(
subfolder
);
hr
=
ITaskFolder_DeleteFolder
(
folder
,
Wine
,
0
);
hr
=
ITaskFolder_DeleteFolder
(
folder
,
Wine
,
0
);
todo_wine
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_DIR_NOT_EMPTY
),
"expected ERROR_DIR_NOT_EMPTY, got %#x
\n
"
,
hr
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_DIR_NOT_EMPTY
),
"expected ERROR_DIR_NOT_EMPTY, got %#x
\n
"
,
hr
);
hr
=
ITaskFolder_DeleteFolder
(
folder
,
Wine_Folder1_Folder2
,
0
);
hr
=
ITaskFolder_DeleteFolder
(
folder
,
Wine_Folder1_Folder2
,
0
);
...
...
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