2 * Copyright 2014 Dmitry Timoshkov
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #include "wine/test.h"
28 extern handle_t rpc_handle
;
30 static LONG CALLBACK
rpc_exception_filter(EXCEPTION_POINTERS
*ptrs
)
32 skip("Can't connect to Scheduler service: %#x\n", ptrs
->ExceptionRecord
->ExceptionCode
);
36 fprintf(stdout
, "rpcapi: 0 tests executed (0 marked as todo, 0 failures), 1 skipped.\n");
44 static unsigned char ncalrpc
[] = "ncalrpc";
45 static const WCHAR empty
[] = { 0 };
46 static const WCHAR Wine
[] = { '\\','W','i','n','e',0 };
47 static const WCHAR Wine_Folder1
[] = { '\\','W','i','n','e','\\','F','o','l','d','e','r','1',0 };
48 static const WCHAR Wine_Folder2
[] = { '\\','W','i','n','e','\\','F','o','l','d','e','r','2',0 };
49 static const WCHAR Folder1
[] = { 'F','o','l','d','e','r','1',0 };
50 static const WCHAR Folder2
[] = { 'F','o','l','d','e','r','2',0 };
51 static const WCHAR Wine_Task1
[] = { '\\','W','i','n','e','\\','T','a','s','k','1',0 };
52 static const WCHAR Wine_Task2
[] = { '\\','W','i','n','e','\\','T','a','s','k','2',0 };
53 static const WCHAR Wine_Task3
[] = { '\\','W','i','n','e','\\','T','a','s','k','3',0 };
54 static const WCHAR Wine_Folder1_Task1
[] = { '\\','W','i','n','e','\\','F','o','l','d','e','r','1','\\','T','a','s','k','1',0 };
55 static const WCHAR Task1
[] = { 'T','a','s','k','1',0 };
56 static const WCHAR Task2
[] = { 'T','a','s','k','2',0 };
57 static const WCHAR Task3
[] = { 'T','a','s','k','3',0 };
58 static const char xml1
[] =
59 "<?xml version=\"1.0\"?>\n"
60 "<Task xmlns=\"http://schemas.microsoft.com/windows/2004/02/mit/task\">\n"
61 " <RegistrationInfo>\n"
62 " <Description>\"Task1\"</Description>\n"
63 " </RegistrationInfo>\n"
65 " <Enabled>false</Enabled>\n"
66 " <Hidden>false</Hidden>\n"
70 " <Command>\"task1.exe\"</Command>\n"
80 { TASK_CREATE
, S_OK
},
81 { TASK_UPDATE
, 0x80070002 /* HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) */ },
82 { TASK_CREATE
| TASK_UPDATE
, S_OK
}
87 } open_existing_task
[] =
89 { 0, 0x800700b7 /* HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS) */ },
90 { TASK_CREATE
, 0x800700b7 /* HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS) */ },
91 { TASK_UPDATE
, S_OK
},
92 { TASK_CREATE
| TASK_UPDATE
, S_OK
}
94 WCHAR xmlW
[sizeof(xml1
)], *xml
;
96 DWORD version
, start_index
, count
, i
, enumed
, enabled
, state
;
98 TASK_XML_ERROR_INFO
*info
;
100 unsigned char *binding_str
;
101 PTOP_LEVEL_EXCEPTION_FILTER old_exception_filter
;
104 hr
= RpcStringBindingComposeA(NULL
, ncalrpc
, NULL
, NULL
, NULL
, &binding_str
);
105 ok(hr
== RPC_S_OK
, "RpcStringBindingCompose error %#x\n", hr
);
106 hr
= RpcBindingFromStringBindingA(binding_str
, &rpc_handle
);
107 ok(hr
== RPC_S_OK
, "RpcBindingFromStringBinding error %#x\n", hr
);
108 hr
= RpcStringFreeA(&binding_str
);
109 ok(hr
== RPC_S_OK
, "RpcStringFree error %#x\n", hr
);
111 /* widl generated RpcTryExcept/RpcExcept can't catch raised exceptions */
112 old_exception_filter
= SetUnhandledExceptionFilter(rpc_exception_filter
);
115 hr
= SchRpcHighestVersion(&version
);
116 ok(version
== 0x10002 /* vista */ || version
== 0x10003 /* win7 */ || version
== 0x10004 /* win8 */,
117 "wrong version %#x\n", version
);
119 SetUnhandledExceptionFilter(old_exception_filter
);
121 hr
= SchRpcCreateFolder(Wine_Folder1
, NULL
, 1);
122 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got %#x\n", hr
);
124 hr
= SchRpcCreateFolder(Wine_Folder1
, NULL
, 0);
125 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
127 hr
= SchRpcCreateFolder(Wine_Folder1
, NULL
, 0);
128 ok(hr
== HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS
), "expected ERROR_ALREADY_EXISTS, got %#x\n", hr
);
130 hr
= SchRpcCreateFolder(Wine_Folder2
+1, empty
, 0);
131 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
133 hr
= SchRpcDelete(Wine
+1, 0);
134 ok(hr
== HRESULT_FROM_WIN32(ERROR_DIR_NOT_EMPTY
), "expected ERROR_DIR_NOT_EMPTY, got %#x\n", hr
);
136 hr
= SchRpcDelete(Wine_Folder1
+1, 1);
137 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got %#x\n", hr
);
139 hr
= SchRpcDelete(Wine_Folder1
+1, 0);
140 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
142 hr
= SchRpcDelete(Wine_Folder2
, 0);
143 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
145 hr
= SchRpcDelete(Wine
, 0);
146 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
148 hr
= SchRpcDelete(Wine
, 0);
149 ok(hr
== HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND
), "expected ERROR_FILE_NOT_FOUND, got %#x\n", hr
);
151 hr
= SchRpcDelete(empty
, 0);
152 ok(hr
== E_ACCESSDENIED
/* win7 */ || hr
== E_INVALIDARG
/* vista */, "expected E_ACCESSDENIED, got %#x\n", hr
);
154 hr
= SchRpcCreateFolder(Wine
, NULL
, 0);
155 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
157 MultiByteToWideChar(CP_ACP
, 0, xml1
, -1, xmlW
, sizeof(xmlW
)/sizeof(xmlW
[0]));
161 hr
= SchRpcRegisterTask(Wine
+1, xmlW
, TASK_VALIDATE_ONLY
, NULL
, TASK_LOGON_NONE
, 0, NULL
, &path
, &info
);
162 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
163 ok(!path
, "expected NULL, path %p\n", path
);
164 ok(!info
, "expected NULL, info %p\n", info
);
166 for (i
= 0; i
< sizeof(create_new_task
)/sizeof(create_new_task
[0]); i
++)
170 hr
= SchRpcRegisterTask(Wine_Task1
, xmlW
, create_new_task
[i
].flags
, NULL
, TASK_LOGON_NONE
, 0, NULL
, &path
, &info
);
171 ok(hr
== create_new_task
[i
].hr
, "%u: expected %#x, got %#x\n", i
, create_new_task
[i
].hr
, hr
);
175 hr
= SchRpcDelete(Wine_Task1
, 0);
176 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
177 ok(!info
, "expected NULL, info %p\n", info
);
178 MIDL_user_free(path
);
184 hr
= SchRpcRegisterTask(Wine_Task1
, xmlW
, TASK_VALIDATE_ONLY
, NULL
, TASK_LOGON_NONE
, 0, NULL
, &path
, &info
);
185 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
186 ok(!path
, "expected NULL, path %p\n", path
);
187 ok(!info
, "expected NULL, info %p\n", info
);
191 hr
= SchRpcRegisterTask(NULL
, xmlW
, TASK_VALIDATE_ONLY
, NULL
, TASK_LOGON_NONE
, 0, NULL
, &path
, &info
);
192 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
193 ok(!path
, "expected NULL, path %p\n", path
);
194 ok(!info
, "expected NULL, info %p\n", info
);
198 hr
= SchRpcRegisterTask(Wine_Folder1_Task1
+1, xmlW
, TASK_CREATE
, NULL
, TASK_LOGON_NONE
, 0, NULL
, &path
, &info
);
199 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
200 ok(!lstrcmpW(path
, Wine_Folder1_Task1
) /* win7 */ || !lstrcmpW(path
, Wine_Folder1_Task1
+1) /* vista */,
201 "expected \\Wine\\Folder1\\Task1, task actual path %s\n", wine_dbgstr_w(path
));
202 ok(!info
, "expected NULL, info %p\n", info
);
203 MIDL_user_free(path
);
205 for (i
= 0; i
< sizeof(open_existing_task
)/sizeof(open_existing_task
[0]); i
++)
209 hr
= SchRpcRegisterTask(Wine_Folder1_Task1
+1, xmlW
, open_existing_task
[i
].flags
, NULL
, TASK_LOGON_NONE
, 0, NULL
, &path
, &info
);
210 ok(hr
== open_existing_task
[i
].hr
, "%u: expected %#x, got %#x\n", i
, open_existing_task
[i
].hr
, hr
);
213 ok(!lstrcmpW(path
, Wine_Folder1_Task1
) /* win7 */ || !lstrcmpW(path
, Wine_Folder1_Task1
+1) /* vista */,
214 "expected \\Wine\\Folder1\\Task1, task actual path %s\n", wine_dbgstr_w(path
));
215 MIDL_user_free(path
);
218 ok(!path
, "%u: expected NULL, path %p\n", i
, path
);
219 ok(!info
, "%u: expected NULL, info %p\n", i
, info
);
224 hr
= SchRpcRegisterTask(Wine_Folder1_Task1
+1, xmlW
, TASK_CREATE
, NULL
, TASK_LOGON_NONE
, 0, NULL
, &path
, &info
);
225 ok(hr
== HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS
), "expected ERROR_ALREADY_EXISTS, got %#x\n", hr
);
226 ok(!path
, "expected NULL, path %p\n", path
);
227 ok(!info
, "expected NULL, info %p\n", info
);
231 hr
= SchRpcRetrieveTask(Wine_Folder1_Task1
, empty
, &count
, &xml
);
232 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
233 if (hr
== S_OK
) trace("%s\n", wine_dbgstr_w(xml
));
236 hr
= SchRpcDelete(Wine_Folder1_Task1
+1, 0);
237 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
238 hr
= SchRpcDelete(Wine_Folder1
+1, 0);
239 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
240 hr
= SchRpcDelete(Wine
+1, 0);
241 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
246 hr
= SchRpcEnumFolders(Wine
, TASK_ENUM_HIDDEN
, &start_index
, 0, &count
, &names
);
247 ok(hr
== HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND
), "expected ERROR_FILE_NOT_FOUND, got %#x\n", hr
);
248 ok(!count
, "expected 0, got %u\n", count
);
249 ok(!start_index
, "expected 0, got %u\n", start_index
);
250 ok(!names
, "expected NULL, got %p\n", names
);
252 hr
= SchRpcCreateFolder(Wine
, NULL
, 0);
253 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
258 hr
= SchRpcEnumFolders(Wine
, 0, &start_index
, 0, &count
, &names
);
259 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
260 ok(!count
, "expected 0, got %u\n", count
);
261 ok(!start_index
, "expected 0, got %u\n", start_index
);
262 ok(!names
, "expected NULL, got %p\n", names
);
264 hr
= SchRpcCreateFolder(Wine_Folder1
, NULL
, 0);
265 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
266 hr
= SchRpcCreateFolder(Wine_Folder2
, NULL
, 0);
267 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
272 hr
= SchRpcEnumFolders(Wine
, 0, &start_index
, 0, &count
, &names
);
273 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
274 ok(count
== 2, "expected 2, got %u\n", count
);
275 ok(start_index
== 2, "expected 2, got %u\n", start_index
);
276 ok(names
!= NULL
, "names should not be NULL\n");
278 for (i
= 0; i
< count
; i
++)
280 if (!lstrcmpW(names
[i
], Folder1
))
282 else if (!lstrcmpW(names
[i
], Folder2
))
284 MIDL_user_free(names
[i
]);
286 MIDL_user_free(names
);
287 ok(enumed
== 3, "expected 3, got %u\n", enumed
);
292 hr
= SchRpcEnumFolders(Wine
, 0, &start_index
, 1, &count
, &names
);
293 ok(hr
== S_FALSE
, "expected S_FALSE, got %#x\n", hr
);
294 ok(count
== 1, "expected 1, got %u\n", count
);
295 ok(start_index
== 1, "expected 1, got %u\n", start_index
);
296 ok(names
!= NULL
, "names should not be NULL\n");
297 ok(!lstrcmpW(names
[0], Folder1
), "expected Folder1, got %s\n", wine_dbgstr_w(names
[0]));
298 MIDL_user_free(names
[0]);
299 MIDL_user_free(names
);
304 hr
= SchRpcEnumFolders(Wine
, 0, &start_index
, 2, &count
, &names
);
305 ok(hr
== S_FALSE
, "expected S_FALSE, got %#x\n", hr
);
306 ok(count
== 2, "expected 2, got %u\n", count
);
307 ok(start_index
== 2, "expected 2, got %u\n", start_index
);
308 ok(names
!= NULL
, "names should not be NULL\n");
310 for (i
= 0; i
< count
; i
++)
312 if (!lstrcmpW(names
[i
], Folder1
))
314 else if (!lstrcmpW(names
[i
], Folder2
))
316 MIDL_user_free(names
[i
]);
318 MIDL_user_free(names
);
319 ok(enumed
== 3, "expected 3, got %u\n", enumed
);
324 hr
= SchRpcEnumFolders(Wine
, 0, &start_index
, 10, &count
, &names
);
325 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
326 ok(count
== 2, "expected 2, got %u\n", count
);
327 ok(start_index
== 2, "expected 2, got %u\n", start_index
);
328 ok(names
!= NULL
, "names should not be NULL\n");
330 for (i
= 0; i
< count
; i
++)
332 if (!lstrcmpW(names
[i
], Folder1
))
334 else if (!lstrcmpW(names
[i
], Folder2
))
336 MIDL_user_free(names
[i
]);
338 MIDL_user_free(names
);
339 ok(enumed
== 3, "expected 3, got %u\n", enumed
);
344 hr
= SchRpcEnumFolders(Wine
, 0, &start_index
, 0, &count
, &names
);
345 ok(hr
== S_FALSE
, "expected S_FALSE, got %#x\n", hr
);
346 ok(!count
, "expected 0, got %u\n", count
);
347 ok(start_index
== 10, "expected 10, got %u\n", start_index
);
348 ok(!names
, "expected NULL, got %p\n", names
);
350 hr
= SchRpcDelete(Wine_Folder1
+1, 0);
351 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
352 hr
= SchRpcDelete(Wine_Folder2
, 0);
353 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
358 hr
= SchRpcEnumTasks(Wine_Folder1
, TASK_ENUM_HIDDEN
, &start_index
, 0, &count
, &names
);
359 ok(hr
== HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND
), "expected ERROR_FILE_NOT_FOUND, got %#x\n", hr
);
360 ok(!count
, "expected 0, got %u\n", count
);
361 ok(!start_index
, "expected 0, got %u\n", start_index
);
362 ok(!names
, "expected NULL, got %p\n", names
);
366 hr
= SchRpcRegisterTask(Wine_Task1
+1, xmlW
, TASK_CREATE
, NULL
, TASK_LOGON_NONE
, 0, NULL
, &path
, &info
);
367 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
368 ok(!lstrcmpW(path
, Wine_Task1
) /* win7 */ || !lstrcmpW(path
, Wine_Task1
+1) /* vista */,
369 "expected \\Wine\\Task1, task actual path %s\n", wine_dbgstr_w(path
));
370 ok(!info
, "expected NULL, info %p\n", info
);
371 MIDL_user_free(path
);
375 hr
= SchRpcRegisterTask(Wine_Task2
, xmlW
, TASK_CREATE
, NULL
, TASK_LOGON_NONE
, 0, NULL
, &path
, &info
);
376 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
377 ok(!lstrcmpW(path
, Wine_Task2
), "expected \\Wine\\Task2, task actual path %s\n", wine_dbgstr_w(path
));
378 ok(!info
, "expected NULL, info %p\n", info
);
379 MIDL_user_free(path
);
384 hr
= SchRpcEnumTasks(Wine
, 0, &start_index
, 0, &count
, &names
);
385 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
386 ok(count
== 2, "expected 2, got %u\n", count
);
387 ok(start_index
== 2, "expected 2, got %u\n", start_index
);
388 ok(names
!= NULL
, "names should not be NULL\n");
390 for (i
= 0; i
< count
; i
++)
392 if (!lstrcmpW(names
[i
], Task1
))
394 else if (!lstrcmpW(names
[i
], Task2
))
396 MIDL_user_free(names
[i
]);
398 MIDL_user_free(names
);
399 ok(enumed
== 3, "expected 3, got %u\n", enumed
);
404 hr
= SchRpcEnumTasks(Wine
, 0, &start_index
, 1, &count
, &names
);
405 ok(hr
== S_FALSE
, "expected S_FALSE, got %#x\n", hr
);
406 ok(count
== 1, "expected 1, got %u\n", count
);
407 ok(start_index
== 1, "expected 1, got %u\n", start_index
);
408 ok(names
!= NULL
, "names should not be NULL\n");
409 /* returned name depends whether directory randomization is on */
410 ok(!lstrcmpW(names
[0], Task1
) || !lstrcmpW(names
[0], Task2
),
411 "expected Task1, got %s\n", wine_dbgstr_w(names
[0]));
412 MIDL_user_free(names
[0]);
413 MIDL_user_free(names
);
418 hr
= SchRpcEnumTasks(Wine
, 0, &start_index
, 2, &count
, &names
);
419 ok(hr
== S_FALSE
, "expected S_FALSE, got %#x\n", hr
);
420 ok(count
== 2, "expected 2, got %u\n", count
);
421 ok(start_index
== 2, "expected 2, got %u\n", start_index
);
422 ok(names
!= NULL
, "names should not be NULL\n");
424 for (i
= 0; i
< count
; i
++)
426 if (!lstrcmpW(names
[i
], Task1
))
428 else if (!lstrcmpW(names
[i
], Task2
))
430 MIDL_user_free(names
[i
]);
432 MIDL_user_free(names
);
433 ok(enumed
== 3, "expected 3, got %u\n", enumed
);
438 hr
= SchRpcEnumTasks(Wine
, 0, &start_index
, 10, &count
, &names
);
439 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
440 ok(count
== 2, "expected 2, got %u\n", count
);
441 ok(start_index
== 2, "expected 2, got %u\n", start_index
);
442 ok(names
!= NULL
, "names should not be NULL\n");
444 for (i
= 0; i
< count
; i
++)
446 if (!lstrcmpW(names
[i
], Task1
))
448 else if (!lstrcmpW(names
[i
], Task2
))
450 MIDL_user_free(names
[i
]);
452 MIDL_user_free(names
);
453 ok(enumed
== 3, "expected 3, got %u\n", enumed
);
457 hr
= SchRpcRegisterTask(Wine_Task3
+1, xmlW
, TASK_CREATE
, NULL
, TASK_LOGON_NONE
, 0, NULL
, &path
, &info
);
458 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
459 ok(!lstrcmpW(path
, Wine_Task3
) /* win7 */ || !lstrcmpW(path
, Wine_Task3
+1) /* vista */,
460 "expected \\Wine\\Task3, task actual path %s\n", wine_dbgstr_w(path
));
461 ok(!info
, "expected NULL, info %p\n", info
);
462 MIDL_user_free(path
);
466 hr
= SchRpcEnumTasks(Wine
+1, 0, &start_index
, 10, &count
, &names
);
467 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
468 ok(count
== 1, "expected 1, got %u\n", count
);
469 ok(start_index
== 3, "expected 3, got %u\n", start_index
);
470 ok(names
!= NULL
, "names should not be NULL\n");
471 /* returned name depends whether directory randomization is on */
472 ok(!lstrcmpW(names
[0], Task1
) || !lstrcmpW(names
[0], Task2
) || !lstrcmpW(names
[0], Task3
),
473 "expected Task3, got %s\n", wine_dbgstr_w(names
[0]));
474 MIDL_user_free(names
[0]);
475 MIDL_user_free(names
);
477 if (0) /* crashes under win7 */
479 hr
= SchRpcGetTaskInfo(NULL
, 0, NULL
, NULL
);
480 hr
= SchRpcGetTaskInfo(Task1
, 0, NULL
, NULL
);
481 hr
= SchRpcGetTaskInfo(Task1
, 0, &enabled
, NULL
);
482 hr
= SchRpcGetTaskInfo(Task1
, 0, NULL
, &state
);
485 hr
= SchRpcGetTaskInfo(Task1
, 0, &enabled
, &state
);
486 ok(hr
== HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND
), "expected ERROR_FILE_NOT_FOUND, got %#x\n", hr
);
488 enabled
= state
= 0xdeadbeef;
489 hr
= SchRpcGetTaskInfo(Wine_Task1
, 0, &enabled
, &state
);
490 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
491 ok(enabled
== 0, "expected 0, got %u\n", enabled
);
492 ok(state
== TASK_STATE_UNKNOWN
, "expected TASK_STATE_UNKNOWN, got %u\n", state
);
494 enabled
= state
= 0xdeadbeef;
495 hr
= SchRpcGetTaskInfo(Wine_Task1
, SCH_FLAG_STATE
, &enabled
, &state
);
496 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
497 ok(enabled
== 0, "expected 0, got %u\n", enabled
);
498 ok(state
== TASK_STATE_DISABLED
, "expected TASK_STATE_DISABLED, got %u\n", state
);
500 hr
= SchRpcEnableTask(Wine_Task1
, 0xdeadbeef);
502 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
504 enabled
= state
= 0xdeadbeef;
505 hr
= SchRpcGetTaskInfo(Wine_Task1
, SCH_FLAG_STATE
, &enabled
, &state
);
506 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
508 ok(enabled
== 1, "expected 1, got %u\n", enabled
);
510 ok(state
== TASK_STATE_READY
, "expected TASK_STATE_READY, got %u\n", state
);
512 hr
= SchRpcDelete(Wine_Task1
+1, 0);
513 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
514 hr
= SchRpcDelete(Wine_Task2
+1, 0);
515 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
516 hr
= SchRpcDelete(Wine_Task3
+1, 0);
517 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
518 hr
= SchRpcDelete(Wine
, 0);
519 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
523 hr
= SchRpcRegisterTask(NULL
, xmlW
, TASK_CREATE
, NULL
, TASK_LOGON_NONE
, 0, NULL
, &path
, &info
);
524 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
525 ok(!info
, "expected NULL, info %p\n", info
);
526 hr
= IIDFromString(path
, &iid
);
527 ok(hr
== S_OK
, "IIDFromString(%s) error %#x\n", wine_dbgstr_w(path
), hr
);
528 hr
= SchRpcDelete(path
, 0);
529 ok(hr
== S_OK
, "expected S_OK, got %#x\n", hr
);
530 MIDL_user_free(path
);
532 hr
= RpcBindingFree(&rpc_handle
);
533 ok(hr
== RPC_S_OK
, "RpcBindingFree error %#x\n", hr
);
536 void __RPC_FAR
*__RPC_USER
MIDL_user_allocate(SIZE_T n
)
538 return HeapAlloc(GetProcessHeap(), 0, n
);
541 void __RPC_USER
MIDL_user_free(void __RPC_FAR
*p
)
543 HeapFree(GetProcessHeap(), 0, p
);